Git Product home page Git Product logo

Comments (6)

nrabinowitz avatar nrabinowitz commented on May 9, 2024 1

@alexkokorin2 The basic algorithm looks like:

  • Loop through all polygons
    • If the polygon winds counter-clockwise, it's an outer loop, put it into an array of outer loops
    • If the polygon winds clockwise, it's an inner loop (hole). Put it in a temp array of inner loops
  • Loop through all inner loops
    • Take the first point.
    • Loop through all outer loops. If the point is inside the outer loop, allocate the hole to that polygon.
  • Return the array of outer loops.

This doesn't deal with nested donuts, but otherwise should work. I'm going to be releasing a JavaScript GeoJSON lib shortly, and will probably include a JS version of this algorithm in that lib until this issue is resolved in the core library.

from h3.

alexkokorin2 avatar alexkokorin2 commented on May 9, 2024

@isaacbrodsky any update on this?

from h3.

isaacbrodsky avatar isaacbrodsky commented on May 9, 2024

Hi @alexkokorin2, the Javascript bindings that contain this logic have been released at uber/h3-js, but nobody's yet gotten to make a PR to include that logic here.

@nrabinowitz Now that I take another look at the h3-js sources, I actually don't see any hole detection code associated with h3SetToLinkedGeo / readMultiPolygon. Am I missing something, or could you point us towards the hole-detection logic?

from h3.

nrabinowitz avatar nrabinowitz commented on May 9, 2024

@isaacbrodsky Unfortunately the hole-detection logic is still in a closed-source library, as it was required for both the current H3 and the internal legacy version. I'd rather try to get it into C than to bring the JS version into the JS bindings. I expect to be able to work on this in the next 3-4 weeks, probably no sooner.

Implementation would be a lot easier if I could figure out a way to reuse the existing point-in-poly code. One option here is to convert GeoPolygon to LinkedGeoPolygon before running the algo, but this would sacrifice performance and memory usage for the code benefit. 😞

from h3.

alexkokorin2 avatar alexkokorin2 commented on May 9, 2024

@nrabinowitz Could you give me a hint/source how to create (at least) temporary fix for this? It appears my consumer isn't OK with your current format. I'd like to convert it to GeoJSON.

from h3.

alexkokorin2 avatar alexkokorin2 commented on May 9, 2024

@nrabinowitz @isaacbrodsky ping about temporary fix.

from h3.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.