Google Maps API 版本差异 [英] Google Maps API Version difference

查看:23
本文介绍了Google Maps API 版本差异的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试显示两个地方之间的路线,我想使用

  • 为 Google 地图编码折线
  • levels 字符串的编码算法
  • 我们如何解决上述问题?
    请参考这三个答案链接,以解决您的问题:

    I'm trying to show route between two places, I want to used Google Places API V3 for route steps between two points.


    Before I was using Old Google Maps API, and following request gives perfect result:

    http://maps.google.com/maps?f=d&hl=en&saddr=19.5217608,-99.2615823&daddr=19.531224,-99.248262&ie=UTF8&0&om=0&output=kml
    

    Output :


    Now I try to replace this with New Google Maps API, and following request gives wrong result, In both case i'm using same source and destination, but result gives different behavior on Google Map:

    http://maps.googleapis.com/maps/api/directions/json?origin=19.5217608,-99.2615823&destination=19.531224,-99.248262&sensor=false
    

    My problem is that, New Google Maps API return less number of steps between source and destination therefore the route not showing perfect on Google Map.

    Please help to resolve this problem for New Google Maps API v3.

    Thanks in advance.

    解决方案

    What's new in Google Map API v3?
    Google Maps Directions API v3 for Android provide routes in the Encoded Polyline Algorithm Format.

    What we must have to do?
    We must have to decode this Polyline for showing exact Map

    How we decode this encoded Polyline provided by Google Directions API v3?
    Please Refer these three links to more clear with encoded Polyline returns from the Google Maps Directions API v3

    How we can resolve problem in above question?
    Please refer these three answer links, that solves your problem :

    这篇关于Google Maps API 版本差异的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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