我有以下JavaScript代碼和我想申請反向地址解析爲地圖反向地理編碼在谷歌地圖API 3
這裏是我的js代碼
更新
<script type="text/javascript">
var map;
var geocoder;
var markers = new Array();
function initialize() {
geocoder = new google.maps.Geocoder();
var GPS = <%=GPS %>
var latlng = new google.maps.LatLng(31.2330555556,72.3330555556);
var myOptions = {
zoom: 7,
scaleControl:true,
pancontrol: true,
streetViewControl: true,
center: latlng,
mapTypeControl: true,
mapTypeControlOptions: {
style: google.maps.MapTypeControlStyle.DROPDOWN_MENU
},
mapTypeId: google.maps.MapTypeId.HYBRID
}
map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
var infowindow = new google.maps.InfoWindow();
for(i=0; i<GPS.length; i++)
{
//GeoCoding
if (geocoder) {
geocoder.geocode({'latLng': latlng}, function(results, status)
{
if (status == google.maps.GeocoderStatus.OK) {
if (results[1]) {
markers[i] = new google.maps.Marker(
{
position: GPS[i].GPS,
map: map,
draggable:true,
Info: results[1].formatted_address,
title:GPS[i].TITLE
}
}
}
});
google.maps.event.addListener(markers[i], 'click', function() {
infowindow.setContent(this.Info);
infowindow.open(map,this);
});
}
}
</script>
此爵士是我的更新代碼我在哪裏寫了代碼反向地理編碼,但現在MU地圖不工作請告訴我什麼是我正在失蹤
如果它在一個活動網站上,或者如果你把完整的代碼放入類似jsFiddle的東西,那麼調試起來更容易,所以我們可以測試它。 – 2012-02-13 19:18:14
同意Mano,你真的需要鏈接到實時代碼。 – andresf 2012-02-15 02:58:32