0
在完成项目My Map时,我发现自2013年起不再支持API V2。我开始思考升级过程。将Google Maps API V2升级到V3
我有此
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);
}
如在V3文档描述。不过,我明白,v3不会使用我当前使用的GXmlHttp。我假设我应该走类似于Use Php MySQL w/ V3 ..但我有点难以理解如何利用这个方法与我在多边形中的点功能。
任何意见,将不胜感激。谢谢!
谢谢@fire。我只是意识到我需要升级..只是在我潜入之前寻找一些输入。 – mcmonty 2012-03-08 16:16:57
Re:点多边形。 GMap V3有一个新的效用函数containsLocation(point,polygon);请参阅[几何库参考](http://code.google.com/apis/maps/documentation/javascript/reference.html#poly) – 2012-03-08 16:28:10