Googleマップアプリケーションを使用していますが、通常表示される一般的な赤いアイコンの代わりにカスタムアイコンを配置したいと思います。しかし、私が何をしても、別のアイコンを設定することはできません。常に赤いアイコンとして表示されます。アイコンのURLにhttpsを含めることができないと読んだので、画像ホストにアップロードしましたが、アイコンを変更できません。マップ上にカスタムアイコンを表示するにはどうすればよいですか、それともbingを使用する必要がありますか?
function initialize() {
geocoder = new google.maps.Geocoder();
var latlng = new google.maps.LatLng(-34.397, 150.644);
var mapOptions = {
zoom: 10,
center: latlng,
mapTypeId: google.maps.MapTypeId.ROADMAP
}
map = new google.maps.Map(document.getElementById("map_canvas"), mapOptions);
}
function codeAddress() {
initialize();
var address = document.getElementById("address").value;
range = document.getElementById("distance").value;
geocoder.geocode( { 'address': address}, function(results, status) {
if (status == google.maps.GeocoderStatus.OK) {
map.setCenter(results[0].geometry.location);
var marker = new google.maps.Marker({
map: map,
icon: "http://labs.google.com/ridefinder/images/mm_20_red.png"
position: results[0].geometry.location
});
lat1 = results[0].geometry.location.lat();
lng1 = results[0].geometry.location.lng();
} else {
alert("Geocode was not successful for the following reason: " + status);
}
});
load();
}
それが言うところに注意してください:
icon: "http://labs.google.com/ridefinder/images/mm_20_red.png"
何を変更しても、常に赤い一般的なアイコンが表示されます。