1

What tool do I use to generate points along a line from an input list of lengths?

For example:

Length_km
0.12
0.2
0.38

etc.

ArcPy solutions are okay.

I tried:

testOut = outpath + '\\' + 'testOut'
arcpy.LocateFeaturesAlongRoutes_lr('pts.shp', 'polyline.shp', route_id_field = 'OBJECT_ID', radius_or_tolerance = "", out_table = testOut, out_event_properties = "", route_locations = "ALL", distance_field = "DISTANCE", zero_length_events = "ZERO", in_fields = "FIELDS", m_direction_offsetting = "M_DIRECTON")

& received the following error:

ERROR 000709: The type of out_event_properties does not match the type of in_features.
Failed to execute (LocateFeaturesAlongRoutes).

EDIT

Based on @jbalk 's suggestions, I tried the following code (note that my .py script and .shp, .dbf files are in the same directory, so just calling .shp without a path works here):

makeRoute = outpath + '\\' + 'make2route.shp'
arcpy.CreateRoutes_lr('polyline.shp', "routeID", makeRoute, "LENGTH")
testOut = outpath + '\\' + 'testOut.shp'
arcpy.MakeRouteEventLayer_lr(makeRoute, "routeID", 'pts.dbf', "routeID", testOut)

And it gives the following error:

File "C:\Program Files (x86)\ArcGIS\Desktop10.6\ArcPy\arcpy\lr.py", line 528, in MakeRouteEventLayer
    raise e
arcgisscripting.ExecuteError: Failed to execute. Parameters are not valid.
ERROR 000735: Event Table Properties: Value is required
Failed to execute (MakeRouteEventLayer).

Below are screenshots of the attribute tables for:

  • input 'polyline.shp'
  • output 'make2route.shp'
  • input 'pts.shp'

Just to reiterate my objective:

  • I have "polyline.shp"
  • I have "pts.shp" that are not located on the line. However, there is an attribute field that gives the distance along the line ("Dist_km"). I don't care to recalculate/collapse to the line; I must use the "Dist_km" field for this analysis.
  • I need coordinates for these distances ("Dist_km") along this line ("polyline.shp")

enter image description here

enter image description here

enter image description here #

  • Worth noting that I encountered errors with route event layers when the field type of the route ID did not match between the route layer and route event table- ie. ensure that both are string, double, etc. – RobinHorner Nov 5 '18 at 0:30
  • 1
    thanks @RobinHorner--good point, the field is double in both files – AlexS1 Nov 5 '18 at 2:19
1

The tool you are looking for is called Make Route Event Layer.

Docs: http://desktop.arcgis.com/en/arcmap/10.3/tools/linear-ref-toolbox/make-route-event-layer.htm

Arcpy usage:

MakeRouteEventLayer_lr (in_routes, route_id_field, in_table, in_event_properties, out_layer, {offset_field}, {add_error_field}, {add_angle_field}, {angle_type}, {complement_angle}, {offset_direction}, {point_event_type})

Everything in curly brackets {} is optional. Just leave all that out if you're not using those options.

If the points are all for the same route, you need the same route id for every point. The route id can be text, so it can be a name (i.e. franklin street). Linear referencing can be done on multiple routes at once, so the points need a reference to the correct route.

There are a few things you need to do before running the points through 'make route event'. Your distance is in km. You'll need to use a projected coordinate system and set the units to meters. You also need to calculate your km into m in your attribute table and use the m for the linear referencing.

Once you have done that, you should get a result back from 'make route event layer'. However, please note that this is an 'event', not a feature class. You need to export it to a feature class if you want to save it. You can then add your coordinate fields and use calculate geometry to get the coordinates.

Your code has an incorrect parameter in the 'make route event layer'. You need to look at the 'in_event_properties' parameter. It is not 'routeID' it should be "routeID POINT Dist_m" (after you convert km to m).

  • still no luck; I used the following code: ## arcpy.MakeRouteEventLayer_lr('polyline.shp', route_id_field = "OBJECTID", in_table = "pts.dbf", in_event_properties = "POINT", out_layer = testOut, offset_field = "", add_error_field = "NO_ERROR_FIELD", add_angle_field = "NO_ANGLE_FIELD", angle_type = "", complement_angle = "", offset_direction = "", point_event_type = "POINT") ## .......... and received the following error: ## ERROR 000735: Event Table Properties: Value is required Failed to execute (MakeRouteEventLayer) ## ...definitely something I am not understanding about route events... – AlexS1 Nov 2 '18 at 20:35
  • Everything in curly brackets {} is optional. Just leave all that out if you're not using those options. – jbalk Nov 2 '18 at 21:10
  • A few things - use the full path to polyline.shp; route id field needs to match your route (the route has a route id - you should have created your route using create routes in the LR tools); – jbalk Nov 2 '18 at 21:13
  • try this arcpy.MakeRouteEventLayer_lr(r'full path to polyline.shp', "RouteIdField", r"full path to points.dbf") – jbalk Nov 2 '18 at 21:16
  • also take the time to read the documentation for linear referencing tools: desktop.arcgis.com/en/arcmap/10.3/tools/linear-ref-toolbox/… – jbalk Nov 2 '18 at 21:17

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.