从谷歌地图API的v2升级到v3,建议 [英] Upgrading to v3 from v2 of google maps API, suggestions

查看:151
本文介绍了从谷歌地图API的v2升级到v3,建议的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的web应用程序中,我已完全成熟地整合了谷歌地图版本2,其中包含获取路线,群集标记,选项卡式信息窗口,上下文菜单(右键单击)等功能。这个实现的设计很糟糕,这导致了一些问题,所以现在我需要修改核心实现来更好地设计。我正在考虑升级到谷歌地图API的第3版。请建议,如果这是一件好事,我的所有功能都可以在更短的时间内正常运行(或者我会替换所有提到的功能)。或者我应该坚持谷歌地图API的版本2?

解决方案

我建议您升级到v3。几个月前,我升级了我的网站(和关于体验的博客)。请注意以下几点:


  • 没有更多API密钥。

  • 标记和信息窗口API已更改,但效果更好。 没有更多的AJAX帮助程序。如果您使用的是GXMLHttp,则需要交换到新的AJAX包装器(Jquery,mootools等)。
  • 检查您的纬度/经度是否正确。 GPoint需要x和y(经度和纬度)。 v3有一个latlng对象,所以你的参数可能会倒退。

  • 样式化地图 - 您将能够在v3中自定义您的配色方案。不要以为你可以像在v2中那样在一行代码中打开Goog​​le地球插件(对此不是100%,所以如果我错了,请纠正我)。

  • ul>

    完成后,您将很乐意进行更改。页面加载速度更快,缩放更平滑(在缩放而不是消失时,polyines会缩放),移动体验会更好。

    I have full fledged integration of google maps version 2 in my web application, with features like get directions, cluster markers, tabbed info window, context menu(right click). The implementation has very poor design which is causing some problem, So now I need to revamp the core implementation to better design. I was thinking of upgrading to version 3 of google maps API. Please suggest, if that's a good thing to do and my all features will be running fine(or I will get replacement for all the features mentioned) in less time. Or should I stick to the version 2 of the google maps API?

    解决方案

    I recommend you upgrade to v3. I upgraded my site a few months ago (and blogged about the experience). A few things to keep in mind:

    • No more API key.
    • The marker and info window API has changed, for the better.
    • No more AJAX helper stuff. If you are using GXMLHttp, you will need to swap over to a new AJAX wrapper (Jquery, mootools etc).
    • Check your lat/lngs are in the right order. GPoint takes x and y (longitude and latitude). v3 has a latlng object, so your params might be backwards.
    • Styled maps - You will be able to customize your color scheme in v3.
    • Don't think you can turn on the Google earth plugin in a single line of code like you could in v2 (not 100% on this, so please correct me if I am wrong).

    Once you are done, you will be happy to make the change. Pages load faster, zooming is smoother (polyines scale as you zoom instead of disappearing) and the mobile experience is much better.

    这篇关于从谷歌地图API的v2升级到v3,建议的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆