maps

Follow up to Resize google map to show all points - making space at the top

In Resize google map to show all points it shows how to rescale the map based on added overlays. But - it sometimes puts points a little too close to the top. The point is shown but since the icon has size - this disappears out of the visible frame.

Here's a method to add a little space before calling the setZoom. I call this anyway - it could be enhanced to see if there is a point in the danger zone but I haven't bothered.

Resize google map to show all points

I needed to get a google map to center and scale based on the added points.

I found a tutorial here: http://econym.googlepages.com/basic14.htm

This gave me exactly what I needed.

In short, given a GMap2 object called map and a map of locations (name -> object with lat and lng properties):


map.setCenter(new GLatLng(0,0),0);

var bounds = new GLatLngBounds();

Subscribe to RSS - maps