How to put this code in v3 instead v2 map

前端 未结 1 1386
無奈伤痛
無奈伤痛 2021-01-27 15:33

Here is the code:




        
相关标签:
1条回答
  • 2021-01-27 15:50

    I suggest you watch this IO talk and a corresponding live blog. There are a few salient points from the talk:

    • You no longer need the maps api key when you include the maps library. You do need the sensor parameter (http://maps.google.com/maps/api/js?sensor=true).
    • No more GBrowserCompatible. You will find a few utility type functions that were in v2 removed in v3. These were really outside the scope of a maps library and are available in various other places more suited to this type of feature (JQuery etc..)
    • A few required fields on the maps object. mapTypeId, zoom & center
    • The GMap2 in the global namespace is now google.maps.Map.
    • The map object now knows about the overlays that it holds. So overlays add & remove themselves from the map (this is the reverse of the v2 approach). This was done to avoid bloating in the map object (no need for add/remove functions for various overlays), this in turn reduces the initial download size for the library. This also means you will need to keep track of your overlays if you want to remove them from the map.
    • You can now add multiple info windows to a map (v2 limited you to a single global infowindow).

    You are using the GClientGeocoder, so you will need to check the replacement javascript geocoding API.

    0 讨论(0)
提交回复
热议问题