Network Analyst Locator (arcpy)
摘要
提供用于确定网络位置的类的源、捕捉类型和搜索查询信息。
讨论
定位器对象的 source、snapType 和 searchQuery 属性是动态的。也就是说,给定的定位器对象支持的属性总数取决于 locatorCount 属性。例如,如果 locatorCount 属性的值为 2,则定位器对象会支持 source0、source1、snapType0、snapType1、searchQuery0 和 seacrhQuery1 属性。
属性
| 属性 | 说明 | 数据类型 | 
| sourceX (只读)  | 
 The name of a particular class used by the locator.  | String | 
| snapTypeX (只读)  | 
 An underscore-separated string containing the snap types used for a given class in the locator. The possible snap types are 
  | String | 
| searchQueryX (只读)  | A query to restrict the search to a subset of the features within a given class in the locator.  | String | 
代码实例
网络分析定位器示例
显示网络分析图层的定位器属性。
# Name: NALayerLocatorProperties_ex01.py
# Description: Prints the source name and snap type information
#              for the locators used by a network analysis layer
import arcpy
in_layer = "C:/Data/Route.lyr" 
# Create a Describe object from layer file.
desc = arcpy.Describe(in_layer) 
count = desc.locatorCount 
locators = desc.locators 
#print locator information
print "Total Locators: ", count 
for i in range(0, count): 
    sourceName = getattr(locators,"source" + str(i))
    snapType = getattr(locators,"snapType" + str(i))
    query = getattr(locators, "searchQuery" + str(i))
    print "%s : %s : %s" % (sourceName,snapType, query)
9/15/2013