Tutorial Geodjango

You might also like

Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 1

django-admin startproject geodjango

python manage.py startapp world


INSTALLED_APPS = (
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'django.contrib.gis',
'world'
)
DATABASES = {
'default': {
'ENGINE': 'django.contrib.gis.db.backends.postgis',
'NAME': 'djangoGIS',
'USER': 'postgres',
'PASSWORD': '1234',
'HOST': 'localhost',
'PORT': '5432',
},
}
mkdir world/data
cd world/data
wget http://thematicmapping.org/downloads/TM_WORLD_BORDERS-0.3.zip
unzip TM_WORLD_BORDERS-0.3.zip
cd ../..
#Comando ogrinfo para obtener informacion geoespacial
ogrinfo world/data/TM_WORLD_BORDERS-0.3.shp
ogrinfo -so world/data/TM_WORLD_BORDERS-0.3.shp TM_WORLD_BORDERS-0.3
python manage.py makemigrations
python manage.py sqlmigrate world 0001
python manage.py migrate
#Generar una clase a partir de un shapefile
python manage.py ogrinspect world/data/TM_WORLD_BORDERS-0.3.shp WorldBorder \
--srid=4326 --mapping --multi
python manage.py createsuperuser
python manage.py runserver

You might also like