0

I would like to add features to a map view where there are no other features within a certain radius.

I am guessing I have to use some sort of R-tree or Quad-tree search of the view extent to find points that would fit that requirement. Or perhaps some packing algorithm? Is there some simpler way using the API?

1 Answer 1

0

As an urban planner I have no clue what a R-Tree or a Quad-Tree search is. But I would try to solve this problem by using turf.js (though, I don't know if turf.js is that powerful, yet).

First you buffer your existing features with your radius, then you union those buffers. That is simple, there are examples somewhere doing exactly that.

The other part is to make an erase with the bounding box so you get all those areas that are not occupied by buffers. I think turf.js can't do that by default, but there is a module on npmjs: https://www.npmjs.com/package/turf-erase - If it doesn't work with the complex geometries maybe you can do it one at a time or so...

And then you just have to measure those new polygons if they match your criteria.

But I haven't done anything like this yet, just guessing.

1
  • This has (mostly) answered my question, or at least provided enough promising leads to solve the rest of it myself.
    – Ben Upham
    Commented May 20, 2018 at 17:10

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.