Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong tile is returned for edge cases #45

Open
zdila opened this issue Mar 7, 2023 · 0 comments
Open

Wrong tile is returned for edge cases #45

zdila opened this issue Mar 7, 2023 · 0 comments

Comments

@zdila
Copy link

zdila commented Mar 7, 2023

Testcase:

const cover = require('@mapbox/tile-cover');

const tilebelt = require('@mapbox/tilebelt');

const coordinates = [-11.250000000000002, 6.816667036613423];

console.log({ coordinates });

const tiles = cover.tiles({ type: 'Point', coordinates }, { min_zoom: 8, max_zoom: 8 });

console.log({ tiles });

const bbox = tilebelt.tileToBBOX(tiles[0]);

console.log({ bbox });

console.log({
    inTile:
        coordinates[0] >= bbox[0] &&
        coordinates[0] <= bbox[2] &&
        coordinates[1] >= bbox[1] &&
        coordinates[1] <= bbox[3] &&
        coordinates[0] !== null &&
        coordinates[1] !== null,
});

Output:

{ coordinates: [ -11.250000000000002, 6.816667036613423 ] }
{ tiles: [ [ 120, 123, 8 ] ] }
{ bbox: [ -11.25, 5.615985819155343, -9.84375, 7.013667927566632 ] }
{ inTile: false }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant