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:
Just to reiterate my objective:
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
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP