mapbox / mapbox/tilebelt

Wrong tile is returned for edge cases

Open
#45 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
288
Forks
42
PR merge metrics
No merged PRs in 30d

Description

Testcase:

```javascript
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 }
```

Contributor guide

Open the contributing guide

Research direction

Start with the cover.tiles entry point and reproduce the provided JavaScript example at zoom 8, then compare its tile with the bounding box from tilebelt.tileToBBOX. Done means the returned tile contains the supplied coordinates for this edge case and the behavior is covered by a regression test.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, typescript
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.