Skip to main content

Django speaking WFS 2.0 (exposing GeoDjango model fields)

Project description

Documentation Travis PyPI MPL License Coverage


Django speaking WFS 2.0 to expose geo data.


  • WFS 2.0 Basic implementation.
  • GML 3.2 output.
  • Standard and spatial filtering (FES 2.0)
  • GeoJSON and CSV export formats.
  • Extensible view/operations.
  • Uses GeoDjango queries for filtering.
  • Streaming responses for large datasets.


For more details, see:


Install the module in your project:

pip install django-gisserver

Add it to the INSTALLED_APPS:


Create a model that exposes a GeoDjango field:

from django.contrib.gis.db.models import PointField
from django.db import models

class Restaurant(models.Model):
    name = models.CharField(max_length=200)
    location = PointField(null=True)

    def __str__(self):

Write a view that exposes this model as a WFS feature:

from gisserver.features import FeatureType, ServiceDescription
from gisserver.geometries import CRS, WGS84
from gisserver.views import WFSView
from .models import Restaurant

RD_NEW = CRS.from_srid(28992)

class PlacesWFSView(WFSView):
    """An simple view that uses the WFSView against our test model."""

    xml_namespace = ""

    # The service metadata
    service_description = ServiceDescription(

    # Each Django model is listed here as a feature.
    feature_types = [

Use that view in the URLConf:

from django.urls import path
from . import views

urlpatterns = [
    path("/wfs/places/", views.PlacesWFSView.as_view()),

You can now use http://localhost:8000/wfs/places/ in your GIS application. It will perform requests such as:

By adding &OUTPUTFORMAT=geojson or &OUTPUTFORMAT=csv to the GetFeature request, the GeoJSON and CSV outputs are returned. The CSV output has an unlimited page size, as it's quite performant.

Why this code is shared

The "datapunt" team of the Municipality of Amsterdam develops software for the municipality. Much of this software is then published as Open Source so that other municipalities, organizations and citizens can use the software as a basis and inspiration to develop similar software themselves. The Municipality of Amsterdam considers it important that software developed with public money is also publicly available.

This package is initially developed by the City of Amsterdam, but the tools and concepts created in this project can be used in any city.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for django-gisserver, version 1.1.2
Filename, size File type Python version Upload date Hashes
Filename, size django_gisserver-1.1.2-py2.py3-none-any.whl (103.9 kB) File type Wheel Python version py2.py3 Upload date Hashes View
Filename, size django-gisserver-1.1.2.tar.gz (86.2 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page