Google Maps - custom icons with infoWindows

Posted by hfidgen on Stack Overflow See other posts from Stack Overflow or by hfidgen
Published on 2010-04-14T11:00:28Z Indexed on 2010/04/14 11:03 UTC
Read the original article Hit count: 216

Filed under:

Hiya,

As far as I can tell, this code is fine, and should display some custom icons with popup HTML windows. But the popups aren't working! Can anyone point out what I'm doing wrong? I can't seem to debug it myself.

Thanks!

function initialize() {
    if (GBrowserIsCompatible()) {
        var map = new GMap2(document.getElementById("map"));
        map.setCenter(new GLatLng(51.410416, -0.293884), 15);
        map.addControl(new GSmallMapControl());
        map.addControl(new GMapTypeControl());
        var i_parking = new GIcon();
            i_parking.image = "http://google-maps-icons.googlecode.com/files/parking.png";
            i_parking.iconSize = new GSize(32, 37);
            i_parking.iconAnchor = new GPoint(16, 37);
            icon_parking = { icon:i_parking };
        var marker_office = new GMarker(new GLatLng(51.410416,-0.293884));
        var marker_parking1 = new GMarker((new GLatLng(51.410178,-0.292000)),icon_parking);
        var marker_parking2 = new GMarker((new GLatLng(51.410152,-0.298948)),icon_parking);         
        marker_parking1.openInfoWindowHtml('<strong>On Street Parking</strong><br>Church Road - 40p per hour');  
        marker_parking2.openInfoWindowHtml('<strong>Multi Storey - Fairfield</strong><br>Upper Car Park - 90p per half hour<br>Lower Car Park - £1.20 per hour');  
        map.addOverlay(marker_office);
        map.addOverlay(marker_parking1);
        map.addOverlay(marker_parking2);
    }
}

© Stack Overflow or respective owner

Related posts about google-maps