Google Maps API Version difference

后端 未结 9 1657
野趣味
野趣味 2020-11-28 23:22

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, a

9条回答
  •  天命终不由人
    2020-11-29 00:07

    The solution above posted by https://stackoverflow.com/users/975959/la-bla-bla works very well with Google Maps API V2 but it needs some minor modifications:
    Replace all the occurrences of GeoPoint with LatLng.
    Replace the line:

    GeoPoint p = new GeoPoint((int) (((double) lat / 1E5) * 1E6), (int) (((double) lng / 1E5) * 1E6));
    

    Which is located just before the end of the method decodePoly, with this line:

    LatLng p = new LatLng(lat / 1E5, lng / 1E5);
    

    Hope this works for Google Maps API v2 users.

提交回复
热议问题