drnxnbf199049
2012-03-08 15:46
采纳率: 100%
浏览 47
已采纳

将Google Maps API V2升级到V3

While finishing a project at My Map, I discovered that the API, V2, would no longer be supported as of 2013. I'm beginning to think through the upgrade process.

I have this

 function initialize() {
  var myLatLng = new google.maps.LatLng(24.886436490787712, -70.2685546875);
  var myOptions = {
    zoom: 5,
    center: myLatLng,
    mapTypeId: google.maps.MapTypeId.TERRAIN
  };

  var bermudaTriangle;

  var map = new google.maps.Map(document.getElementById("map_canvas"),
      myOptions);

  var triangleCoords = [
    new google.maps.LatLng(25.774252, -80.190262),
    new google.maps.LatLng(18.466465, -66.118292),
    new google.maps.LatLng(32.321384, -64.75737),
    new google.maps.LatLng(25.774252, -80.190262)
  ];

  // Construct the polygon
  // Note that we don't specify an array or arrays, but instead just
  // a simple array of LatLngs in the paths property
  bermudaTriangle = new google.maps.Polygon({
    paths: triangleCoords,
    strokeColor: "#FF0000",
    strokeOpacity: 0.8,
    strokeWeight: 2,
    fillColor: "#FF0000",
    fillOpacity: 0.35
  });

  bermudaTriangle.setMap(map);
}

as described at on the V3 documentation. I understand, however, that v3 doesn't utilize GXmlHttp which I use in my current implementation. I'm assuming I should go a route similar to Use Php MySQL w/ V3..but I'm a bit stumped as to how to utilize this method with the Point in Polygon function I have.

Any advice would be appreciated. Thank you!

图片转代码服务由CSDN问答提供 功能建议

我的地图,我发现从2013年起将不再支持API V2。我开始考虑升级过程。 </ p>

我有这个</ p>

  function initialize(){
 var myLatLng = new google.maps.LatLng(24.886436490787712,-70.2685546875)  ; 
 var myOptions = {
 zoom:5,
 center:myLatLng,
 mapTypeId:google.maps.MapTypeId.TERRAIN 
}; 
 
 var bermudaTriangle; 
 
 var map = new google  .maps.Map(document.getElementById(“map_canvas”),
 myOptions); 
 
 var triangleCoords = [
 new google.maps.LatLng(25.774252,-80.190262),
 new google.maps.LatLng  (18.466465,-66.118292),
 new google.maps.LatLng(32.321384,-64.75737),
 new google.maps.LatLng(25.774252,-80.190262)
]; 
 
 //构造多边形\  n //请注意,我们没有指定数组或数组,而只是
 // //路径属性中的LatLngs的简单数组
 bermudaTriangle = new google.maps.Polygon({
 paths:triangleCoords,\  n strokeColor:“#FF0000”,
 strokeOpacity:0.8,
 strokeWeight:2,
 fillColor:“#FF0000”,
 fillOpacity:0.35 
}); 
 
 bermudaTriangle.setM 如V3文档中所述,ap(map); 
} 
 </ code> </ pre> 
 
 

。 但是,据我所知,v3不使用我在当前实现中使用的GXmlHttp。 我假设我应该采用类似于使用Php MySQL w / V3的路线</ a> ..但我对如何利用我在的多边形点函数中使用此方法感到有点困惑。 </ p>

任何建议都将不胜感激。 谢谢!</ p> </ div>

1条回答 默认 最新

相关推荐 更多相似问题