simplegeo/polymaps — Issue #108: Latitudes at and above 90º cause NaNs, break map
Author: eagereyes
Created: 2012-01-15 08:21:37+00:00
State: open

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.