0

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:illustrates the overlapping polygons I described 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).

3
  • It has come to my attention that this is probably just polygon intersection for which there is turf/intersect package in javascript I can use. Sometimes need to say the problem out loud to come up with the answer! Commented Jul 22, 2023 at 3:04
  • Please add the comment to your question.
    – Padmanabha
    Commented Jul 22, 2023 at 4:46
  • done, thanks for taking a look Commented Jul 22, 2023 at 19:47

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.