google maps insertAt
In V3 of the javascript api for the polygon array there is a func开发者_Python百科tion insertAt()
, does anyone have an example of how this is used?
You need to create your MVCArray object:
pathCoords = new google.maps.MVCArray();
Then set up your map:
myPoly = new google.maps.Polyline({
path: pathCoords,
strokeColor: '#000000',
strokeOpacity: 1,
strokeWeight: 2
});
myPoly.setMap(map);
You can then insert latLng
objects:
myPoly.getPath().insertAt(pathCoordinates.length, latLng);
http://code.google.com/apis/maps/documentation/javascript/maptypes.html#MapTypeInterface
http://code.google.com/apis/maps/documentation/javascript/examples/maptype-overlay.html
精彩评论