简体   繁体   English

Android google方向api忽略街边

[英]Android google directions api ignore street side

I want to display the a route on a map and I have the coordinates for each waypoint in the route. 我想在地图上显示路线,并且我有路线中每个航路点的坐标。 The problem is, the coordinates are not that precise and it can occur that google thinks the waypoint is on the other street side, thus giving me a stupid route result. 问题是,坐标不是那么精确,谷歌认为航点是在另一条街道上,这可能会给我一个愚蠢的路线结果。 Is there any way to make google think that the waypoint is not on the other street side or optimize the waypoints? 有没有办法让谷歌认为航点不在另一条街道或优化航点?

I don't think you can track Google Maps to think it is not on the other side. 我不认为您可以跟踪谷歌地图,认为它不在另一边。 But you can optimize your waypoints by using the snapToRoads function in Google Maps Roads API . 但您可以使用Google Maps Roads API中snapToRoads功能优化航点。

在此输入图像描述

Even the path I draw is closer to the right to left part (upper/westbound) of the Charleston road, since I draw the points from left to right, the snapToRoads is able to tell I am actually going from left to right (eastbound). 即使我绘制的路径更接近查尔斯顿路的右到左部分(上/西​​行),因为我从左到右绘制点, snapToRoads能够告诉我实际上是从左到右(东行) 。

You should able to fix your lat/lng on your server by using their web API, which looks like: 您应该能够使用他们的Web API修复服务器上的lat / lng,如下所示:

https://roads.googleapis.com/v1/snapToRoads?path=lat1,lng1|lat2,lng2|lat3,lng3
    &interpolate=true
    &key=API_KEY

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM