2

I have thousands of lines and I am trying to identify the closest parallel line on each side of the lines within a distance.

Using Python, my idea was to draw a buffer from each line on one side and check if there are any intersects, then if there are, find the closest one with a similar azimuth (maybe within 10 degrees), then do the same for the opposite side.

pos_df = gdf.copy()
neg_df = gdf.copy()

pos_df['geometry'] = pos_df.to_crs('EPSG:32040').buffer(50000, single_sided=True)
neg_df['geometry'] = neg_df.to_crs('EPSG:32040').buffer(-50000, single_sided=True)

in the image below, line D would fall within line B's distance, so there would be a column called right, and line D would be placed in here for line B, if that makes sense.

Would anyone know the a way to accomplish this task using Python? I've been stumped on how to do this.

enter image description here

0

Your Answer

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

Browse other questions tagged or ask your own question.