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

Fix Tile X wrapping issue #32

Merged
merged 5 commits into from
Jul 26, 2017
Merged

Conversation

DenisCarriere
Copy link
Contributor

@DenisCarriere DenisCarriere commented Jul 25, 2017

Wraps Tile X

Wraps Tile X from pointToTile & pointToTileFraction based on the maximum Tile X allowed Math.pow(2, zoom).

Fixes issue in tile-cover mapbox/tile-cover#75

Also fixes #12

Ref: #27
CC: @tcql @mourner @lily-chai

Copy link
Member

@mourner mourner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good, but I would rather inline the wrapping in pointToTileFraction because then you 1) reuse Math.pow calculation, 2) don't need one more temporary array

@DenisCarriere
Copy link
Contributor Author

@mourner 👍 I didn't even realize that z2 = Math.pow(2, z) was already being calculated.

I'll update this

@DenisCarriere
Copy link
Contributor Author

DenisCarriere commented Jul 26, 2017

@mourner Updated the PR, was able to reduce everything down to only:

// Wrap Tile X
x = x % z2
if (x < 0) x = x + z2

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

Successfully merging this pull request may close these issues.

Wrong tile for crazy 0,0-spanning bbox
2 participants