2011-06-18 12 views
0

私はGoogleマップのapi hereのアイコンのアンカーを中心にしようとしていますが、爆発画像が表示されないようにしようとします。Googleマップapi V3にイメージアンカーを配置するにはどうすればよいですか?

このコードは正常に動作しますが、アンカーは、画像の下部中央にある:

var image_explode = 'images/map/explode.png'; 
    var explode_longlat = new google.maps.LatLng(-18.142599, 178.431); 
    var explode = new google.maps.Marker({ 
     position: explode_longlat, 
     map: map, 
     icon: image_explode 
    }); 

私はアンカーがこのコードを使用して中心に作ってみましたが、それは。消える:

var image_explode = new google.maps.MarkerImage("projectstratos.com/images/map/explode.png",new google.maps.Size(20,20),new google.maps.Point(0,0),new google.maps.Point(10,10)); 
    var explode_longlat = new google.maps.LatLng(-18.142599, 178.431); 
    var explode = new google.maps.Marker({ 
     position: explode_longlat, 
     map: map, 
     icon: image_explode 
    }); 

答えて

2

あなたが必要ホスト名を含める場合は、ホスト名を含める場合はURL内のhttp://と入力します。

var explode_image = new google.maps.MarkerImage("http://projectstratos.com/images/map/explode.png", new google.maps.Size(20,20), new google.maps.Point(0,0), new google.maps.Point(10,10)); 
    var explode_longlat = new google.maps.LatLng(-18.142599, 178.431); 
    var explode = new google.maps.Marker({ 
     position: explode_longlat, 
     map: map, 
     icon: explode_image 
    }); 

オルタナ慎重に、ホスト名(projectstratos.com)をオフのままにします。

+0

ありがとうございます!私が間違っていることをあなたがしたことを教えてください。 – Yesterday

+0

ああ...それでしたか? :O私はとても愚かだと感じる!ありがとうございました!!! – Yesterday

関連する問題