Network Analyst Locator

摘要

Provides the source, snap type, and search query information about the classes that are used to determine the network locations.

讨论

The source, snapType, and searchQuery properties for the locator object are dynamic. This means that the total number of properties supported by a given locator object depends on the locatorCount property. For example, if the value of the locatorCount property is 2, then the locator object will support source0, source1, snapType0, snapType1, searchQuery0, and seacrhQuery1 properties.

属性

属性说明数据类型
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

  • NONE
  • SHAPE
  • MIDDLE
  • END
String
searchQueryX
(只读)

A query to restrict the search to a subset of the features within a given class in the locator.

String

代码示例

Network Analyst Locator example

Displays the Network Analyst Layer Locator properties.

# 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)
    

7/10/2012