Thursday, January 7, 2010

More Overview Map stuff Figured out

So one of the big things i was struggling with was how to make it so the overview map would change it's zoom level to show everybody's individual view boxes....

There is a function you can use on a map, in which you give it a set of LatLngBounds and do this:

map.setCenter(bounds.getCenter(), map.getBoundsZoomLevel(bounds));


Where map is the map in question, and bounds are the latlng bounds variable. Then in order to add points or polygons to it you can run these functions...

bounds.union(latLngBounds) for other bounds (these can be extracted from polygons using the .getLatLngBounds() function) and bounds.extend(latLng) for individual points

No comments:

Post a Comment