i'm trying to put a layer on top of my google maps to cover it up. There doesn't have to be any interaction with google maps, it's just one layer on top the other.
what i have now:
<div id="map">
<div id="overlay"></div>
</div>
in the map div i put my google maps, and the overlay layer has a background as big as the map div, but the google maps keeps putting itself on top.
Anyone an idee what i can do about it?
You can organize your map features with map layers. For example, you can put color-coded restaurants on one layer and coffee shops on another.
To start drawing your route simply doubleclick on the map to set the starting pinpoint, then continue to click each of the points along the route you wish to follow. You can change the map view to satellite, hybrid or terrain using the selector on the top left corner of the route map.
Layers are objects on the map that consist of one or more separate items, but are manipulated as a single unit. Layers generally reflect collections of objects that you add on top of the map to designate a common association.
Google Maps API V3 supports an option called noClear
:
If true, do not clear the contents of the Map div.
Use it like:
var myLatlng = new google.maps.LatLng(-34.397, 150.644);
var myOptions = {
zoom: 8,
center: myLatlng,
mapTypeId: google.maps.MapTypeId.ROADMAP,
noClear: true,
};
var map = new google.maps.Map(document.getElementById("map_canvas"),
myOptions);
However, semantically it feels better to put the div#overlay as the next sibling of the map div as @Marcelo suggests.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With