1

I am using shapely to snap points to a line. This is the piece of code I use

import geopandas as gpd
gdf_segments = gpd.read_file("line.shp")
shply_line = gdf_segments.geometry.unary_union
point  = gpd.read_file('points.shp')
result = point.copy()
result['geometry'] = result.apply(lambda row: shply_line.interpolate(shply_line.project( row.geometry)), axis=1)

How do I get the RID and MEAS values? These values are obtained on running the Locate Features along route linear referencing tool in ArcGIS Desktop.

I would like to achieve the above without arcpy or ArcGIS or FME. I want to code it entirely with python using gdal/ogr/shapely/fiona anything.

Code above referenced from: Snap points shapefile to line shapefile using shapely

0

1 Answer 1

0

If you are looking for an open source solution you could consider this QGIS plugin LRS? If you look at the help page is appears to offer a UI and scripting solution.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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