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.
Answer
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.
No comments:
Post a Comment