GeoDjango¶
Django MongoDB Backend supports GeoDjango.
Spatial fields¶
Each model field stores data as GeoJSON objects.
All fields have a 2dsphere index created on them.
Spatial lookups¶
Added in version 6.0.1.
The following spatial lookups are supported:
For all lookups, the lookup value must be a geometry object (e.g.
Point,
LineString, etc.) or a geometry
collection (e.g.
MultiPoint,
MultiLineString, etc.). MongoDB does not
support expressions (F,
Subquery, etc.) for spatial lookup values.
Raw spatial queries¶
You can use any of the geospatial query operators or the geospatial aggregation
pipeline stage in raw_aggregate() queries.
Configuration¶
Install the necessary Geospatial libraries (GEOS and GDAL).
Add
django.contrib.gistoINSTALLED_APPSin your settings. This is so that thegistemplates can be located – if not done, then features such as the geographic admin or KML sitemaps will not function properly.
Limitations¶
MongoDB doesn’t support any spatial reference system identifiers (
BaseSpatialField.srid) besides 4326 (WGS84).GIS aggregate functions and geographic database functions aren’t supported.
RasterFieldisn’t supported.