views:

74

answers:

1

I'm using the latest version of the Google Maps API.

What I'd like to do is automatically minimize the small overview map located on the bottom right of an embedded Google Map. Or in the worst case, not displaying it at all.

I didn't manage to find any documentation about this.

Any help would be much appreciated.

+1  A: 

In the past you could call 'hide' on the GOverviewMapControl during your init, but seems that does not work without a little hacking now.

If you do not want to display 'overview map' (GOverviewMapControl) just do not add it to the map when you create the GMap2.

The 'hack' would be to add some control to the page that gets loaded late, like an image, and have it call a function that would call 'hide' on the GOverviewMapControl when it completed loading.

function initialize() 
{
    if (GBrowserIsCompatible()) {
        var map = new GMap2(document.getElementById("map_canvas"));
        map.setCenter(new GLatLng(37.4419, -122.1419), 13);
        map.setUIToDefault();

        // Simply leave these steps off to leave the overview map off
        var mini=new GOverviewMapControl();
        map.addControl(mini); 
        // this worked in the past, but now you need to call it 
        // later in the pipeline
        mini.hide( true );
    }
}
Sean
Yeah, mini.hide(true) is just not displaying the map but there's still an empty space for it displaying on the bottom right.I'll give your solution a try, even though it seems "dirty".
Guillaume Flandre
Yeah, I am not sure why Google decided to remove that functionality. Worked nicely in the past, simply calling hide. Maybe they will come out with a cleaner way to do it in v3.
Sean