【问题标题】:Eliminating off-the-road points using google apis使用 google apis 消除越野点
【发布时间】:2012-10-15 12:16:47
【问题描述】:

运行我的 API 后,我得到如下所示的地理点。蓝色的在正确的路线上,但红色的不在路线上。我需要加入积分才能获得我的最终路线。如何消除这些红点?

我掌握的关于这些点的信息是纬度、经度、它们所在的道路(这些点已被反向地理编码)。

A,B,C 是不同名称的道路。要根据“道路”名称进行过滤,我们最终可能会消除道路 B 上的蓝点。

任何 Google API 都可以提供帮助吗?谷歌路线 API?

【问题讨论】:

    标签: google-maps google-maps-api-3 google-api google-directions-api


    【解决方案1】:

    我能想到的最好的事情(除了手动滚动您自己的 distanceToPolyline 算法)是使用 google.maps.geometry.poly.isLocationOnEdge (documentation),然后您可以询问所有点是否在路线附近并采取相应措施。

    Here's an example I made,尝试添加标记,然后隐藏越野标记(也建议使用公差变量)。

    【讨论】:

    • 谢谢!任何可以帮助我在 Ruby 中实现这些 Java 方法的链接?
    • @Kavya 好吧,en.wikipedia.org/wiki/Distance_from_a_point_to_a_line(假设路线足够小以实现近似共面)是一个很好的起点,因为您可以将折线(或任何路线)分解成多条线,基本上set is_near as false; take two coords of the route, find the distance to the point being evaluated, if it's less than your tolerance set is_near as true, return; else pick the next coord (pairing it with the second one chosen last time) of the route and keep iterating 如果到最后 is_inside 是假的,那么它不在路上,否则它在里面。
    • 还要检查另一个答案,因为在这种情况下它可能更有用
    【解决方案2】:

    RouteBoxer 可能会有所帮助。

    这里的JS实现-http://google-maps-utility-library-v3.googlecode.com/svn/trunk/routeboxer/docs/examples.html

    PHP 服务器端实现在这里-http://luktek.com/Blog/2011-02-03-google-maps-routeboxer-in-php

    如果您喜欢冒险,您可以浏览代码并尝试制作一个 Ruby 端口。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多