summaryrefslogtreecommitdiff
path: root/api_gmaps.js
diff options
context:
space:
mode:
authorbfabiszewski <github@ushuaia.pl>2013-06-21 20:24:40 +0200
committerbfabiszewski <github@ushuaia.pl>2013-06-21 20:24:40 +0200
commitfcd96c74cadabafa7494844973c4e4f5aa822e9e (patch)
tree8aa9fa523979ad3d6b90317621d53e31026b3332 /api_gmaps.js
parent458f1449cb262b73884170b9a0ea6a2b5485cacd (diff)
downloadRunnerUpLive-fcd96c74cadabafa7494844973c4e4f5aa822e9e.zip
preserve bounds while switching map apis
Diffstat (limited to 'api_gmaps.js')
-rwxr-xr-xapi_gmaps.js17
1 files changed, 17 insertions, 0 deletions
diff --git a/api_gmaps.js b/api_gmaps.js
index d4132ce..ce71491 100755
--- a/api_gmaps.js
+++ b/api_gmaps.js
@@ -171,3 +171,20 @@ function addChartEvent(chart) {
}
});
}
+//((52.20105108685229, 20.789387865580238), (52.292069558807135, 21.172192736185707))
+function getBounds() {
+ var b = map.getBounds().toString();
+ var bounds = b.split(',',4);
+ var lat_sw = bounds[0].replace(/\(/g,'');
+ var lon_sw = bounds[1].replace(/[ )]/g,'');
+ var lat_ne = bounds[2].replace(/[ (]/g,'');
+ var lon_ne = bounds[3].replace(/[ )]/g,'');
+ return [lon_sw,lat_sw,lon_ne,lat_ne];
+}
+
+function zoomToBounds(b) {
+ var sw = new google.maps.LatLng(b[1],b[0]);
+ var ne = new google.maps.LatLng(b[3],b[2]);
+ var bounds = new google.maps.LatLngBounds(sw,ne);
+ map.fitBounds(bounds);
+}