skillfed

djangorestframework-gis

Geographic add-ons for Django Rest Framework

djangorestframework-gis v1.2.1 452.0K downloads/30d#6,584 on PyPI1,125
Permissive license BSD Active released

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-gis

uv

uv add djangorestframework-gis

poetry

poetry add djangorestframework-gis

Installing 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

Development Status :: 5 - Production/StableEnvironment :: Web EnvironmentFramework :: DjangoIntended Audience :: DevelopersLicense :: OSI Approved :: BSD LicenseOperating System :: OS IndependentProgramming Language :: PythonProgramming Language :: Python :: 3Programming Language :: Python :: 3 :: OnlyProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.9Topic :: Internet :: WWW/HTTP

Tags

django rest framework geojsongeospatial api serializationdjango gis rest apigeometry field serializergeodjango rest frameworkgeojson rest apispatial data rest framework
geospatialdjango-rest-frameworkgeojson

More WWW/HTTP packages