2

The Django docs say to use

createdb -T template_postgis geodjango

but I already have a database set up. While trying to find out what this actually does and a way to apply it to an existing database, I found this on postgis.net:

-- Enable PostGIS (includes raster)
CREATE EXTENSION postgis;
-- Enable Topology
CREATE EXTENSION postgis_topology;
-- fuzzy matching needed for Tiger
CREATE EXTENSION fuzzystrmatch;
-- Enable US Tiger Geocoder
CREATE EXTENSION postgis_tiger_geocoder;

In trying to figure out what Tiger is, I found this in the postgis docs:

psql -d [yourdatabase] -c "CREATE EXTENSION postgis;"
Topology is packaged as a separate extension and installable with command:
psql -d [yourdatabase] -c "CREATE EXTENSION postgis_topology;"

How do I ready my current Django database for use with PostGIS and GeoDjango?

I'm using Django 1.8 and PostgreSQL 9.4.

  • What do you want to know? That's all. Go to your db and create those extensions, then you will be able to connect this db in settings.py – dmh126 Aug 16 '15 at 14:30
  • What does creating a database with template_postgis do? And what are fuzzystrmatch and postgis_tiger_geocoder for? – StringsOnFire Aug 16 '15 at 14:31
  • Template did exactly the same as create extensions, it was only way to create postgis, but now create extensions postgis; is recommended. I guess the tiger extensions are for tiger data support: census.gov/geo/maps-data/data/tiger.html – dmh126 Aug 16 '15 at 15:05
  • If you already have a db, you can use migrate.py from geodjango to register them – John Powell Aug 17 '15 at 4:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.