mapbox / mapbox/tile-cover

indexes method generates empty strings for features above/below max Y coordinate

Open
#83 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
196
Forks
41
PR merge metrics
No merged PRs in 30d

Description

### Context:
Not sure if this is expected behavior, but when the tile-cover `indexes` method is used on a geojson feature that has some coordinates above or below the max y coordinate limit for mercator maps, it generates a bunch of empty strings in addition to the quadkeys. It's not a big deal to handle this where we're using it, but just wanted to flag it in case this isn't expected behavior.

### Steps to reproduce:

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

const featureMaxY = {
'type': 'Feature',
'properties': {},
'geometry': {
'type': 'Polygon',
'coordinates': [
[
[-110.5, 85.05],
[-110.25, 85.05],
[-110.25, 85.0511287798065],
[-110.5, 85.0511287798065],
[-110.5, 85.05]
]
]
}
};

const featureOverMaxY = {
'type': 'Feature',
'properties': {},
'geometry': {
'type': 'Polygon',
'coordinates': [
[
[-110.5, 85.05],
[-110.25, 85.05],
[-110.25, 85.0511287798066], // Or anything above this
[-110.5, 85.0511287798066], // Or anything above this
[-110.5, 85.05]
]
]
}
};

const quadkeysAtMax = tileCover.indexes(featureMaxY.geometry, { min_zoom: 12, max_zoom: 12 });
console.log('Total quadkeys: ', quadkeysAtMax.length); // 4
console.log('Quadkeys: ', quadkeysAtMax);
// Quadkeys: [ '001100010110', '001100010111', '001100011000', '001100011001' ]

const quadkeysOverMax = tileCover.indexes(featureOverMaxY.geometry, { min_zoom: 12, max_zoom: 12 });
console.log('Total quadkeys: ', quadkeysOverMax.length); // 8
console.log('Quadkeys: ', quadkeysOverMax);
// Quadkeys: [ '001100010110', '001100010111', '001100011000', '001100011001', '', '', '', '' ]
```

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by running the provided tile-cover.indexes reproduction at the Mercator maximum Y boundary and compare the two feature geometries. The fix is done when coordinates above the limit no longer produce empty strings, while the valid quadkeys remain unchanged.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.