谷歌地图上的折线不正确 [英] polylines on google maps not accurate

查看:95
本文介绍了谷歌地图上的折线不正确的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个运输Android应用程序,请尝试帮助我了解为什么折线似乎不规则地移动,有时甚至完全偏离道路?将边界设置为新位置不能与先前位置相距超过一定距离会有所帮助吗? 谢谢.

I have a transport android app and please try help me understand why the polylines appear to be moving irratically and sometimes completely off the road? Would it help to put bounds in that the new position can't jump more than a certain distance from the previous position? Thanks.

推荐答案

如果您要在地图上将用户的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

这篇关于谷歌地图上的折线不正确的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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