javascript - Django 1.8 Geojson -
when serializing model geojson (https://docs.djangoproject.com/en/1.8/ref/contrib/gis/serializers/), how can pass primary key through?
{"type": "featurecollection", "crs": {"type": "name", "properties": {"name": "epsg:4326"}}, "features": [{"type": "feature", "properties":
you expect there feature id using models pk, based on geojson standard, there isn't. it's not passed through in object properties either.
i hack adding field, duplicate of pk, there must way of passing through.
the reason i'm using geojson because want pass coordinates google maps api, , if serialize pointfield normal json end like:
"location": "srid=4326;point (-0.1468187000000000 51.5052463000000031)"
maps api expect coordinates (51.5052463000000031, -0.1468187000000000). coordinates format js though perhaps?
thanks
i've been working on similar found django rest framework - gis , django rest framework useful this.
Comments
Post a Comment