2

Is there a way to use a search cursor in ArcGIS to read the minimum measure and maximum measure values of a linear referenced route layer using arcpy? My goal is to build a route event using the start and end points of line segments but cannot figure out how to retrieve this data other than using the Identify Route Location Tool in ArcMap. I would like to get that type of information but using python.

3

Something like this?

with arcpy.da.SearchCursor(fc, "SHAPE@") as rows:
    for row in rows:
        extent = row[0].extent
        # Just an example of accessing the measures from extent:
        arcpy.AddMessage("Feature measures from {0} to {1}.".format(extent.MMin, extent.MMax))
1

There are few very basic steps to follow:

  1. Get value from shape field
  2. Get it's part
  3. Iterate through elements (points) in this part, where you can access all of the point's properties, i.e. X, Y, Z and M.

See if field calculator solution helps

Also note that behaviour of Python in calculator and script is slightly different

  • 1
    Perhaps a bit of example code would help round out your answer. You are correct, that's the way to do it, but it's not easy working with geometries in arcpy if the OP hasn't done it before. There are some basic examples help.arcgis.com/EN/arcgisdesktop/10.0/help/index.html#/… – Michael Stimson Aug 27 '15 at 23:11
  • 1
    Maybe. Unfortunately lately I found a disturbing trend here, just fishing for out of the box solution (to do a homework ?) – FelixIP Aug 28 '15 at 0:04
  • Some code would be better than none but if you feel like you're being used I can understand your reluctance... perhaps just the nuts-and-bolts and let the user work out how to get there. – Michael Stimson Aug 28 '15 at 0:07
  • Thanks for the help. And this is for a work project, not homework. I am attempting to convert hatch marks to points from line features using the min and max of each line feature so that way I can attach the route id to the hatch points I make. I do not have Roads and Highways extension for server and am trying to use linear referenced data in my web map and be able to search by route id and measure, so I will be using the points (with route id, from measure and to measure) I make to do so. – EvanL Aug 28 '15 at 15:04
  • @EvanL How did this turn out? I too am trying to make some Roads & Highways like functionality in-house. – Wilson Aug 25 '16 at 13:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.