From e4ad933bb299835cc44a76510f4d4adab73d5912 Mon Sep 17 00:00:00 2001 From: Jon Atkins Date: Mon, 13 May 2013 01:11:28 +0100 Subject: [PATCH] clamp bounds used for map data requests. no point in trying to request data outside +-90, +-180 coordinates, as it's pointless, and the server returns an error code anyway --- code/map_data.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/code/map_data.js b/code/map_data.js index 2c956a95..6c96d5ab 100644 --- a/code/map_data.js +++ b/code/map_data.js @@ -12,12 +12,12 @@ window.requestData = function() { requests.abort(); cleanUp(); - var bounds = map.getBounds(); + var bounds = clampLatLngBounds(map.getBounds()); - var x1 = lngToTile(bounds.getNorthWest().lng, map.getZoom()); - var x2 = lngToTile(bounds.getNorthEast().lng, map.getZoom()); - var y1 = latToTile(bounds.getNorthWest().lat, map.getZoom()); - var y2 = latToTile(bounds.getSouthWest().lat, map.getZoom()); + var x1 = lngToTile(bounds.getWest(), map.getZoom()); + var x2 = lngToTile(bounds.getEast(), map.getZoom()); + var y1 = latToTile(bounds.getNorth(), map.getZoom()); + var y2 = latToTile(bounds.getSouth(), map.getZoom()); // will group requests by second-last quad-key quadrant tiles = {};