TransWikia.com

Generating Points Along Line at irregular intervals using ArcGIS Desktop?

Geographic Information Systems Asked on May 17, 2021

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)ArcGISDesktop10.6ArcPyarcpylr.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
#

One Answer

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).

Answered by jbalk on May 17, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP