Am using GeoDjango with PostGIS as Backend. I have few geojson files with features as following example. GeoDjango has provided information to import shape files and other formats but geojson formats. How do I import these geojson files into DB?
"features": [
{ "type": "Feature", "properties": { "SubName": "X", "SubSubName": "A" }, "geometry": { "type": "Polygon", "coordinates": [ [ [ 70.693828, 37.074496 ], [ 70.693828, 37.074496 ] ] ] } }
,
{ "type": "Feature", "properties": { "SubName": "X", "SubSubName": "B" }, "geometry": { "type": "Polygon", "coordinates": [ [ [ 70.502913, 27.065997 ], [ 70.502913, 27.065997 ] ] ] } }
I have two core requirements:
It would be great, if there is proper documentation on PostGIS usage & import files for GeoDjango.
Thanks in Advance.
Add a GeoJSON file to My Content to share it. Publish a hosted feature layer from a GeoJSON file. For hosted feature layers that have export enabled, you can export the layer data to a GeoJSON file. Add a GeoJSON file as a layer to Map Viewer Classic.
Taken from - https://docs.djangoproject.com/en/1.9/ref/contrib/gis/geos/
from django.contrib.gis.geos import GEOSGeometry
# load from geo-json str
pnt = GEOSGeometry('{ "type": "Point", "coordinates": [ 5.000000, 23.000000 ] }')
The geojson can be for anything like polygon, multi-polygon, etc.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With