Skip to main content

GeoJSON tile view for Django

Project description

A simple Django view to serve GeoJSON tiles from a GeoDjango model

Description

The view will return a GeoJSON FeatureCollection for each tile. Each feature corresponds to a row of the model.

Setup

pip install django-geojson-tiles

Add the following to your urls.py:

from geojson_tiles.views import GeoJSONTile
from your_app import GeometryModel

urlpatterns = patterns('',
    url(r'^your_endpoint/(?P<z>\d+)/(?P<x>\d+)/(?P<y>\d+).json$',
        GeoJSONTile(GeometryModel, geometry_field='geometry_field', trim_to_boundary=True))
)

Notes

  1. geometry_field='geometry_field' specifies the geometry to use in the feature. If no geometry_field is specified: the first GeometryField in the model’s field set is used.

  2. trim_to_boundary=True will result in GeoJSON tiles with geometries trimmed to the tile boundary

  3. properties=[...] can be used to limit the feature’s properties that are serialized

  4. properties={'field_name': 'property name'} will limit the feature’s properties and map field names (keys) to property names (values).

Project details


Download files

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

Source Distribution

django-geojson-tiles-0.0.6.tar.gz (4.4 kB view details)

Uploaded Source

File details

Details for the file django-geojson-tiles-0.0.6.tar.gz.

File metadata

File hashes

Hashes for django-geojson-tiles-0.0.6.tar.gz
Algorithm Hash digest
SHA256 0381e2104d9441a2ca5a6b1795257b08276d929c7c543560bfe30924c8122687
MD5 b6e9cc1579fb606ee75e14d886d0fd72
BLAKE2b-256 e1fd5221ed9cadb6d58e0830fe08062f0d0328770c8245a727c71e7eefa6cbc0

See more details on using hashes here.

Provenance

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page