8

I have polygons and lines I would like to make perpendicular lines through each polygon edge so I can find intersections with other polygons and lines.

enter image description here

PolyGeo
  • 65,136
  • 29
  • 109
  • 338
Ramin Mir.
  • 191
  • 4
  • 2
    Did you already tried something? if so please share your attempt so ppl. can help you better. In general, you are supposed to show your effort, when it comes for coding help – LaughU Aug 06 '17 at 11:44
  • 1
    Why not to use http://postgis.net/docs/ST_DWithin.htm? Tell more about what kind of features you would like to find? – user30184 Aug 06 '17 at 15:44

1 Answers1

8

Assuming that you have PostGIS knowledge, this is one way forward:

  • Take the ExteriorRing from your polygon (results in a linestring)
  • Make seperate segments out of your ExteriorRing (use this example from Paul Ramsey)
  • Create parallel lines with ST_OffsetCurve with a desired distance D on the correct side (your polygons vertices should always have the same direction, use ST_ForceRHR when they don't)
  • For every segment, make a new line from the centroid of that segment to the centroid of the corresponding parallel line with ST_MakeLine

Now you should have your perpendicular lines with a length D starting from the sides of your polygon.

PolyGeo
  • 65,136
  • 29
  • 109
  • 338
tilt
  • 3,269
  • 13
  • 24