I have been trying to connect start points and end points of guard rails along the sides of roads. Of course, this is more complicated than converting points to lines because I need to prevent the lines from crossing roads but keep them as close to the roads as possible when the roads are not perfectly straight.
I was wondering if it is possible to do this with a Least Cost Path model. Is LCP capable of connecting multiple start points with multiple end points based on an ID field?
This would allow me to assign very high costs to roads, lower costs to the area within 1 metre of roads, and higher costs as you go further away from the road. I have about 3400 start and end points for the guard rails.
Also, if anyone has any better ideas of how to do this workflow, I would be grateful for any advice.
do you have an image of the guard rail post placement?
I wouldn't attempt this in raster world since I think the problem would best be solved in vector world.
My first thought would be to use a minimum spanning tree which in essence takes a point dataset or selection from therein and connects the points based on minimizing the overall distance. I will defer a reference until after I see what the data set looks like to see if this is an appropriate suggestion or one that would have to be implemented selectively and/or incrementally
Definitely wouldn't use a raster approach for this problem. The solution depends largely on the definition of the road geometry (so please as Dan suggests, include a screenshot of your data).
Let's give an example, to see if I understand you correctly and what a possibility may be (depending on the road geometry). You have this:
...but don't want this:
you are looking for this:
If you would have polygons that describe the road surface like this (blue polygon):
you could use some python code and :
startpoint2 = polyline.snapToLine(startpoint)
endpoint2 = polyline.snapToLine(endpoint)
Something like this.
But if you only have a center line of the road, things will be a little bit more complex.
Thanks for the posts Dan and Xander:
I am going to work through the information you have provided me so far (I just got in to work). Xander was exactly right in his description of the problem.
The dotted red line in his second image is similar to the red line in the above image. The green line in Xander's third image is similar to the green lines in my image. The only missing line type would be the blue lines in the centre of my image where a highway overpass crosses a road and has guard rails along the side (green and red lines are the same).
Note: the light green polygon would be similar to the blue polygon in Xander's final image.
Thanks for the responses. I will go through Xander's work flow and get back to you.