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.
Asked
Active
Viewed 1,528 times
8
-
2Did 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
-
1Why 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 Answers
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.
