django-geojson

Serve vectorial map layers with Django
Download

django-geojson Ranking & Summary

Advertisement

  • Rating:
  • License:
  • LGPL
  • Price:
  • FREE
  • Publisher Name:
  • Mathieu Leplatre
  • Publisher web site:
  • http://mathieu-leplatre.info

django-geojson Tags


django-geojson Description

django-geojson is a Django app to serve vectorial map layers with Django.INSTALLpip install django-geojsonUSAGEGeoJSON layer viewVery useful for web mapping :from djgeojson.views import GeoJSONLayerViewclass MeetingLayer(GeoJSONLayerView): model = Meeting fields = ('title', 'datetime',) # Options srid = 4326 # projection precision = 4 # float simplify = 0.5 # generalizationConsume the vector layer as usual, for example, with Leaflet :var layer = L.GeoJSON();map.addLayer(layer);$.getJSON('{% url viewname %}', function (data){ layer.addData(data);});GeoJSON template filterWill work either for a model, a geometry field or a queryset.{% load geojson_tags %}var feature = {{ object|geojsonfeature }};var geom = {{ object.geom|geojsonfeature }};var collection = {{ object_list|geojsonfeature }};Dump GIS modelsRegister the serializer in your project :# settings.pySERIALIZATION_MODULES = { 'geojson' : 'djgeojson.serializers'}Command-line dumpdata can export files, viewable in GIS software like QGis :django dumpdata --format=geojson yourapp.Model > export.geojsonWorks with loaddata as well, which can now import GeoJSON files.Product's homepage


django-geojson Related Software