Google将api v3多段线对齐到最近的街道 [英] Google maps api v3 polylines snap to nearest street

查看:90
本文介绍了Google将api v3多段线对齐到最近的街道的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

假设我有一个加载到数据库中的GPS单元的位置列表。现在,我希望谷歌地图显示这些位置,就像这样开箱即可使用。

  new google.maps.LatLng (57.046085209585726,9.917740747332573),
new google.maps.LatLng(57.04606626648456,9.918211475014687),
new google.maps.LatLng(57.04656251706183,9.917992874979973),
new google.maps.LatLng(57.04649009741843 ,9.918401995673776),
new google.maps.LatLng(57.04628427978605,9.91844767704606),
new google.maps.LatLng(57.04613022040576,9.91837676614523),
new google.maps.LatLng(57.045781994238496,9.918353715911508 ),
new google.maps.LatLng(57.045685979537666,9.918150706216693),
new google.maps.LatLng(57.0457204291597,9.917718200013041),
new google.maps.LatLng()

问题是。由于多边形线路切断了角落,并且由于不太正确的GPS设备,它会看起来像您穿过建筑物和游泳池到达街道的另一侧。
有没有什么办法可以使我的数据库中的定位数据快速到最近的街道?



谢谢大家
Jonas

解决方案

不是我知道的。
您可以尝试使用路线API来请求点之间的路线,但每个请求有八个路标点的限制,您可以将较长的点列表分为子列表并进行多个方向的呼叫,但有限制的数量呼叫允许服务。

这种方法的另一个问题是,如果由于数据或地图数据中的细微错误,例如,您似乎在道路的错误一侧可能会产生虚假U转向并绕过环形交叉口。

标准的Google地图网络用户界面有一个带有对齐路线选项的线条绘制工具,但该选项未包含在绘图管理器的API版本。
我确实提交了一项增强请求 http://code.google.com/p/gmaps-api-issues/issues/detail?id= 3824& can = 4& sort = -stars& colspec = ID%20Type%20Status%20Introduced%20Fixed%20Summary%20Stars%20ApiType%20Internal ,但没有回应。您可以将问题列为主角并/或创建您自己的请求,因为您发布的内容并不完全相同。


Assuming i have a list of positions from a GPS unit loaded into a database. Now i would like Google maps to show these positions, which works just out of the box like this

new google.maps.LatLng(57.046085209585726, 9.917740747332573),
                        new google.maps.LatLng(57.04606626648456, 9.918211475014687),
                        new google.maps.LatLng(57.04656251706183, 9.917992874979973),
                        new google.maps.LatLng(57.04649009741843, 9.918401995673776),
                        new google.maps.LatLng(57.04628427978605, 9.91844767704606),
                        new google.maps.LatLng(57.04613022040576, 9.91837676614523),
                        new google.maps.LatLng(57.045781994238496, 9.918353715911508),
                        new google.maps.LatLng(57.045685979537666, 9.918150706216693),
                        new google.maps.LatLng(57.0457204291597, 9.917718200013041),
                            new google.maps.LatLng()

The problem is. That the polylines cut corners and due to less correct GPS devices it will look like you walked through a building and swimmingpool to get to the other side of the street. Is there any way i can make my positioning data from the database snap to the nearest street?

Thank you all Jonas

解决方案

Not that I am aware of. You could try using the Directions API to request directions between the points but there is a limit of eight waypoints per request, you can break longer lists of points into sublists and make multiple directions calls but there are limits on the number of calls allowed to the service.
Another problem with this approach is if due to minor inaccuracies in your data or the map data you, for example, appear to be on the wrong side of the road it might generate spurious U turns and trips around roundabouts.

The standard Google map web user interface has a line drawing tool with a 'snap to road' option but this option was not included in the API version of the drawing manager. I did submit an enhancement request http://code.google.com/p/gmaps-api-issues/issues/detail?id=3824&can=4&sort=-stars&colspec=ID%20Type%20Status%20Introduced%20Fixed%20Summary%20Stars%20ApiType%20Internal but no response yet. You could star the issue and/or create your own request since you issue isn't quite the same.

这篇关于Google将api v3多段线对齐到最近的街道的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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