且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

谷歌地图上的折线不正确

更新时间:2023-11-07 22:50:34

如果您要在地图上将用户的GPS位置显示为折线,那么您可能希望使用Google新发布的 Google Maps Roads API的snapToRoads函数.

If you are displaying users' GPS locations as polyline on the maps, then you might want to snap it on the road with the Google newly published Google Maps Roads API's snapToRoads function.

将GPS信息校正到道路上的基本操作.由于1张图片的价值为1000字,因此请自己查看.

Basically what it does it to correct the GPS information onto the road. Since 1 picture worth 1000 words, see it yourself.

但是目前,他们仅提供了一个RESTful和JavaScript API,对于Android,您需要通过RESTful服务进行调用.

But currently they only provided a restful and javascript API, for Android, you need to call it through the restful services.

Google为此提供了一个github项目,您可以在此处查看其MainActivity:
https://github.com/googlemaps/roads-api-samples/blob/master/app/src/main/java/com/google/example/maps/roadsapi/MainActivity.java

Google provided a github project for that, you can check its MainActivity out here:
https://github.com/googlemaps/roads-api-samples/blob/master/app/src/main/java/com/google/example/maps/roadsapi/MainActivity.java