Support for custom custom HDPI online maps

Martin Ždila shared this idea 6 months ago
Completed

Hello,

We'd like to use HDPI tiles in Locus.

Our TMS comply with standard /{z}/{x}/{y}{r} where {r} can be omited or it can define tile scale like @3x. In that case tiles are 3x bigger. We still need to keep <tileSize>256</tileSize> even the real size is 768 and we need to turn on map scaling to 300% to see map texts and elements properly.

Isn't there a more straight approach to achieve that - without need to scale the map manually? Iteally there could also be some negotiation with TMS server to find out which scales does it support and then Locus could match device's DPI with that and provide scaling automatically. But I am afraid there is no standard for that.

Tile sample: http://tiles-ng.freemap.sk/15/18288/11266@3x

I've also attached custom map definitions.

Thanks in advance.

Files: fm.xml

Comments (23)

photo
1

Good day Martin,

really interesting. I was little worried that such map comes soon or later :).

What should be from your point of view correct app behaviour how to use and display such maps? As I think about it, best should be if map should have defined base scale that will be used for display. All maps currently have base scale defined to 100%. For your 3x maps, it should be set as 300%. Will it then work?

Current Locus Map does not support such "custom scaling". Anyway I'm for a few months working on new map core for whole application and with it will be possible to set custom scaling for every single map.

Let me know if there are any better approaches that I do not see, thanks.

photo
1

Hi Menion,

Actually I think Locus should pre-set global map scaling according to display density of the device.

Currently the default scaling is always 100% and it makes elements of all raster maps look very small, ofter unreadable, regardless of whether the map is HDPI or not.

So if I have HDPI device and I install Locus, I'd like to have it set to 300% for all raster maps. Then I would see non-HDPI maps little blurred, but elements would be readable. And I would see HDPI maps sharp and readable. Actually that's how web maps (eg. based on Leaflet) work - browsers upscale low resolution images (regular map tiles) so they are not small on HDPI displays.

Vector maps are now displayed correctly - Locus renders them according to display DPI. Actually when I am switching between vector and raster maps I always must adjust scaling back and forth.

photo
1

Hi Martin,

fine so you confirmed my solution, perfect.

What you wrote make sense and it is also one of main reasons, why I in September decided to rewrite app map core. The current system does not allow to set a different scale for raster maps and a different scale for vector maps, which is a serious problem. As you wrote, the vector maps look good with 100% scale because they automatically rescale based on DPI. With raster maps ... as you wrote.

I would like to publish a new map core into some alpha test probably during February. It will anyway still needs to add an additional parameter to the XML file. I'll mark this topic and let you know when the solution on Locus Map side is ready to test/use.

photo
1

Great, I am looking forward to test it :-)

photo
2

Good day Martin,

info about the version for test: https://forum.locusmap.eu/index.php?topic=6471.0 (so not yet published) anyway to close this topic in my TODO list, I'm writing here now.

In attachment is modified the configuration for your map. Key information:

  • {ts} in the url - internally called TileScale parameter. Needed to support custom scaling
  • "tileSize" - base tile value for 1x scale, so usually 256
  • "tileScale" parameter, needs
    • "dpi" - target DPI for which scale match best. App search for the highest best value so it tries to find tileScale.dpi >= real device DPI
    • "multi" - multiplier of base "tileSize" value
    • "replace" - value that replace {ts} parameter in url

Tested and seems to work as expected ;). Alpha version for test? In the worst case at the start of March.

Files: fm.xml
photo
1

Hi Menion,


I've finally got back into it but unfortunately the link provided in forum doesn't seem to work anymore.


BTW meanwhile we changed domain for our HDPI tiles and updated supported scales to 1, 2, and 3. Please see https://raw.githubusercontent.com/FreemapSlovakia/freemap-mapnik/master/freemap-locus.xml. You can include these definitions to built-in, merging it with existing (old) freemp maps.


Thanks.

photo
1

Zdravím Martine,

thanks for additional information. I've successfully added this very nice "New Outdoor" map into Locus Map. Only what I worry little about is, that this modification may need improvements in downloaded SQLite cache/offline map. Because till now, all maps were 256x256 and this change now. Locus Map than needs to know, how to handle this format. So it won't be included in the next app release.

Also, if you will want to modify anything in map settings directly in the app, please let me know. Thanks.

photo
1

Ahoj Menion,

I leave it up to you when you will include "full" support for HDPI maps in Locus :-). From user experience I only want to select "New Outdoor" from the map list and the app would then show the map of the suitable DPI (from the list of the supported) without manually adjusting zoom and also make available for offline download etc... :-)

photo
1

Ahoj Menion,

Could you please include map from https://github.com/FreemapSlovakia/freemap-mapnik/blob/master/freemap-locus.xml to our Freemap maps collection?

In the latest release it works great. And I finally don't need to change scaling when switching between raster maps, HDPI raster maps and vector maps. Thanks!

PS: Only thing I am missing now is to bind "Map shading" state to some maps because I prefer to have it enabled for our vector map only.

photo
1

Hello Martin,

the map was already added in previous Beta versions. I'll enable it to next release version.

Should be added into the list as another map or should it replace "Touristic" map?

I'll just have to somehow improve, how the app will work with these tiles. Because previously it was clear ... the map always had predefined tile size. Now, you may download/cache some tiles in a certain scale, then move download map file to another device with different resolution and ... Locus will have no idea how to handle this map.

photo
1

Thanks. Please name it "Outdoor". Currently it combines hiking, bicycle and ski trails.

Regarding handling exported maps, I think that target device should up/downscale tiles with ratio computed as current device scale / exported scale. Therefore export should also store `tileScales` and value of used `tileScale`. If exported tiles are eg. 3x and target device should use 2x then just scale them with 2/3 ratio. If exported tiles are 2x and imported to device with 3x then stale them with 3/2.

photo
1

Ahoj Menoin,

I've updated https://github.com/FreemapSlovakia/freemap-mapnik/blob/master/freemap-locus.xml to also include non-HDPI map to save bandwidth when downloading it over mobile network.

It would be nice if you could update it. Thanks!

photo
1

Hello Martin,

I'll update "Outdoor (with HDPI support)" in Locus Map, thanks.

As I now see, you set for DPI 160 rescale to 2x. If I may suggest, 160DPI is equal to MDPI resolution and it is perfectly correct to display 256x256px tiles in 1:1.

So my suggestion is to set for DPI 160 scale to 1x and since DPI 320, use 2x and for DPI 480 use 3x rescaled tiles. Or the values you defined are based on your own experience and testing? Then it is perfectly valid and I'll hard-code in the application as you have on Git.

---

Hmm now, I see, I wrote it like this also to sample XML file I attached here some time ago. Do not know why, but such settings most probably cause too huge map tiles for devices with HDPI (240) resolution.

---

Testing on the emulator with HDPI (best comparison is with bottom scale bar that is always the same and its size is set to minimal readable text size).

*Current*

/5586cd4eef83f723b6751fc91be7d3a1

*My suggestion*