I have a layer containing lanterns (point layer, yellow blocks) and a layer containing hectometer signs (point layer, blue dots). In order to find the closest perpendicular distance from a lantern to a hectometer sign, I created a line between the hectometer signs (line layer, red).


I know the length of the lines between the hectometer signs and I know the distance from each lantern to the nearest hectometer sign. However, I need to know the distance from each lantern perpendicular to the nearest red line.

Right now I'm stuck because in my ArcGIS I am not licensed to use the Nearest tools. I think I have to use a Python script but I can not figure out how to start. Does anyone know how to tackle this?

  • 2
    I would try splitting the line into very short segments - extract vertices to points - Spatial Join (join option nearest) then xy to line. They wont be perpendicual though, but maybe good enough – BERA Apr 8 '20 at 17:41
  • How were planning to deal with lanterns at the side of the road as in your screen shot, you only show and draw 1 example of a lantern in the middle of the road? – Hornbydd Apr 8 '20 at 21:00
  • I could not figure out how to extend the lines between the hectometer signs in order to get the perpendicular distance of the lanterns on the side of the road. Therefor, for the lanterns on the side of the road I do a spatial join with the hectometer signs layer to get the closest hectometer sign within a certain radius. – NVaissier Apr 9 '20 at 6:35

Say the length of the line is c, and the distance to each hectometer is a and b. (excuse the crude picture)enter image description here
You can find the angle theta by using: Θ = arcCos((a^2+c^2-b^2)/(2ac)) (law of cosines). Then your perpendicular distance h is then h = a Sin(Θ). This should work for the ones that extend beyond the line segment as well.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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