Skip to main content
This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (
Help us improve Python packaging - Donate today!

Mapscript based WMS framework for GeoDjango

Project Description

The Django WMS Framework is a toolkit that makes it easy to build a Web Map Service (WMS) or a x-y-z Tile Map Service. Rendering of both vector and raster data formats are supported.

For complete documentation please go to


The processing of spatial data in django-wms relies on MapServer and its python bindings MapScript. Raster data integration depends on the django-raster package. The use of PostGIS as the database backend is required as well, for raster ntegration PostGIS >= 2.0 is required (see also django-raster package).


  1. Install package with pip install django-wms

  2. Add “wms” to your INSTALLED_APPS setting like this:



To create a mapping service, subclass the django-wms layer, map and view classes and connect them to an existing model in django that has a spatial field (such as Point, Polygon or MultiPolygon). An example module could be specified as follows


# Load django-wms classes
from wms import maps, layers, views

# Load model with spatial field (Point, Polygon or MultiPolygon)
from myapp.models import MySpatialModel

# Subclass the WmsVectorLayer class and point it to a spatial model.
# Use WmsRasterLayer for rasters
class MyWmsLayer(layers.WmsVectorLayer):
    model = MySpatialModel

# Subclass the WmsMap class and add the layer to it
class MyWmsMap(maps.WmsMap):
    layer_classes = [ MyWmsLayer ]

# Subclass the WmsView to create a view for the map
class MyWmsView(views.WmsView):
    map_class = MyWmsMap

With the WmsView subclass in place, the only thing left to do to create a functional map service is to hook the view into a url. An example url configuration could be


# Import the wms view
from myproject.wms_config import MyWmsView

# Add url patterns to setup map services from the view
urlpatterns = patterns('',

    # This creates a WMS endpoint
    url(r'^wms/$', MyWmsView.as_view(), name='wms'),

    # This creates a TMS endpoint
        MyWmsView.as_view(), name='tms'),

The django-wms package will automatically detect the first spatial field it can find in MySpatialModel and create a WMS endpoint from the class based view. If the three arguments x, y and z are found in the urlpattern, the view functions as TMS endpoint.

Release History

Release History

This version
History Node


History Node


History Node


Download Files

Download Files

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

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
django-wms-0.1.12.tar.gz (9.3 kB) Copy SHA256 Checksum SHA256 Source Apr 26, 2016

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting