Google maps api 3 使用谷歌地图API v3进行地理编码?

Google maps api 3 使用谷歌地图API v3进行地理编码?,google-maps-api-3,Google Maps Api 3,目前,我使用latlang来指定位置: <script type="text/javascript"> function initialize() { var myLatlng = new google.maps.LatLng(52.097303, 0.275820); var myOptions = { zoom: 15, center: myLatlng, mapTypeId: google.maps.MapTypeId.ROADMAP } var map = new googl

目前,我使用latlang来指定位置:

<script type="text/javascript">
function initialize() {
var myLatlng = new google.maps.LatLng(52.097303, 0.275820);
var myOptions = {
zoom: 15,
center: myLatlng,
mapTypeId: google.maps.MapTypeId.ROADMAP
}
var map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);

var contentString = '<div id="bubbleContent">'+'<img src="images/logo.png" alt="logo"  width="200" height="35"/>'
'</div>';

var infowindow = new google.maps.InfoWindow({
content: contentString,
});
var marker = new google.maps.Marker({
  position: myLatlng, 
  map: map, 
}); 
infowindow.open(map,marker);
}
</script>

函数初始化(){
var mylatng=new google.maps.LatLng(52.097303,0.275820);
变量myOptions={
缩放:15,
中心:myLatlng,
mapTypeId:google.maps.mapTypeId.ROADMAP
}
var map=new google.maps.map(document.getElementById(“map_canvas”),myOptions);
var contentString='+''
'';
var infowindow=new google.maps.infowindow({
content:contentString,
});
var marker=new google.maps.marker({
职位:myLatlng,
地图:地图,
}); 
信息窗口。打开(地图、标记);
}
如何使用地理编码来代替地址?e、 g.联合王国剑桥

谢谢

var map; var geocoder; var address;

function initialize() { map = new GMap2(document.getElementById("map_canvas")); map.setCenter(new GLatLng(40.730885,-73.997383), 15); map.addControl(new GLargeMapControl); GEvent.addListener(map, "click", getAddress); geocoder = new GClientGeocoder(); }

function getAddress(overlay, latlng) { if (latlng != null) { address = latlng; geocoder.getLocations(latlng, showAddress); } }

function showAddress(response) { map.clearOverlays(); if (!response || response.Status.code != 200) { alert("Status Code:" + response.Status.code); } else { place = response.Placemark[0]; point = new GLatLng(place.Point.coordinates[1],place.Point.coordinates[0]); marker = new GMarker(point); map.addOverlay(marker); marker.openInfoWindowHtml( '>b<orig latlng:>/b<' + response.name + '>br/<' + '>b<latlng:>/b<' + place.Point.coordinates[1] + "," + place.Point.coordinates[0] + '>br<' + '>b<Status Code:>/b<' + response.Status.code + '>br<' + '>b<Status Request:>/b<' + response.Status.request + '>br<' + '>b<Address:>/b<' + place.address + '>br<' + '>b<Accuracy:>/b<' + place.AddressDetails.Accuracy + '>br>' + '>b>Country code:>/b< ' + place.AddressDetails.Country.CountryNameCode); } }

var映射; var地理编码器; var地址

函数初始化(){ map=newgmap2(document.getElementById(“map_canvas”); 赛特中心地图(新格拉特林(40.730885,-73.997383),15); map.addControl(新的GLargeMapControl); addListener(映射“单击”,获取地址); geocoder=新的GClientGeocoder(); }

函数getAddress(覆盖、latlng){ 如果(latlng!=null){ 地址=latlng; 地理编码器。获取位置(latlng、showAddress); } }

函数showAddress(响应){ map.clearOverlays(); 如果(!response | | response.Status.code!=200){ 警报(“状态代码:+响应.状态.代码”); }否则{ 地点=响应。地点标记[0]; 点=新玻璃(地点点坐标[1],地点点坐标[0]); 标记器=新的GMarker(点); 添加覆盖图(标记); marker.openInfoWindowHtml( “>b/bbr/b/bbrb/bbrb/bbrb/bbrb/bbrb>”+ '>b>国家代码:>/b<'+place.AddressDetails.Country.CountryNameCode); } }


问题是如何将地理编码与Api v3而不是Api v2一起使用。这一点已在本线程中得到回答: