Coder Social home page Coder Social logo

Comments (3)

mailinger-mate avatar mailinger-mate commented on June 11, 2024

I would think the solution probably relies on the indexing order, however I need help with understanding how that is represented in the indexes between resolutions, if the lowest resolution set is continuous between startAt and endAt of higher resolutions...
https://observablehq.com/@nrabinowitz/h3-indexing-order

from h3-js.

mailinger-mate avatar mailinger-mate commented on June 11, 2024

I have read a few more responses from @nrabinowitz Stack Overflow as well and now I think I understand that the child indexes of any hexagon are not continuous alphanumerically, and cannot be used to range queries in NoSQL databases:
https://stackoverflow.com/questions/53911322/is-the-h3index-ordered#comment95750613_53915447

Using the referenced h3 indexing order visualization I am able to extract that for the San Fransisco 8428309ffffffff hexagon the children h3 indexes at lower resolution cannot be described in continuous ranges:

["*807*","*80f*","*817*","*81f*","*827*","*82f*","*837*","*847*",...]

To give more context, for now using the Geofire library I am mapping the h3 hexagons to their nearest geohash [start, end] range pairs (rectangles), and then calculate and exclude for each range the geohashes that are outside the radius of the hexagon (red rectangles), specifically:

{
  "h3Index": "8665812cfffffff",
  "geohashRanges": ["w60gh","w60gk"],["w60g4","w60g6"],["w60fu","w60fw"],["w60ff","w60fh"],
  "geohashesExcluded: [["w60g5zz8ku","w60g5zz8kv"],["w60g5zz8mh","w60g5zz8mj"],["w60g5zz8kv"],["w60g5zz8mj"],["w60g5zz8kg"],["w60g5zz8m5"]]
}

rollo-h3-geohash-map

Unfortunately this results in several parallel aggregate queries, and because the rectangles will never fit the hexagons, displaying aggregate numbers of the rectangles mapped to the hexagon will always be redundant and inaccurate. Of course I could just display the geohash rectangles on the map, but the benefits of h3 indexing are more appealing both visually and computationally.

This is why I am looking for any solution where I can use h3 indexes in the database objects and query them at various resolutions in a way that are less expensive and less inaccurate relative to the current solution.

from h3-js.

nrabinowitz avatar nrabinowitz commented on June 11, 2024

If i understand your use case correctly, I believe H3 can do what you're trying to do. While k-rings (also called grid disks, the set of cells within k steps of some origin) are not ordered sequentially, children at a given resolution are. You can request the range of children at some res with the lower bound as cellToCenterChild(res); the upper bound is a little tricker until we release childPosToCell but you can construct it. This is harder in JS, because we can't use 64-bit ints, but essentially you apply a bitmask of all 1s to the bottom N bits of the index, where N is 3 * (15 - parentRes) (I think, I haven't tested this). The bit layout diagrams here might help.

from h3-js.

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.