Model and forms fieldsΒΆ

GeoJSON fields are based on Brad Jasper’s JSONField. See Installation to install extra dependencies.

They are useful to avoid usual GIS stacks (GEOS, GDAL, PostGIS...) for very simple use-cases (no spatial operation yet).

from djgeojson.fields import PointField

class Address(models.Model):
    geom = PointField()

address = Address()
address.geom = {'type': 'Point', 'coordinates': [0, 0]}

Form widgets are rendered with Leaflet maps automatically if django-leaflet is available.

All geometry types are supported and respectively validated : GeometryField, PointField, MultiPointField, LineStringField, MultiLineStringField, PolygonField, MultiPolygonField, GeometryCollectionField.