inmud05

measureOnLine in 10.2.1

Discussion created by inmud05 on Mar 11, 2014
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: http://resources.arcgis.com/en/help/main/10.2/index.html#//018z00000070000000 ?

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 = cursorStop.next()

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

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

Cheers,
Sui Tao

Outcomes