/ coding

"The Google Maps API will size the icon automatically."

They just didn’t say which size.

I’ll assume I’m doing something wrong here. Time to start digging through the code below.


function initialize_gmaps() {
    // styles omitted.

    // icon
    var pin = "icons/maps.png";

    // initialize new google maps LatLng object
    var myLatlng = new google.maps.LatLng(40.704989,-74.009609);
    // set the map options hash
    var mapOptions = {
        center: myLatlng,
        zoom: 16,
        mapTypeId: google.maps.MapTypeId.ROADMAP,
        // styles: styles
    };
    // get the maps div's HTML obj
    var map_canvas_obj = document.getElementById("map");

    // initialize a new Google Map with the options
    var map = new google.maps.Map(map_canvas_obj, mapOptions);

    // Add the marker to the map
    var marker = new google.maps.Marker({
        position: myLatlng,
        title:"Hello World!",
        icon: pin
    });
    // Add the marker to the map by calling setMap()
    marker.setMap(map);
}

$(document).ready(function() {
    initialize_gmaps();
});
"The Google Maps API will size the icon automatically."
Share this