Skip to content

geojson2h3.featureToH3Set calculating indexes different from those in the docs #25

@punkish

Description

@punkish
const polygon = {
    type: 'Feature',
    geometry: {
        type: 'Polygon',
        coordinates: [[
            [-180.00, -90.00],
            [-180.00,  90.00],
            [ 180.00,  90.00],
            [ 180.00, -90.00],
            [-180.00, -90.00]
        ]]
    }
};
  
const hexagons = geojson2h3.featureToH3Set(polygon, 0);
console.log(hexagons.length);
// output → 0, expected 122
// change coords to
coordinates: [[
            [-179.00, -89.00],
            [-179.00,  89.00],
            [ 179.00,  89.00],
            [ 179.00, -89.00],
            [-179.00, -89.00]
        ]]
// output → 1, expected 122
console.log(geojson2h3.featureToH3Set(polygon, 2).length);
// ouput → 31, expected 5882

what am I doing wrong?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions