Comments (6)
@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.
@isaacbrodsky any update on this?
from h3.
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.
@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.
@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.
@nrabinowitz @isaacbrodsky ping about temporary fix.
from h3.
Related Issues (20)
- illegal instruction on ppc64 big endian server HOT 2
- h3.exact_edge_length execution error HOT 4
- PloygonAlgos - Throws error when used wrapper library in swift HOT 2
- About RFC: Polyfill modes release plan HOT 1
- replace `sprintf` with `snprintf` HOT 1
- Add additional modes for polygonToCells HOT 12
- Hex (cell) ID validation HOT 3
- Fuzzer timeout on fuzzerIj: gridPathCells
- Broken Link to website docs in contributing.md
- Broken link to website in contributing docs
- Uber CLA Contact HOT 1
- Has cell_to_vertex been implemented? HOT 2
- Replace empty function parameters with `void` HOT 1
- cell_to_child_pos() version 4 of the Python API client HOT 3
- polygonToCells: validity of polygons HOT 3
- Missing library stubs MYPY HOT 2
- polygonToCells not returning all H3Cells for the bounding box containing both USA and Russia HOT 1
- Confirmation of grid algorithm HOT 3
- cellToChildren error HOT 2
- Add function for returning the H3 indices of each endpoint of a directed edge HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from h3.