Zoom levels are discrete values, so you cannot make a buffer of
exactly x pixels.

What you can do is either,
 extend your bounds with a fictitious point 150px to the east (or
west):

//UNTESTED!
var zoom = map.getZoom();
var proj = map.getCurrentMapType().getProjection();
var NEPx = proj.fromLatLngToPixel(bounds.getNorthEast(), zoom);
var newNEPx = new GPoint(NEPx.x + 150, NEPx.y);
var newNE = proj.fromPixelToLatLng(tileNEPx,zoom);
bounds.extend(newNE);


 ... or simply set the zoom to one level lower:
map.setCenter(newcenter,newzoom-1);


--
Marcelo - http://maps.forum.nu
--







On Jul 14, 12:39 pm, Susanne <[email protected]> wrote:
> Hello everyone,
>
> I'm trying to figure out if there is a way to add a padding onto the
> map.
> I'm currently filling a bounds object with my markers and then use
> this snippet for zooming in on them:
>
>         newzoom = map.getBoundsZoomLevel(bounds);
>         newcenter = bounds.getCenter();
>         map.setCenter(newcenter,newzoom);
>
> Now I want some space around the markers (there will be a content
> layer above the map on one side, so the markers should not be behind
> the layer), you could say a padding of 150px all around the marker
> bounds.
>
> Unfortunately I've got no online example of what I'm trying to do, but
> I hope it's clear from the description only.
>
> Thankful for any help!
>
> Susanne
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Maps API" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/Google-Maps-API?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to