我在包含我做了兩個簡單的多邊形描述,並從http://ryanmullins.org/blog/2015/8/18/land-area-vectors-for-geographic-combatant-commandsPython的 - 身材勻稱大shape文件
6個複雜矢量我可以讀我自己的4-8點描述成身材勻稱多邊形A GeoJSON的文件中讀取。然而,從網站更復雜的描述上面給我以下錯誤:
from shapely.geometry import Polygon
jsonFile="path/to/file.json"
with open(jsonFile) as f:
data=json.load(f)
for feature in data['features']:
#This is not how I'm saving the polygons, and is only for testing purposes:
myPoly=Polygon(feature['geometry']['coordinates'])
錯誤消息:
File "/.../anaconda2/lib/python2.7/site-packages/shapely/geometry/polygon.py", line 229, in __init__
self._geom, self._ndim = geos_polygon_from_py(shell, holes)
File "/.../anaconda2/lib/python2.7/site-packages/shapely/geometry/polygon.py", line 508, in geos_polygon_from_py
geos_shell, ndim = geos_linearring_from_py(shell)
File "/.../anaconda2/lib/python2.7/site-packages/shapely/geometry/polygon.py", line 454, in geos_linearring_from_py
assert (n == 2 or n == 3)
AssertionError
他們被解讀爲列表,與USAFRICOM長度爲113
有沒有辦法將這些非常長的矢量整齊地讀入?我已經嘗試Polygon,MultiPoint,asMultiPointIf。如果沒有,你能否建議如何將這個向量描述簡化成Shapely可以讀取的東西?