也许给你体验,你应该尝试使用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
这是另一个任务:o其他人我没有使用纬度和经度.. 也使用OSM还有因为其他任务是自由的谷歌API – ronnie
我看到更大的和大的。只是要小心,不要让他们问我“为我做我的工作”,就这些。 – Widor