Google マップ API v3 でマップを作成し、マップにリバース ジオコーディングを適用しようとしましたが、ジオコーディング マップを使用してマップを読み込めませんでした。マップを実行するとマップが表示されますが、マップにマーカーが表示されません。同様に
hersはマップコード
<script src="http://www.google.com/jsapi"></script>
<script type="text/javascript">
var script = '<script type="text/javascript" src="js/cluster';
if (document.location.search.indexOf('compiled') !== -1) {
script += '_compiled';
}
script += '.js"><' + '/script>';
document.write(script);
</script>
<script type="text/javascript">
google.load('maps', '3', {
other_params: 'sensor=false'
});
google.setOnLoadCallback(initialize);
var markerClusterer = null;
var map = null;
var geocoder;
var markers = new Array();
function initialize() {
var GPS = [
{GPS:new google.maps.LatLng(34.019626247176,71.57975666079601), CNT:'Pakistan',REGION:'Peshawar',DIST:'Furqan Enterprises',SHOP:'Jamal Sweets',OWNER:'Ibrar Khan',MOBILE:'0300 989 9008',REGNO:'0000001',ICON:'1.png'},
{GPS:new google.maps.LatLng(34.02025371621,71.579215441513), CNT:'Pakistan',REGION:'Peshawar',DIST:'Furqan Enterprises',SHOP:'Usman Medicoz',OWNER:'Usman Hussain',MOBILE:'0344 905 1231',REGNO:'0000002',ICON:'1.png'},
];
geocoder = new google.maps.Geocoder();
var map_center = new google.maps.LatLng(31.2330555556,72.3330555556);
var myOptions = {
zoom: 6,
scaleControl:true,
pancontrol: true,
streetViewControl: true,
center: map_center,
mapTypeControl: true,
mapTypeControlOptions: {
style: google.maps.MapTypeControlStyle.DROPDOWN_MENU
},
mapTypeId: google.maps.MapTypeId.ROADMAP
}
map = new google.maps.Map(document.getElementById("map"), myOptions);
var infowindow = new google.maps.InfoWindow();
if (markerClusterer) {
markerClusterer.clearMarkers();
}
for(i=0; i<GPS.length; i++)
{
geocoder.geocode({'latLng': GPS[i].GPS}, function(results, status) {
//map.setZoom(11);
var markerImage = new google.maps.MarkerImage(imageUrl,
new google.maps.Size(24, 32));
var imageUrl = 'ico/' + GPS[i].ICON;
markers[i] = new google.maps.Marker({
position: GPS[i].GPS,
draggable: true,
icon: markerImage,
Info: '<table frame=box><tr><td align="Left"><font face="Arial" size=2 color=#336699>Shop Name:</td><td align="Left"><font face="Arial" size=2>'+ GPS[i].SHOP + '</font></td></tr><tr>'+
'<td align="Left"><font face="Arial" size=2 color=#336699>Owner:</td><td align="Left"><font face="Arial" size=2>'+ GPS[i].OWNER + '</font></td></tr>'+
'<td align="Left"><font face="Arial" size=2 color=#336699>Mobile:</td><td align="Left"><font face="Arial" size=2>'+ GPS[i].MOBILE + '</font></td></tr>'+
'<tr><td align="Left"><font face="Arial" size=2 color=#336699>Distributer:</td><td align="Left"><font face="Arial" size=2>'+ GPS[i].DIST + '</font></td></tr><tr>'+
'<tr><td align="Left"><font face="Arial" size=2 color=#336699>Region:</td><td align="Left"><font face="Arial" size=2>'+ GPS[i].REGION + '</font></td></tr>'+
'<tr><td align="Left"></td><td align="Left"><font face="Arial" size=2 color=#336699><a target=_blank href=http://221.120.216.52/elp/sfpl.php?ccode=01&®no='+ GPS[i].REGNO +'>View</a></td></tr>'+
'<tr><td align="Left"><font face="Arial" size=2 color=#336699>Region:</td><td align="Left"><font face="Arial" size=2>'+ results[1].formatted_address + '</font></td></tr>'+
'</table>',
title:GPS[i].SHOP + '(' +GPS[i].DIST + ')'
});
markers.push(markers);
google.maps.event.addListener(markers[i], 'click', function() {
infowindow.setContent(this.Info);
infowindow.open(map,this);
});
});
}
zoom = -1 ? null : -1;
size = -1 ? null : -1;
markerClusterer = new MarkerClusterer(map, markers, {
maxZoom: zoom,
gridSize: size
});
}
</script>
いずれか 情報ウィンドウに座標の最寄りの住所を表示するのを手伝ってください。