mapbox / mapbox/mapnik-omnivore

max zoom selection uses unconverted source units

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

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
44
Forks
17
PR merge metrics
No merged PRs in 30d

Description

The source's resolution is converted to `meters` here: https://github.com/mapbox/mapnik-omnivore/blob/29ead3673df622c773f334ec555d3d749a9c673f/lib/raster.js#L162

But then the resolution in native units is then used to calculate the max zoom: https://github.com/mapbox/mapnik-omnivore/blob/29ead3673df622c773f334ec555d3d749a9c673f/lib/raster.js#L173

This results in incorrect maxzoom selection for non-meter source data, as the thresholds for zoom levels are defined in mercator meters. This can be fixed by simply swapping out `_this.details.pixelSize[0]` for `pixelSize[0]` above.

cc @pratikyadav

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 in lib/raster.js at the resolution conversion around line 162 and the max-zoom calculation around line 173. Compare the converted pixel size with the value used for zoom selection, then verify that non-meter source data uses the mercator-meter thresholds and produces the correct max zoom.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
backend
Issue type
Bug
Difficulty
1/5
Estimated time
Under an hour
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.