Django model creating geography not geometry fields

812 views Asked by At

I have a Django model in which i declare maplocation = models.PointField() I'd like to work with geography not geometry, if i use python manage.py sql it maps as "maplocation" geometry(POINT,4326) NOT NULL,

what do i need to do so that the translation will be correct?

1

There are 1 answers

0
HankMoody On

Don't really know, but some tips:

  1. You need to have PostGIS 1.5+ installed.

  2. Define field like this: maplocation = models.PointField(geography=True).

  3. Set model manager to django.contrib.gis.db.models.GeoManager (I think this is not required to use geography, but You will need it later to make queries).