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

Latitudes at and above 90º cause NaNs, break map #108

Open
eagereyes opened this issue Jan 15, 2012 · 1 comment
Open

Latitudes at and above 90º cause NaNs, break map #108

eagereyes opened this issue Jan 15, 2012 · 1 comment

Comments

@eagereyes
Copy link

So I'm using Polymaps for an interactive version of my ZIPScribble map, and for some reason Canada is causing lots of issues. The map doesn't display, the hash shows NaNs, and things can't be fixed by switching to another country until the page is reloaded (and the entire map rebuilt).

It turns out that some joker added Santa Claus's place at (90, 0) to Quebec, which causes the bounding box to extend past 90º (because of padding), and that point being part of some geoJSON I'm loading. I realize that the pole is a special place, but the code should not crash and destroy the map (especially when the value is above 90º, which I figured would just wrap around, just like longitude).

Two things in particular are happening: Calling extent() with a latitude at or above 90º causes NaNs in the calculations and a white rectangle as the display. Something inside the map is set to null, so subsequent calls to extent() can't fix things. If a point has a latitude of 90º, it is projected to some place very, very high above the northernmost map tiles. Since that point does actually exist, that should probably be fixed.

@mbostock
Copy link
Contributor

The spherical mercator projection is not defined outside of [-85.05112877980659º, +85.05112877980659º] latitude. A point at ±90º would be at Infinity. The simplest fix is to clamp the geometry to this range; perhaps the GeoJSON layer should do this automatically?

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

No branches or pull requests

2 participants