SO 21390236

google maps api v3 double image for icon

HTML

<script src="http://maps.google.com/maps/api/js?sensor=false"></script>
<div id="map-canvas"></div>

CSS

#map-canvas {
    height: 300px;
    width: 300px;
    background-color: gray;
}

JavaScript

function initialize() {
    google.maps.visualRefresh = true;
    var mapDiv = document.getElementById('map-canvas');
    var map = new google.maps.Map(mapDiv, {
        center: new google.maps.LatLng(0, 0),
        zoom: 10,
        mapTypeId: google.maps.MapTypeId.ROADMAP
    });

    var marker = new google.maps.Marker({
        position: new google.maps.LatLng(0, 0),
        map: map
    });

    // CREDIT: https://developers.google.com/maps/documentation/javascript/markers
    marker.flag = new google.maps.Marker({
        icon: {
            url: 'http://smartcitypmsensorica.com/Simulador/mapas/imagenes/biblioteca.png',
            anchor: new google.maps.Point(0, 0)
            },
          icon: { 
            url: 'http://smartcitypmsensorica.com/Simulador/mapas/imagenes/vertedero.png',
            anchor: new google.maps.Point(64, 64)
        }
    });

    marker.flag.bindTo('position', marker);
    marker.flag.bindTo('map', marker);

}

google.maps.event.addDomListener(window, 'load', initialize);