Django REST Framework GIS (DRF-GIS) provides geographic add-ons for Django Rest Framework, enabling the creation of REST APIs for geospatial data. It offers GIS-specific fields and serializers, including GeoJSON support. The current version is 1.2.0. Releases are somewhat irregular, with major updates typically annually, and minor versions released as needed.
pip install djangorestframework-gisVerified import paths — ran on the pinned version, not inferred.
This quickstart illustrates a basic Django model with a GIS `PointField`, a `GeoFeatureModelSerializer` to output GeoJSON, and a DRF `ListCreateAPIView`. It shows the essential components needed to expose geospatial data via a REST API. Note that this requires a properly configured Django project with `django.contrib.gis` and a spatial database (e.g., PostGIS) backend. The Django setup within the snippet makes it runnable as a standalone script for component definition check.
Upgrade Python to 3.8+ (3.13+ recommended), Django to 4.2+ (5.2+ recommended), and Django REST Framework to 3.12+ (3.16.0+ recommended).
Upgrade Python to 3.4+ (see main breaking change for recommended versions) and `django-filters` to 2.0+.
Upgrade `djangorestframework-gis` to version 1.0.0 or higher to resolve the `default_app_config` deprecation warning.
If you relied on `GeometryField`'s `style` argument, upgrade to version 0.16.0 or higher to ensure custom styles are applied correctly without being overridden.
Upgrade `djangorestframework-gis` to version 0.16.0 or higher to correctly handle and represent empty geometries in your API responses.
Upgrade `djangorestframework-gis` to version 1.0.0 or higher to ensure correct deserialization of the `id_field`.
Upgrade `djangorestframework-gis` to version 1.1.0 or higher if you need to serialize models that may or may not have a geometry field.