Posts

Showing posts with the label Default Google map

Google map API to bound beyond poles.

I have found that many Google map in Website used the default map.This default Google map goes beyond the poles while dragging up and down. I have found the code that doesn't exceed the pole while dragging. Just paste the following code inside you intialize() function of the Google map: google.maps.event.addListener(map, 'center_changed', function() {checkBounds(); }); var allowedBounds = new google.maps.LatLngBounds( new google.maps.LatLng(-66.85200239592201, -179.66565397011107), new google.maps.LatLng(66.903255924231566, 179.57922246681517)); function checkBounds() {           if(allowedBounds.contains(map.getCenter())) {             return;           }           var mapCenter = map.getCenter();           var X = mapCenter.lng();           var Y = mapCenter.lat();           var AmaxX = allowedBounds.getNorthEast().lng();           var AmaxY = allowedBounds.getNorthEast().lat();           var AminX = allowedBounds.getSouthWest().lng();           var AminY = allowedBo