Search code examples
google-mapsgoogle-maps-api-2

Hiding the base map in Google Maps V2


Does anyone know how to hide the base map in Google Maps V2? I've added the following lines in my attempt to remove the standard map types, but it seems to insist on showing some sort of base map:

map.removeMapType(G_SATELLITE_MAP);
map.removeMapType(G_HYBRID_MAP);
map.removeMapType(G_AERIAL_MAP);
map.removeMapType(G_PHYSICAL_MAP);

I'm adding a KML-overlay using GGeoXml, and that's basically all I want to show. I've also tried to add a blank white KML-layer between the base map and the actual data, but with no luck. Anyone out there who knows how to hide or disable the base map?


Solution

  • In case anyone's having the same issue, I ended up solving it by simply making all the Google-generated map images transparent using jQuery:

    jQuery('#map img').css('opacity', '0').css('filter', 'alpha(opacity=0)').css('-moz-opacity', '0').css('-khtml-opacity', '0');
    

    The selector finds all img-tags below the map div id and sets opacity to 0 in most browsers. Left to display on the map is only the KML overlay, which was just what I wanted.