@YA_10963798 wrote:
Ok... I think the best is to find distance from P to point #2
NO!!!! You don't mean the distance to POINT #2 !!! You sure are talking of the distance to the LINE through point #2.
There is a huge different if you say point or line!
What would be perpendicular to the road when the road is just a number of line segments. The definition of the direction I meant was how you would define perpendicular in that case.
Look again to the sketch with the five points. Would you really say that the red lines are perpendicular to the blue street?
They are just perpendicular to one of the line segments joining. They could as well be perpendicular to the other one or we choose a direction in between. There are many ways we could define the direction of the road "normal".
If it doesn't matter because the points forming the road are very close to each other and the road does not show a large curvature, then we could stay with my approach.
My new approach which is attached here uses interpolation to determine more precise the point with the given meterage. So most of the times none of these "red" points will be exactly one of the given "blue" A-points but rather would the red point lie in between two blue points. And so i define the normal to be normal to the line segment the point lies on.
The attached file contains both ways to define the distance and also provides means to plot the difference line segment. But even if you zoom in it looks confusing because there are way too much "green" CPT points too close together:

Before you use/send this file again you sure should clean it up, deleting all unnecessary or duplicate calculations and plots. When I played around with it it got slower and slower up to the moment when Prime would not react at all and I had to forcefully close the program via task manager.
Attached file is in P10 format