Stay on the world when transforming coords.

Instead of a transform that results in +/- Infinity northing, we can constrain the results to be within the world bounds.
This commit is contained in:
Tim Schaub
2012-04-23 18:49:55 -04:00
parent 305c6ef064
commit ec7b12257b
2 changed files with 5 additions and 4 deletions

View File

@@ -287,7 +287,8 @@ OpenLayers.Projection.nullTransform = function(point) {
function forwardMercator(xy) {
xy.x = xy.x * pole / 180;
xy.y = Math.log(Math.tan((90 + xy.y) * Math.PI / 360)) / Math.PI * pole;
var y = Math.log(Math.tan((90 + xy.y) * Math.PI / 360)) / Math.PI * pole;
xy.y = Math.max(-20037508.34, Math.min(y, 20037508.34));
return xy;
}