Arcpy - 如何更改空间启用的数据框中几何对象的空间参考?
我使用以下代码将数据从 arcgis pro 要素类导出到支持空间的数据帧。导出的数据空间参考必须为 4326。
out_coordinate_system = arcpy.SpatialReference(4326)
arcpy.env.addOutputsToMap = False
arcpy.Project_management(fc, fc.name + "_wgs84", out_coordinate_system)
arcpy.env.addOutputsToMap = True
#Create a spatially enabled dataframe from featureclass
sdf = pd.DataFrame.spatial.from_featureclass(fc.name + "_wgs84")
#Cleanup temporary layer created for reprojection
arcpy.Delete_management(fc.name + "_wgs84")
有没有办法避免使用投影工具创建临时 feature_class 并使用 arcpy.geometry 将几何对象重新投影到 sdf 对象的 SHAPE 列中的 SR 4326?
I'm using the following code to export data from an arcgis pro feature class into a spatially enabled dataframe. Exported data spatial reference has to be 4326.
out_coordinate_system = arcpy.SpatialReference(4326)
arcpy.env.addOutputsToMap = False
arcpy.Project_management(fc, fc.name + "_wgs84", out_coordinate_system)
arcpy.env.addOutputsToMap = True
#Create a spatially enabled dataframe from featureclass
sdf = pd.DataFrame.spatial.from_featureclass(fc.name + "_wgs84")
#Cleanup temporary layer created for reprojection
arcpy.Delete_management(fc.name + "_wgs84")
Is there a way to avoid the creating a temporary feature_class with the Project tool and reproject geometry objects to SR 4326 in the SHAPE column of the sdf object using arcpy.geometry ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
设法使其与 project_as() 函数一起使用,因为存储在 sdf 的 SHAPE 列中的对象具有
arcgis.geometry 对象
数据类型。Managed to make it work with the project_as() function as objects stored in the SHAPE column of the sdf have
arcgis.geometry objects
data type.