I am working on an application to highlight parks within a user-defined border polygon. I want to make sure the highlighted region of the park feature ends at the selected polygon.
Therefore I expect the feature polygon's points outside of the border polygon to be replaced with an edge on the border polygon.
I illustrate an example here: The openstreetmap feature shown is: https://www.openstreetmap.org/way/255758838
In this example none of the original 4 nodes should be in the final result. I would like to have 5 new nodes: 4 from intersections between the drawn polygon and the feature polygon, and 1 from the drawn polygon's border where it is contained in the feature polygon.
Question: Is there a tool or some combination of tools that does this for me already?
Already tried:
- I have tried using
osmconvert -B
with the custom polygon specified. However the tool only removes nodes outside the border, and it does not insert new nodes to complete the way along the edge of the border.
Update:
This is just polygon intersection! (I am using turf.intersect
now).