计算地图上的最短路径(Google地图,Openstreetmaps等) [英] Calculating shortest path on maps (Google Maps, Openstreetmaps, etc)

查看:329
本文介绍了计算地图上的最短路径(Google地图,Openstreetmaps等)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想计算某种已经存在的地图API路线上的最短路径,然后绘制它们。

这就是说,我需要能够提取/获取更多的数据(即路线的坐标),以便能够操纵它。

我的第一个想法是使用Google地图,但据我所知,Google Maps API只为我的问题提供了非常少的必要数据,因此我无法做出任何一种准确的计算。此外,现有的Google Maps API算法并不关心我,因为我想实现我自己的并对其进行测试。然后,我看着Openstreetmaps,但它的文档也谈论了很少关于这个问题,我仍然不知道是否有可能做这样的计算。所以,仍然不排除Google地图和Openstreetmaps,我的问题是 - 现在的地图API对我来说最适合不仅计算最短路径,也代表他们?

解决方案

是的,您可以使用OpenStreetMap进行此类操作。 $ b OpenStreetMap提供各种数据下载,范围从整个 Planet down to 国家和地区提取,甚至是小城市或自选地区



如果您想从OSM数据计算路线,您必须了解元素标签 OSM XML格式以及更多内容OSM维基。在那里您还可以找到一个关于路由的页面,其中列出了几个现有的路由库以及<一个href =http://wiki.openstreetmap.org/wiki/Routing/OnlineRouters =nofollow>在线路由器和离线路由器。他们中的很多人都是开源的,如果您在某个时候遇到困难,他们可能会很有帮助。


I want to calculate shortest paths on some kind of already existing map API routes and then draw them.

That being said, I need to be able to extract/get as more more data as possible (i.e. routes' coordinates) in order to be able to manipulate with it.

My first thought was using Google Maps but as far as I understand, Google Maps API provides very little necessary data for my problem thus I won't be able to make any kind of accurate calculations. Also, existing Google Maps API's algorithms does not concern me because I want to implement my own and test them.

Then I looked to Openstreetmaps but it's documentation also talks very little on the subject and I still don't know if it is possible to do such calculations.

So, still not ruling out Google Maps and Openstreetmaps, my question would be - what existing map API would be best for me not only to calculate shortest paths but also to represent them on it?

解决方案

Yes, you can do such things with OpenStreetMap.

OpenStreetMap offers various data downloads ranging from the whole Planet down to Country and area extracts and even small cities or self-chosen areas.

If you want to calculate routes from OSM data you have to learn about elements, tags, the OSM XML format and many more things described in the OSM wiki. There you can also find a page about routing listing several already existing routing libraries as well as online routers and offline routers. Many of them are open source and they might be helpful if you get stuck at some point.

这篇关于计算地图上的最短路径(Google地图,Openstreetmaps等)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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