【问题标题】:Use the H3 cell index to create a bounding box and perform a point in bbox operationUse the H3 cell index to create a bounding box and perform a point in bbox operation
【发布时间】:2022-12-02 03:06:05
【问题描述】:

With latitude and longitude, there is the possbility to create a bounding box based on xmax/ymax and xmin/ymin. Having coordinates, I can perform a range search to check, if these coordinates are withing the bounding box. Something like

 xmax >= longitude && xmin <= longitude && ymax >= latitude && ymin <= latitude

If all of this is true, I know, my point falls within the bounding box. I wonder if there is similar possibility, using the index of h3. If I define the xmax/ymax and xmin/ymin with the index of the corresponding cell:

topLeftCorner: 8b2d55c256acfff
bottomRightCorner: 8b2d024758b1fff

Could I then use the way the cell index is constructed to perform a similar range search, like with real coordinates? Something like (pseudo code):

point = 8b2d11c1599bfff
if(point[0:4] === topLeftCorner[0:4] && ....

【问题讨论】:

    标签: h3


    【解决方案1】:

    Answered separately here: https://github.com/uber/h3/issues/722

    The order of the indexes does not support this directly. You might be able to do this using local IJ coordinates - see cellToLocalIJ. Note that there are areas of the world (around pentagons) where this may not work well, but in local areas this should be possible.

    In general, though, I think the simpler option when you want to check for inclusion in a large region is to have a reverse index - e.g. a table, map, or set of the indexes in the region. Determining if a point is in the area is then just a set inclusion check. It might also be simpler or more efficient to actually check a lat/lng bounding box (based on the cell center lat/lng) and then have a second, more expensive check to determine whether the index is in the region.

    【讨论】:

      猜你喜欢
      • 2022-12-02
      • 2022-11-09
      • 2022-12-02
      • 2022-12-19
      • 2022-12-01
      • 2022-12-28
      • 2022-11-09
      • 2022-12-02
      • 2022-12-02
      相关资源
      最近更新 更多