问题描述
我的最终目标是能够计算具有纬度/经度坐标的小多边形(1000 到 5000 平方英尺之间)的面积。我在这样做时遇到了一些意想不到的结果,并决定改用更统一和更大的区域(高中足球场)。有谁知道为什么我的结果与真实区域相差这么远?
from arcgis.gis import GIS
from arcgis.geometry import lengths,areas_and_lengths,project
from arcgis.geometry import Point,polygon,polyline,Geometry
from pyproj import Proj,transform
# define the original polygon (the corners of a high-school football field)
my_polygon = polygon({'spatialReference': {'wkid': 4326},'rings': [[[-97.73274828462698,30.284176038755415],[-97.73224604100734,30.284137821762556],[-97.73234528273382,30.283154018580472],[-97.73284886747372,30.283192815006274],[-97.73274828462698,30.284176038755415]]]})
# convert from '4326' to '3857'
new_coords = []
original = Proj(init='epsg:4326') # epsg:4326 in your case
destination = Proj(init='epsg:3857') # your new epsg
for ring in my_polygon['rings'][0]:
long,lat = ring
x,y = transform(original,destination,long,lat)
new_coords.append([x,y])
polygon1_reprojected = polygon({'spatialReference': {'latestWkid': 3857},'rings': [new_coords]
})
polygon1_reprojected.area
# This results in -7174.81640625,but we expect ~4,500... WHY?!
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)