Can turf js generate extra points for a polygon/multi-polygon? #2812
Unanswered
tsairinius
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
TLDR Is there a way for Turf to add more points to a polygon so that there is less space between each point? Or a way to specify that there should not be more than x degrees of space between any two consecutive points?
Below is a simplification of a problem I'm dealing with currently. In the example, I'm computing grids that are intersecting with Canada. Then I'm taking the union of those intersecting grids. So the end result should pretty much be Canada. In black I've drawn the feature resulting from taking the union of the intersecting grids. The red outline shows the original Canada feature.
You'll notice that there's a discrepancy along the bottom border. The "grid union" is not properly following the original border. After looking at the union's coordinates, that section is represented only by two points that fall on the same latitude, basically creating a great arc. For background, this behavior is described in this stackoverflow question: https://stackoverflow.com/questions/62290744/why-doesnt-my-geo-linestring-follow-latitude-graticule-curves
It seems that the most straightforward solution is to have more points along that stretch of the bottom border. But the only way I can think of to achieve this is to manually insert extra points. I was curious if turfjs had a way of generating more points for a feature.
https://observablehq.com/d/18615e6a685bb359
Beta Was this translation helpful? Give feedback.
All reactions