Network Analyst Locator

Summary

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

Discussion

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.

Properties

PropertyExplanationData Type
sourceX
(Read Only)

The name of a particular class used by the locator.

String
snapTypeX
(Read Only)

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
(Read Only)

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

String

Code Sample

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)
    

10/28/2011