使用ArcPy创建要素的代码段前面有发布,【arcpy】创建点、线、面(孔洞、环、多部件)要素、要素类
Q:这些代码里创建要素后会存在XY精度损失的问题,如何解决?
A:解决方案是在创建要素过程中指定正确的空间参考。
部分原文如下:
This observation goes back to 2010. If a spatial reference isn't specified, then you will get lower precision results. See https://geonet.esri.com/thread/10256 for starters. The examples are more extensive. There are even more in subsequent years. Specifying a floating point input has no impact, so rule that out as a thought.
>>> import arcpy
>>> corners =[[0.0,0.0],[0.0,1.0],[1.0,1.0],[1.0,0.0],[0.0,0.0]]
>>> p=arcpy.Polygon(arcpy.Array([arcpy.Point(*coords) for coords in corners]))
>>> p.area
1.0002441555261612
>>> # hmmmm close... try again
>>> SR = arcpy.SpatialReference(3395) # WGS_1984_ World_Mercator_3395.prj doesn't really matter
>>> p=arcpy.Polygon(arcpy.Array([arcpy.Point(*coords) for coords in corners]),SR)
>>> p.area
1.0
标签:要素,1.0,ArcPy,XY,coords,0.0,arcpy,精准
From: https://www.cnblogs.com/yzhyingcool/p/17323587.html