我使用PostGIS作为后端geojango。我有几个geojson文件的功能如下面的例子。geojango提供了导入形状文件和除geojson格式以外的其他格式的信息。我如何导入这些geojson文件到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 ] ] ] } }
我有两个核心要求:
- 使用D3JS地图库在门户网站上加载子区域多边形
- 当我有一个latlong时,找到这个点存在于哪个多边形并获得子名称&SubSubName从多边形属性。
如果有适当的PostGIS使用文档,那就太好了& &;
摘自- 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 ] }')
geojson可以是多边形,多多边形等。