Select to view content in your preferred language

measureOnLine in 10.2.1

03-11-2014 07:54 PM
New Contributor II
Hi guys,

Just noting that this thread is related to another post of mine, but it is more specific about a new tool, so I put this as a new thread:

I'm wondering has anyone used this new script of 10.2.1 called measureOnLine: ?

I'm currently trying to use this script to measure the distances among a number of bus stops (a shpfile contains 10,000 points) that fall on a number of bus routes (a shpfile contains 900 polylines). Here's my code:

# import stop feature class and create geometry objects
>>> fcStop = 'C:/shapefile/bus_stops.shp'
>>> cursorStop = arcpy.da.SearchCursor(fcStop,['SHAPE@'])
>>> stopGeom =

# import route feature class and create geometry objects
>>> fcRoute = 'C:/shapefile/routes.shp'
>>> cursorRoute = arcpy.da.SearchCursor(fcRoute,['SHAPE@'])
>>> routeGeom =

#measure distance on route
>>> dist_along_route = routeGeom.measureOnLine(stopGeom,FALSE)

This returned the result:
Traceback (most recent call last):
File "<interactive input>", line 1, in <module>
AttributeError: 'tuple' object has no attribute 'measureOnLine'

Can anyone please tell me how to edit this script to make it work?

Sui Tao
0 Replies