将自定义标记添加到Gmap

时间:2012-12-24 00:58:21

标签: jquery google-maps

我正在尝试为此gmap添加cutom标记;

$(function() {
    var addresspicker = $( "#addresspicker" ).addresspicker();
    var addresspickerMap = $( "#addresspicker_map" ).addresspicker(
    {
        regionBias: "au",
        map:      "#map_canvas",
        typeaheaddelay: 1000,
        mapOptions: {
            zoom:16,
            center: new google.maps.LatLng(-33.8674869, 151.2069902)
        }

    });

    addresspickerMap.on("addressChanged", function(evt, address) {
       console.dir(address);
    });
    addresspickerMap.on("positionChanged", function(evt, markerPosition) {
        markerPosition.getAddress( function(address) {
            if (address) {
                $( "#addresspicker_map").val(address.formatted_address);
            }
        })
    });
});

标记如下:

http://oursite.com.au/includes/helper/images/422marker.png

宽度:33px乘50px

我认为这很简单:

marker: 'http://oursite.com.au/includes/helper/images/422marker.png',

但那不起作用......请提出任何想法

1 个答案:

答案 0 :(得分:1)

标记将由addresspickerMap.addresspicker( "marker")返回,您可以使用标记的setIcon方法应用自定义图标:

addresspickerMap.addresspicker( "marker")
  .setIcon('http://oursite.com.au/includes/helper/images/422marker.png');