获取整个路线,Google地图或OpenStreetMap的精确地理坐标 [英] Get exact geo coordinates along an entire route, Google Maps or OpenStreetMap

查看:182
本文介绍了获取整个路线,Google地图或OpenStreetMap的精确地理坐标的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

假设我有一个从一个城镇到另一个城镇的路线。从Google Maps API中,我可以恢复两者之间的路线。但是,从Google返回的路线是一条行车路线,其中包括仅在行程中出现另一步骤的地方(例如,我必须从一条高速公路转向另一条高速公路)的地理坐标。



我需要的是沿着整个路线的地理位置(lat / long),以特定的时间间隔(例如,每1/4英里或100米)。

有没有办法通过Google Maps API /网络服务完成此操作?



或者OpenStreetMap数据库可以做到这一点吗?

亲切的问候,
Madeleine 。

解决方案

OSRM 为您提供路线道路几何形状与OpenStreetMap数据库一样。例如,您可以将路线作为GPX(如果需要,可以后处理该文件)。这看起来如下所示:

  GET http://router.project-osrm.org/viaroute?hl=zh-CN& loc = 47.064970,15.458470& loc = 47.071100,15.476760& output = gpx 

了解更多:< a href =https://github.com/DennisOSRM/Project-OSRM/wiki/Server-api> OSRM API文档。

Suppose I have a route defined from one town to another. From the Google Maps API I can recover a route between the two. However, the route returned from Google is a driving route that includes geo-coordinates only at places where there is another step in a leg (for example, where I have to turn from one highway to another).

What I need is geo-locations (lat/long) along the entire route, at specific intervals (for example, every 1/4 mile or 100m).

Is there a way to accomplish this via the Google Maps API / web services?

Or would the OpenStreetMap database be the way to do it?

Kind regards, Madeleine.

解决方案

OSRM gives you routes with road geometries as they are in the OpenStreetMap database. For example, you can get the route as GPX (and post-process this file if you want). This would look like the following:

GET http://router.project-osrm.org/viaroute?hl=en&loc=47.064970,15.458470&loc=47.071100,15.476760&output=gpx

Read more: OSRM API docs.

这篇关于获取整个路线,Google地图或OpenStreetMap的精确地理坐标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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