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

Clamp Mercator clip extent. #88

Merged
merged 3 commits into from
Mar 2, 2017
Merged

Clamp Mercator clip extent. #88

merged 3 commits into from
Mar 2, 2017

Conversation

mbostock
Copy link
Member

@mbostock mbostock commented Mar 2, 2017

The Mercator projection is only defined on x in [tx - k × π, tx + k × π] where tx is the x-translate (projection.translate) and k is the scale (projection.scale). Thus setting a manual clip extent outside these bounds can break the projection; see #55 (comment).

If a clip extent is specified, this clip extent is now intersected with the defined extent of the Mercator projection on x. Note that it is not clamped on y, as the Mercator projection is defined to the poles at infinity.

This prevents the projection from breaking if the clip extent is specified
outside ±180° longitude. However, this implementation leaks the clamped clip
extent; it can be seen on retrieval. This should be fixed.
Also, we must recompute the intersection if the scale or translate changes.
@mbostock mbostock merged commit 20a2a97 into master Mar 2, 2017
@mbostock mbostock deleted the clamp-mercator-clip branch March 2, 2017 20:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

1 participant