mapbox / mapbox/tippecanoe

What if zoom is 0 and 32?

Open
#677 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C++
Stars
3.1k
Forks
430
PR merge metrics
No merged PRs in 30d

Description

In epsg3857totile function https://github.com/mapbox/tippecanoe/blob/master/projection.cpp#L77-L83 :

	*x = ix * (1LL << 31) / 6378137.0 / M_PI + (1LL << 31);
	*y = ((1LL << 32) - 1) - (iy * (1LL << 31) / 6378137.0 / M_PI + (1LL << 31));

	if (zoom != 0) {
		*x >>= (32 - zoom);
		*y >>= (32 - zoom);
	}

When zoom = 0, *x would be ix * (1LL << 31) / 6378137.0 / M_PI + (1LL << 31);
When zoom=32, *x also be ix * (1LL << 31) / 6378137.0 / M_PI + (1LL << 31);

I don not understand why skip shift when zoom = 0? Maybe it is a bug. tiletoepsg3857 function also have some problem.

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

Read projection.cpp around epsg3857totile, then inspect the related tiletoepsg3857 function mentioned in the issue. Trace the zoom 0 and zoom 32 paths and verify whether their shifts are intended or incorrect. Done means the behavior is clarified and any needed correction is covered for both conversion directions.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
data
Issue type
Bug
Difficulty
4/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.