我的笔记

私人Tech网摘—5DBJ.COM

文章分类导航

文章搜索


订阅最新文章RSS

Google Maps API V3 更新迁移指南

The first step in using Google Maps API v3 consists in including the correct javascript file:
http://maps.google.com/maps/api/js?v=3&sensor=set_to_true_or_false&key=your_api_key

The second step in the migration process consists in renaming api calls and objects. The renaming follows the following pattern:
GMarker -> google.maps.Marker
GOverlay ->google.maps.Overlay
GEvent -> google.maps.Event


Having completed the renaming process does not guarantee the new code works, as some methods and concepts have changed between the two API versions:
A map’s type is not set anymore by using defined GMapType objects, but by setting a MapTypeId
An overlay is not added to the map by calling the map’s addOverlay method, but by calling the object’s setMap() method.
The GControl interface is not used anymore for adding custom controls to the map. In Google Maps API v3 custom controls are purely build with html, positioned on the map container and added the required event listeners.
For custom overlay types instead of inheriting from GOverlay, in v3 custom overlays are inherited from OverlayView

**************************************************************************************

发布于2010-09-04
所属分类:JS相关