Giter Club home page Giter Club logo

gis's Introduction

Geographic Information System

This is base on geodjango, and it jsut a simple for Geographic Information System. If you wnat to know other details aboutgeodjango, you can see here.

Start

  • pip must be installed.
  • PostgreSQL must be installed.
  • Install virtualenv:
  pip install virtualenv
  • Create and open virtual environment:
  virtualenv --no-site-packages venv
  source venv/bin/activate
  • Install packages:
  pip install -r requirement.txt

If you can not install psycopg2, you need to install python-psycopg2, python-dev and libpq-dev.

  • Create a project:
  django-admin startproject (project name)

Setting

  • Get in project:
  cd (project name)
  • Open project settings.py:
  vim (project name)/settings.py

and modify INSTALLED_APPS and DATABASES:

  ...
  INSTALLED_APPS = [
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'django.contrib.gis',
  ]
  ...
  DATABASES = {
    'default': {
      'ENGINE': 'django.contrib.gis.db.backends.postgis',
      'NAME': '(change to your postgres database`s name)',
      'USER': '(change to your postgres user`s name)',
      'HOST': 'locolhost',
      'PASSWORD': '(change to your postgres password)',
    }
  }
  • Run migrate:
  python manage.py migrate

If you can not migrate, you can try to install postgresql-9.3-postgis-scripts.

Server

  • Run server(localhost):
  python manage.py runserver
  • Run server(online):
  python manage.py runserver 0.0.0.0:(port)

Add app

  • Here is app list.
  • Download and unzip it to project:
  wegt https://hsuting.github.io/gis/release/(app name).tar.gz
  tar -C (project name) -zvxf (app name).tar.gz
  • Add app to your project settings.py:
INSTALLED_APPS = [
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'django.contrib.gis',
    '(app name)',
]
  • Add url to your project urls.py:
urlpatterns = [
    url(r'^admin/', admin.site.urls),
    url(r'^(app name)/', include('(app name).urls')),
]
  • Run migrate:
python manage.py makemigrations
python manage.py sqlmigrate (app name) (number of migrations)
python manage.py migrate

When you run makemigrations, you will get a text like 0001_initial.py. 0001 is number of migrations.

  • Add data to database:
python manage.py shell

Then you will get in django shell.

from (app name) import load
load.run()

gis's People

Contributors

hsuting avatar

Watchers

James Cloos avatar  avatar  avatar YC avatar

Forkers

netdbncku

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.