我正在ArcGIS model Builder中创建一个模型,允许用户在地址数据库(存储为shapefile)中搜索地址,然后在Network Analyst中将其用作停止功能,以提供最佳路线。我可以在一个邮政编码中找到多个功能,但我不知道如何提取单个地址
我目前使用的地址数据库是北爱尔兰的指针数据库,它包含许多地址字段,如建筑编号、建筑名称、街道和邮政编码。我编写了一个python脚本来搜索邮政编码并将特征转换为shapefile,但结果(显然)是在邮政编码区域中找到了许多点特征。我发现很难想出一个脚本,将地址数据库中的字段组合起来,找到一个单点功能。以下是我用来从shapefile提取邮政编码的代码:
postcodei = arcpy.GetParameterAsText(0).upper()
outputLayer = arcpy.GetParameterAsText(1)
for address in addresses:
QueryStringPosti = "POSTCODE = \'" + postcodei + "\'"
arcpy.Select_analysis("Pointer_Fermanagh.shp","addressi.shp",QueryStringPosti)
arcpy.CopyFeatures_management("addressi.shp", outputLayer)
count = arcpy.GetCount_management("addressi.shp")
address_count = count.getOutput(0)
if int(address_count) > 0:
outString = address_count + " buildings within this postcode were found and imported to shapefile"
else:
outString = "*** ERROR: '" + postcodei + "' was not found"
arcpy.AddMessage(outString)
上面的脚本工作得很好,但是我如何增强它以合并数据集中的字段来搜索单个地址呢?如您所见,我只是刚刚开始使用python,因此非常感谢您的任何意见
目前没有回答
相关问题 更多 >
编程相关推荐