一个离线地图应用上图论中最短路径计算离线、最短、路径、地图

2023-09-07 11:26:27 作者:今生、你是我的唯一

我如何利用图论在Android中的离线地图寻找最短路径的概念?我使用osmdroid图书馆和Mapnik的地图图块来显示地图。我的问题,现在的问题是我怎么画,并计算在地图上筑底的最短路径从用户的最后已知​​位置,他的目的地和线路应与道路走。

How do I utilize the concept of Graph Theory in finding the shortest path in an offline map in Android? I am using osmdroid library and mapnik map tiles to display a map. My problem right now is how do I drawing and calculating the shortest path on the map basing from the user's last known location to his destination and the line should go along with the roads.

我可以利用地理坐标?

Can I utilize the geocoordinates?

推荐答案

您可以使用 GraphHopper (警告:我在使用 mapforge (离线渲染器组合的DEV))。

You can use GraphHopper (warning: I'm the dev) in combination with mapforge (offline renderer).

和本位置ID 指数可以查询真实世界的纬度,经度坐标,你会得到ID图形的。使用该ID的,你可以获取通过图表接口。

And with this location to id index you can query real world lat,lon coordinates and you'll get id's of the graph. With that id's you can fetch the real lat,lon via the Graph interface.

让我知道,如果你需要与mapforge集成更多的相关信息。对于桌面有一个alreay 粗糙实施。

Let me know if you need more info for integrating this with mapforge. For the desktop there is alreay a rough implementation.