Determining the relative orientation of two segments on the same plane – version 1

Task: determine the relative orientation of two segments on the same plane (not airplane). I.e. the façade of a building and a road:
from_claudia_schwarzkopf

Assumptions

  • The walls of verious buildings along the road have more or less the same length (i.e. 30 feet)
  • Road sinuosità can be neglected (no mountain trails of country roads in alluvial plains, taking you home with 90° bends)
  • You’re on a Friday, and you decided to miss an interesting gig in Florence, Italy, the evening before

How shall we go about this?

  • Segmentize the road in 30 ft. arcs
  • From the “buildings” polygon layer, extract the line segments corresponding to the walls.
  • Create a point layer with the points corresponding to the ends of each line segment, preserving the ID of the source segment
  • Add x,y columns to the point layer
  • For each “wall” calculate the “nearest neighbouring” road segment.
  • From here, in a couple of steps, you should get to a “wall” layer where the attributes contain the x,y coordinated both of the wall ends, and the ends of the road segments..
  • hence you may calculat the angle defined by the two segments.

Works for you (or Works not)? Let me know (info@pibinko.org)