python2 arcpy.CreateFeatureclass_management()输入参数设置

在使用arcpy的CreateFeatureclass_management函数创建POLYGON要素类时,需注意正确拼接根目录和文件名。如果将完整路径预先定义,可能导致报错。正确做法是分开指定根目录和文件名作为函数参数,以避免路径错误。
摘要由CSDN通过智能技术生成
root_path = "E:\\GIS RS\\20230305\\"
corresPolygon = "corresPolygon"+str(int(input_point.X * 1000))+"_"+str(int(input_point.Y * 1000))+".shp"
    

在使用arcpy.CreateFeatureclass_management()函数时,输入参数必须分开写,先写根目录,再写文件名,如下:

arcpy.CreateFeatureclass_management(root_path,corresPolygon,"POLYGON",spatial_reference = spatial_ref)

这样才不会报错。

要是提前定义为:

corresPolygon ="E:\\GIS RS\\20230305\\corresPolygon"+str(int(input_point.X * 1000))+"_"+str(int(input_point.Y * 1000))+".shp"

再执行如下:

arcpy.CreateFeatureclass_management(corresPolygon,"POLYGON",spatial_reference = spatial_ref)

则会报错。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值