GPXSee icon indicating copy to clipboard operation
GPXSee copied to clipboard

Support for offline vector maps: .obf (OsmAnd), .pbf (OpenStreetMap) or .mwm (Organic Maps)

Open hshagsfgd opened this issue 2 years ago • 8 comments

TL;DR

Having basic read-only support for offline vector maps would be nice.

The vector maps can be freely downloaded:

  • OsmAnd: https://osmand.net/list.php
  • OpenStreetMap: https://planet.openstreetmap.org
  • Organic Maps: https://cdn.organicmaps.app

Hello, I wonder why there's no .obf file support and instead image based files/tiles are supported, which require lots of disk space and an internet connection with every zoom level and every missing tile, and are, like, the worst possible format. Tiles based maps are like converting text into images, very ancient and unpractical format for offline maps use. .obf maps can be download here: https://osmand.net/list.php. I'm not sure, but I think .obf format is only used by OsmAnd (and its forks like OffRoad), which is still like the biggest open source free map navigator app for Android, so some support for this format would be appreciated. OsmAnd's .obf files seem to be largely based on openstreetmap.org data, so maybe the support for openstreetmap.org's own format would be a good alternative, as it's not supported either and I can't open .pbf files.

hshagsfgd avatar Jan 05 '22 13:01 hshagsfgd

There is no OBF support (yet) because there is no documentation at all for the format. Which is not a showstopper (the Garmin maps were reverse-engineered even without source codes available), but it drastically reduces the willingness to implement support for such a format. And as it is, like you say, used by only a single application, the motivation reduces even more.

There are three main reasons, why there are so much raster formats supported but only a few vector formats:

  1. It is much easier to implement a raster format than a vector format
  2. The raster formats have a significantly better performance and render quality. Even with today's state-of-the-art CPUs you can not "instantly" render the data with a detail level that you can get with pre-rendered rasters. The raster maps require more space, but this is not an issue for several years. Even my 10 years old Nokia 2710 phone can use a 16GB SD card where you can store a whole country in sufficient levels...
  3. Almost all available vector maps are based on OpenStreetMap data whereas the raster maps are often based on different sources that are significantly better for the map area.

However, if you really want some vector maps, then there is support for Mapbox MVT vector maps, Mapsforge vector maps and Garmin IMG vector maps in GPXSee.

tumic0 avatar Jan 05 '22 22:01 tumic0

Not too surprised OsmAnd's .obf format has no documentation, it's not in their interest if other software supports it, since they sell a OsmAnd+ version. But supporting .obfis not mandatory for me, I'm just hoping to not need to download basically redundant maps, but I'm fine with support for any open source freely downloadable vector maps.

So the more important question is: How's the documentation on openstreetmap.org's .pbf (compressed OSM XML) / .osm (uncompressed OSM XML)?

Regarding the points:

  1. Yes, I think even I could do it.

Rendering speed: The rendering after zooming to a different level takes about 1 second (rough estimate). Yes, not instantly, pretty fast. Tested using OffRoad on my PC with AMD 5600X CPU. Moving around until new, un-rendered, area come, takes about 0.3 seconds (rough estimate). So it's not a problem/argument at all, especially since GPXSee is a desktop application and desktop CPUs are, on average, faster than mobile CPUs (if nothing else is used to improve rendering speed). Rendering quality: It looks fine. Where pre-rendered tiles look more beautiful/useful is in e.g. topological maps or satellite maps, of course.

Let me add regarding the rendering speed of OsmAnd: It's indeed an issue on mobile devices running OsmAnd, but according to the comment there, it has more to do with their rendering algorithm, instead of everything else:

There is something very fundamentally broken with the Android implementation in OsmAnd. Take a look at Organic Maps. Same database, fewer features but really nice and smooth zooming and panning.

How I found this discussion/issue? I though OsmAnd's map rendering speed was slow, so I searched for an issue and found it (it was an open issue when I found it, but has been moved to a discussion).

I don't know what map format Organic Maps uses since I couldn't find their maps to download, or why the map rendering is supposedly so fast. The only thing I saw so far is that Organic Maps is developed mostly in C/C++, and OsmAnd is mostly Java.

I installed Organic Maps from f-droid and can't complain about the rendering speed. Organic Maps looks like it's even more free than OsmAnd (• No ads, • No tracking, • No data collection, • No phoning home, • No annoying registration, • No mandatory tutorials, • No noisy email spam, • No push notifications, • No crapware, • N̶o̶ ̶p̶e̶s̶t̶i̶c̶i̶d̶e̶s̶ Purely organic.), fewer permissions, but also fewer features. Maybe you can check out how they do the rendering, if you can confirm that it's fast (on a desktop CPU it's going to be even faster) or maybe they have documentation on their map rendering implementation, so maybe you could implement their vector map format, if it's a different one. Maybe it's a bad sign on available documentation because I even can't find their maps to download.

  1. Not sure what you mean. Maybe you can post map examples compared to OSM, where others are better (their vector maps only, of course)? OpenStreetMap is a rather big community effort and free. Don't be too surprised if other commercial maps are sometimes better because their services probably cost money. Granted, the company which starts with G has probably the best vector maps, but they aren't free.

Thanks for mentioning the supported vector alternatives. I tried searching for Mapbox MVT vector maps download, but couldn't find any. I'm going to try to search for downloadable maps of the other 2 you mentioned later.

Edit I found the maps download URL through "download" search in /issues -> https://github.com/organicmaps/organicmaps/issues/582 -> https://cdn.organicmaps.app/mirrors/. They are in a, yet again, different .mwm format.

hshagsfgd avatar Jan 06 '22 11:01 hshagsfgd

If you want to see maps that are way better than OpenStreetMaps for the given area, then look at the Swisstopo maps. Another example are mapy.cz for my country (Czech Republic). Both of them are raster maps, but as already said, you will not get a comparable result from the vector maps as the rendering can not be done in real time at the required quality level. And to get the best possible results, you even need human adjustments, so the vector maps will probably never close the gap.

There are several MVT maps in the GPXSee Online Maps catalogue, some of them can even be downloaded as mbtiles for offline usage (for the rest, you can download the tiles "manually" and create a local map definition). But if you just want some vector maps regardless of the render quality and performance, than simply go for some Mapsforge maps...

tumic0 avatar Jan 07 '22 21:01 tumic0

I just opened https://tumic0.github.io/GPXSee-maps/maps/Mapbox.tpl in gedit and saw <copyright>© Mapbox, © OpenStreetMaps</copyright>, which shows, once again, that many projects are based on OpenStreetMap's data [so why not add support for .pbf format] (yes, I'm repeating myself).

.. but as already said, you will not get a comparable result from the vector maps as the rendering ..

Show where pre-rendered vector maps differ from real-time vector maps, because it's not like pre-rendered maps are manually tuned for every street and corner or such (trivial cases like OpenTopoMaps or such don't count, of course). Pre-rendering normal vector maps to images is just dumb (not sure when it started, but maybe CPU speed was a reason for it back then, but things have changed; same with routing, which can be done on a smartphone nowadays), unless more work is put into it like in OpenTopoMaps. (Also, yes, we are repeating ourselves.)

Thanks for the vector map hints, I'm gonna check them out. Unless they offer the whole world for free download without any registration or such, like OpenStreetMap (compressed .pbf 61GB), they are not an alternative, tho.

If you would like a donation to help you add support to .obf, .pbf or .mwm, maybe let people know somewhere on your site, I don't see a problem donating to people who do the work.

Edit

But if you just want some vector maps regardless of the render quality and performance, than simply go for some Mapsforge maps...

I downloaded a .map file from there and GPXSee can't open it (Unknown format). Why mention them if GPXSee can't read the format.

There are several MVT maps in the GPXSee Online Maps catalogue, some of them can even be downloaded as mbtiles for offline usage [...]

I downloaded a .mbtiles from here and GPXSee also can't open it (Unknown format).

(for the rest, you can download the tiles "manually" and create a local map definition)

You mean creating vector tiles manually? Sounds too complicated. I just want to be able to open a downloaded vector map in GPXSee. Neither the suggested .mbtiles, nor .map files can be opened after I downloaded them.

hshagsfgd avatar Jan 08 '22 11:01 hshagsfgd

MBtiles and Mapsforge files work fine in GPXSee. You just have to open them as maps (like all other map formats), not as data files.

tumic0 avatar Jan 13 '22 07:01 tumic0

I see, opening the .map from the Map menu does indeed work. Very nice.

I would suggest adding drag&drop support and allow opening them from the File menu, or add at least a message saying something like: This file extension is supported, but please open it through the Map menu, instead of Unknown format.

Now that I see it working, having support for the other formats would rather be a convenience than necessity (I think so far), because currently one needs to have 2 different map formats for the same regions: 1 for Android (.obf or .mwn) (if one only wants to use strictly either of these open source apps: OsmAnd or OrganicMaps) and 1 for desktop. It's not optimal, but space shouldn't be that of an issue nowadays.

If you really want, you can close this issue, although I wonder if there's a significant difference between .pbf, .map and .mbtiles.

hshagsfgd avatar Jan 13 '22 11:01 hshagsfgd

Maybe it's a bad sign on available documentation because I even can't find their maps to download.

Just in case, you can generate mwm maps yourself:

  • https://github.com/mapsme/omim/tree/master/tools/python/maps_generator
  • https://github.com/ckesc/mapsme_map_gen_container

sikmir avatar Jan 16 '22 19:01 sikmir

I have found their map download URL since after, see first post, but still good to know, thanks. (Organic Maps is a maps.me fork (AFAIK), in case someone wonders why the 2 URLs contain maps.me.)

hshagsfgd avatar Jan 17 '22 14:01 hshagsfgd