junjunguo / PocketMaps

Free offline maps with routing functions and more ...
https://github.com/junjunguo/PocketMaps
MIT License
229 stars 70 forks source link

Combine maps for continuous route #197

Open aritozen opened 8 months ago

aritozen commented 8 months ago

Hi, I'm in Germany, and the german maps are all split up into the 16 states. This creates an issue when my route goes across state borders, even if I have downloaded all relevant maps. Entering a destination outside the selected map crashes the app. But even if the location is on the map, only the selected map is considered for routes which can be suboptimal for concave maps. Now, this requirement might seem obvious, but it's a strange limitation since geography doesn't work like that.

This is probably a pretty difficult issue to solve. Several other offline providers have the same limitations with regards to the maps. But it would be really useful to be able to combine the downloaded maps, rather than each one being self-contained, especially seeing that each map is exclusive. This wouldn't be so bad if there was a map for all of germany (though then crossings into France or another neighbouring country would still be an issue).

Even if this won't get fixed in the near future, I'd like to leave it as a suggestion. Perhaps something develops from this.

Thanks for your work.

aritozen commented 8 months ago

If it helps, I'd be fine with pre-calculating the route on GraphHopper and downloading it as GPX beforehand, so PocketMaps can partially reconstruct the route per map and switch. Basically create a route to the last continuous track point in the GPX file contained on the map, then automatically select the appropriate next map and continue from there. This isn't truly offline, but perhaps a step in the right direction and a useful extra if one can access the internet at least sometimes (e.g. at home or at a hotel).

Starcommander commented 8 months ago

1) Pocketmaps should not crash, when the route is outside a map. Instead of a route on the streets a direction-line should be shown then. This is also documented there: https://github.com/junjunguo/PocketMaps/blob/master/documentation/index.md --> Navigation This allows to - at least - find the direction to go, until you are inside the target map. When Pocketmaps crashes, then please provide more information about this behaviour.

2) To combine maps for Germany leads to a huge map, that will result to an OutOfMemoryException on some devices.

3) Allowing to load multiple maps is not easy, because each map has a street-mesh of its own, that is used for calculating a route. Nevertheless I am working on a fork-project (alpha-state), where I try to find a way to combine maps. A possible way is to load a broad mesh of the whole world for calculating cross the maps, and using a finer mesh for calculating inside a map. Also I try in this project to run Pocketmaps on different platforms. (win,linux,android,mac,ios,...) I have not published it yet.

4) Creating a route externally as you suggested via GPX is (in my opinion) not a practical way.

Greetings from Austria.

aritozen commented 8 months ago

Thanks for the answer.

With respect to 1, I'll open an issue when I have more time to investigate. I'm on Android 14 and use the 4.0 APK.

  1. To combine maps for Germany leads to a huge map, that will result [in] an OutOfMemoryException on some devices.

I thought as much. And even if it worked, it wouldn't solve the underlying issue, only reduce its impact.

A possible way is to load a broad mesh of the whole world for calculating cross the maps, and using a finer mesh for calculating inside a map.

Certainly a possibility. I guess loading times for maps are significant, so the number of loading/unloading must be minimized, right? I was also thinking about waypoints of sorts where the user can guide the solver (e.g. "Please use this crossing into the other map"). Could also be a generally useful feature for trip planning.

  1. Creating a route externally as you suggested via GPX is (in my opinion) not a practical way.

Graphhopper Maps allows the download of routes as GPX. Importing is of course another matter. This could also guide the solver as to which crossing to use. Not a perfect solution, but better than nothing.

Glad to hear you were already thinking about this problem.

Starcommander commented 7 months ago

Draft project: https://github.com/Starcommander/PocketMapsNG/