djangorestframework-gis
Geographic add-ons for Django Rest Framework
What it is and what it does
djangorestframework-gis extends Django REST Framework with geographic data handling, automatically mapping GeoDjango geometry fields to a custom GeometryField that serializes to and from GeoJSON. It provides a GeometryField with optional coordinate precision rounding, duplicate coordinate removal, bounding-box generation, and coordinate transformation support, plus a GeometrySerializerMethodField for computed geometry values. The package integrates transparently into DRF's serializer system once added to INSTALLED_APPS, eliminating the need for explicit field declarations in most cases.
The package is built on top of django, djangorestframework, and django-filter, and is designed for REST APIs that expose spatial data—locations, boundaries, routes, or any geometry stored in a GeoDjango model. It handles the conversion between database geometry representations and the GeoJSON standard expected by web clients and mapping libraries.
Use it for:
- Build a location-based REST API that returns points, polygons, or linestrings as GeoJSON for mapping frontends
- Serialize GeoDjango models with geometry fields without manual field mapping or custom serializer logic
- Reduce API response size by rounding coordinate precision or removing duplicate points from geometries
- Transform geometries to a standard projection for GeoJSON compliance in REST responses
- Create computed geometry fields in serializers using GeometrySerializerMethodField for derived spatial data
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Adds geographic and GeoJSON support to Django REST Framework, providing serialization fields and utilities for handling GeoDjango geometry objects in REST APIs.
Yes. The package is actively maintained, has no known vulnerabilities, low install friction, and a permissive BSD license. It directly solves the problem of serializing GeoDjango geometries in REST APIs and is the standard tool for this task in the Django ecosystem. Install it if you need to expose spatial data via REST.
Install
djangorestframework-gis on PyPI
pip
pip install djangorestframework-gisuv
uv add djangorestframework-gispoetry
poetry add djangorestframework-gisInstalling djangorestframework-gis
Before you install
Low install friction with a pure-Python wheel distribution. Actively maintained with recent releases; last commit 2026-08-10 and 1125 repository stars indicate ongoing support.
License in practice
BSD license is permissive, allowing commercial and private use with minimal restrictions—suitable for most projects.
Quickstart
pip install djangorestframework-gis
# In settings.py, add to INSTALLED_APPS after rest_framework:
INSTALLED_APPS = [
'rest_framework',
'rest_framework_gis',
]
# GeometryField handles geometry serialization automatically once installed.
Requires django, djangorestframework, and django-filter as runtime dependencies; GeoDjango support in your Django installation is assumed.
Verify before relying
- Whether GeoDjango/GEOS is automatically available or requires separate system-level spatial libraries
- Performance characteristics when handling large GeoJSON responses with precision rounding or duplicate removal
- Exact Python version requirements beyond the classifiers listed (3.9 to 3.13)
Package facts
| License | BSD (permissive) |
| Python support | not specified |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 3 — django, djangorestframework, django-filter |
| Maintenance | actively maintained — 102 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 451,961/month — #6,584 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: djangorestframework_gis-1.2.1-py2.py3-none-any.whl
Keywords: django, rest-framework, gis, geojson
Tags
More WWW/HTTP packages
urllib3 is an HTTP client library that provides…
permissive · top 100 on PyPI
requestsRequests is a Python HTTP library that…
permissive · top 100 on PyPI
h11h11 is a pure-Python HTTP/1.1 protocol…
permissive · top 100 on PyPI
httpxHTTPX is a fully featured HTTP client library…
permissive · top 100 on PyPI
httpcoreA minimal low-level HTTP client library that…
permissive · top 100 on PyPI
aiohttpaiohttp is an async HTTP client and server…
permissive · top 100 on PyPI
geojsonEncodes, decodes, and represents GeoJSON…
permissive · top 5,000 on PyPI
geopandasGeoPandas extends pandas DataFrames to handle…
permissive · top 1,000 on PyPI
arcgis2geojsonConverts ArcGIS JSON format to GeoJSON format,…
permissive · top 15,000 on PyPI
djangorestframework-recursiveAdds a RecursiveField to Django REST Framework…
permissive · top 15,000 on PyPI
django-jsonfieldProvides a JSONField for Django models that…
permissive · top 15,000 on PyPI
pydantic-geojsonProvides Pydantic-based type-safe validation…
permissive · top 15,000 on PyPI
djangorestframework-stubsProvides PEP-484 type stubs for Django REST…
permissive · top 5,000 on PyPI
drf-extra-fieldsProvides specialized serializer fields for…
permissive · top 15,000 on PyPI
geojson-pydanticProvides Pydantic models that validate and…
permissive · top 5,000 on PyPI
algoliasearch-djangoIntegrates Algolia's hosted search service into…
permissive · top 5,000 on PyPI