Map.addOverlay in Google API v3

Is the correct way to change the addition of Overlay to v3? In V3 addOverlay is deprecated ... and replaced with setMap?

    if (setContainerVisible == 1) {
        mapElements[lMapElementIndex]['visible'] = 1;
        //map.addOverlay(marker); v2
        marker.setMap(marker); // v3 ??
    }

for more information see the whole source http://pastebin.com/w1nm0W75 (line: 507)

+5
source share
1 answer

Not really, there are actually many ways to do this. The simplest one, and what you're probably looking for is

marker.setMap(map);

You can also initialize the map to which it should be connected when initializing the marker variable in the markerOptions method.

, V3: https://developers.google.com/maps/documentation/javascript/overlays#AddingOverlays

+11

All Articles