多分、あなたが経験したところでは、gmap3をjQueryに使用してみるべきでしょう。 Google Maps API v3を使用していますが、APIを抽象化して使いやすくしています。彼らはあなたが勉強すべきexampleを持っています。それは住所をとり、可能な場所を返します。私は場所を警告する例を変更した以下
- うまくいけば、あなたの頭のスタートを与えることに:ご質問の
$("#test").gmap3();
$('#address').autocomplete({
//This bit uses the geocoder to fetch address values
source: function(request, response) {
$("#test").gmap3({
action:'getAddress',
address: request.term,
callback:function(results){
if (!results) return;
response($.map(results, function(item) {
alert("The location is", item.geometry.location.lat(), item.geometry.location.lon());
return {
label: item.formatted_address,
value: item.formatted_address,
latLng: item.geometry.location
}
}));
}
});
},
//This bit is executed upon selection of an address
select: function(event, ui) {
$("#test").gmap3(
{action:'clear', name:'marker'},
{action:'addMarker',
latLng:ui.item.latLng,
map:{center:true}
}
);
}
});
すべてが非常に似ています...。 – Widor
これはもう一つのタスクです:他の人は私がlatとlngを使っていないのです。 また、OSMを使っているので、他のタスクは大きく、無料のgoogle api – ronnie
のために大きくなっています。 「私の仕事をしてくれ」と尋ねると、遭遇しないように注意してください。それだけです。 – Widor