Locus Map - forum

Content & Tools => Themes - Vector maps => Topic started by: SwissPoPo on July 12, 2015, 12:26:47

Title: dpi independent map/theme
Post by: SwissPoPo on July 12, 2015, 12:26:47
Is there a way to create a dpi independent map/theme?

The mapsforge-maps in Locus looks different on every device. I can define some dpi dependent scale in the theme (adding dp to the value). It works but it produce an unusable view on higher dpi devices, because the map itself does not scale.

How can I create a theme which looks on every device identical? A have only found a solution which I am not happy with it: Remove all dpi scaling features from the theme and manual configure "Settings > Map - advanced > Change map resolution: Enable; and Set resolution: 2x or higher".
Disadvantage: Manual user task, Bitmap Scaling even for fonts or svg. It looks ugly.

Could the dpi dependent scaling of the whole map added as option to the theme?
Is there a solution where I have not yet discovered?


Some pictures:
160dpi
(http://s18.postimg.org/ri9zoeiid/test160dpi_XX.jpg) (http://postimg.org/image/ri9zoeiid/)(http://s22.postimg.org/p04qq7srx/test160dpi_XXdp.jpg) (http://postimg.org/image/p04qq7srx/)
240dpi
(http://s1.postimg.org/88ss3gq63/test240dpi_XX.jpg) (http://postimg.org/image/88ss3gq63/)(http://s9.postimg.org/dp8b5bx23/test240dpi_XXdp.jpg) (http://postimg.org/image/dp8b5bx23/)

I have tested the line stroke-width with and without dp.
With 160dpi I don't expect any difference. And yes, everything looks fine.
With 240dpi the streets are scaled with the dp parameter. But it look ugly because the map itself isn't scaled. On 320 or 480dpi devices you won't see any details from the round about. I expect a smaller map view/extract. The android and locus Interface are scaled.

Remark: These screenshots have all the same resolution but on a hardware device the 240dpi pictures are much smaller.
Title: Re: dpi independent map/theme
Post by: jusc on July 12, 2015, 16:15:38
I don´t have a solution, but why do you not set 200 - 240 dpi as reference?
This screenshot is taken from my Note 2 with 267dpi.
(http://s14.postimg.org/5hwlwfgdp/2015_07_12_15_28_33.jpg) (http://postimg.org/image/5hwlwfgdp/)
Title: Re: dpi independent map/theme
Post by: SwissPoPo on August 16, 2015, 23:23:16
A reference of 200-240 dpi? A simple standard smartphone with 5" and Full HD has 440dpi.
So, a theme must work at 480dpi. But with Locus it does not and I can't optimize a theme for 480dpi.

I made another screenshot to explain the issue:

(http://s7.postimg.org/8su9ru8av/Z99.jpg) (http://postimg.org/image/8su9ru8av/)

These screenshots are made with an android emulator and reduced in size by 50%.
The pixels on these pictures have all the same size. On a real 480dpi-device the picture is 3x smaller than on a 160dpi-device.
This require that you draw it 3x bigger so that you're capable to read or recognize something.

Column A: A Theme which does not scale by device density. Simple values or values with "px".
From 160 to 480: The pictures becomes smaller and smaller (on a real device!). You can’t read anything.

Column B: A Theme which does zoom scale elements (lines, symbols, text) by device density. Values with "dp".
From 160 to 480: The text is scaling well, but the streets need too much space, they overlapping. Issue: The areas, the map itself does not scale.

Column C: A Theme which does not scale by device density. Simple values or values with "px". The scaling is manually set to 1x, 1.5x, 2x, or 3x.
From 160 to 480: The pictures have all the same size (on a real device!). Great or not? No, because it must manually set and the map is pixelated. It is not rendered at that resolution.

I expect that Locus will behave like column C automatically and without pixelating.
A normal user does not try to find this option somewhere in the settings and nobody wants to see pixels on his high dpi phone.

Title: Re: dpi independent map/theme
Post by: john_percy on August 17, 2015, 10:16:53
Surely you should zoom in or out accordingly? What happens with your column B images if you zoom in at higher resolution, so the same area of real life is shown on the screen?
Title: Re: dpi independent map/theme
Post by: SwissPoPo on August 17, 2015, 10:44:02
Zooming does not resolve it.

All picuture above are at zooming level 18.
I made a picture with theme B - 480dpi zooming level 19.
(http://s22.postimg.org/wdqp0ii31/Z04_Locus_DP_480_19_100.jpg) (http://postimg.org/image/wdqp0ii31/)

The areas are still to small, or the lines to big. Details are lost.

Title: Re: dpi independent map/theme
Post by: jusc on August 19, 2015, 11:41:00
Sorry, I can´t follow.
How would you explain the difference between your 240 dpi screenshot in first post and my screenshot in seond post?
Perhaps you can let us test your theme? But I have to say, I don´t have a 480 dpi phone.
Title: Re: dpi independent map/theme
Post by: SwissPoPo on August 19, 2015, 20:11:50
Yes it is not easy to understand the issue when you don't have a 480dpi device. With a 240dpi device you can recognize it, but it will not bother you. On a 480dpi device Locus becomes unusable (not the user interface, only the map).
It is also not easy to explain the issue, because all screenshots in this thread have the same pixel size (your local display define the size). You have to imagine that on a real 480dpi-device the picture is 3x smaller than on a 160dpi-device.

jusc, you asking about the difference between the two screenshots (first & second post):
Your theme is V-Scale2 right? My theme is fzk-outdoor-contrast which I am currently trying to make it more useful with Locus. The unedited version is available on the webpage freizeitkarte-osm.de.
As I have seen, your theme has no density scaling features, so the theme is similar my screenshots on the left side of the first post, or column A of third post. Both themes are unusable at 480dpi. Everything is too small.
The initial size of the street and text are a slightly bigger, but not enough that you can read it at 480dpi. This bigger size of the streets has also a disadvantage, because they overlapping with the buildings. This overlapping gets extreme when you use the density scaling features (right side first post, column B third post).

Get a 480dpi device and try it out. ;)
I hope menion has one.


Title: Re: dpi independent map/theme
Post by: menion on August 19, 2015, 21:22:49
Unfortunately I don't. And this is a problem why I not yet noticed any problems with themes. You (and others with such high DPI devices) will have to wait till Q4 of this year, when I plan to purchase something ...
Title: Re: dpi independent map/theme
Post by: john_percy on August 19, 2015, 22:06:36
What happens with a scalable theme like my Voluntary UK, where everything is defined in terms of dp?
Title: Re: dpi independent map/theme
Post by: Tobias on August 19, 2015, 22:40:27
What happens with a scalable theme like my Voluntary UK, where everything is defined in terms of dp?
Same as in column B. Everything with dp gets scaled, but not the tile size which is fixed at 256px. The problem is that lines are getting thicker, but areas stay the same (and are disappearing with too much scaling).

There's two solutions:

- scale tile size with dpi (as mapsforge did starting with 0.4, 256px for 160dpi, 512px for 320dpi etc.), not implemented in Locus (and most other apps)

- use different zoom levels for comparison (e.g. one tile at ZL15 at 160dpi=256px is equal to four tiles at ZL16 at 320dpi=512px) and adapt you theme files accordingly, e.g. extra files for different dpi (disadvantage: zoom-min/max in theme files have also to be adjusted for real conversion, and zoom-appear in map files can't be adjusted)
Title: Re: dpi independent map/theme
Post by: fzk on August 20, 2015, 21:36:30
Unfortunately I don't. And this is a problem why I not yet noticed any problems with themes. You (and others with such high DPI devices) will have to wait till Q4 of this year, when I plan to purchase something ...
Mapsforge 0.5 has already implemented a dpi dependent scaling feature. But I have learned from another thread that this isn't an option for Locus. So I wonder what you intend to buy and how will this solve the problem?

Klaus
Title: Re: dpi independent map/theme
Post by: SwissPoPo on August 20, 2015, 22:38:00
Klaus, I don’t think that you motivate menion to solve the problem when you point to mapsforge.

...I hope he gets his new toy long before Christmas. ;D
Title: Re: dpi independent map/theme
Post by: jusc on August 22, 2015, 11:07:44
Get a 480dpi device and try it out. ;)

Only to get some strange looking maps?  ;D
But what about Johns question: "What happens with a scalable theme like my Voluntary UK, where everything is defined in terms of dp?"
Can you show us some screenshots with his theme too, please? I don´t have this possibility.
Title: Re: dpi independent map/theme
Post by: SwissPoPo on August 24, 2015, 20:43:42
You not only get strange looking maps, you also get a very powerful phone. ;) Since over two years most flagship phones have a display density of 400 and above.

Johns question was already answered by Tobias, it looks the same as in column B (Post #3). "dp" in the theme only scales the lines, text, and icons but not the map itself (areas/buildings).
Here a screenshot at 480dpi Zoom 18 (file reduced by 50%).
(http://s12.postimg.org/7bzs2vhg9/Z05_Locus_Vol_UK_480_18_100.jpg) (http://postimg.org/image/7bzs2vhg9/)

You can test with the free Goggle Android Emulator (part of AndroidStudio). There also exists more comfortable emulators from others.
Title: Re: dpi independent map/theme
Post by: Viajero Perdido on September 02, 2015, 04:06:43
What happens with a scalable theme like my Voluntary UK, where everything is defined in terms of dp?
Everything is readable!

I can finally turn off the "Change map resolution" feature (which magnifies the display by some factor), and still have very readable vector maps.  The only trouble is, with that setting off, the *online* tiled maps now look unusable.  So it's a hassle to switch between online and offline, because offline maps (with Voluntary UK) handle the high DPI, but online ones don't, and to switch I need to keep toggling the change-resolution setting.  So I mostly just stay in offline mode with Voluntary UK, or rather, my derivative version.

As a bonus, when you zoom right in, hard-to-see things like POI icons get bigger, exactly as you'd expect.

This is with a Nexus 5 with crazy-high DPI.  (Which, combined with Locus, beats the pants off a Garmin in every way.)
Title: Re: dpi independent map/theme
Post by: john_percy on September 04, 2015, 19:06:10
I finally got round to testing this in an emulator. The three screenshots represent the same physical size screen at 120, 240 & 480 dpi respectively.
To cover the same area of land requires different zooms, and the appearance is not totally the same. Roads are wider in the higher dpi display, and more items will "appear" due to the higher zoom.
However, I can imagine that the higher detail of the the higher dpi might mean that one wouldn't need to zoom in so much in any case.

(http://s28.postimg.org/ermj7i7ah/120_240_480dpi.jpg) (http://postimg.org/image/ermj7i7ah/)
Title: Re: dpi independent map/theme
Post by: menion on March 13, 2016, 21:29:45
Hi guys, SwissPoPo pointed me on this topic. As I read it precisely since begin, I have still not idea what is problem. Mainly I don't understand how you may compare difference densities on same area. Devices with 160DPI has a lot smaller screens, so you see a smaller area. Anyway I still don't have big device. Tomorrow, I'll discuss this with Petr, who do themes for Locus. Maybe he will enlighten me and point on some solution.
Title: Re: dpi independent map/theme
Post by: SwissPoPo on March 13, 2016, 21:42:23
It is not easy explain the issue so that is understandable. It would be easier to take a look on such a device.

One more simple example:
You have two parallel streets.
=========== Name 1 ==========
=========== Name 2 ==========
On a 160dpi you see the streets and you can read the names.
On a high dpi device you make the streets wider (by theme), and double the text size (also by theme). ...now you have no problem. No! You can't read the second name, because the first name needs all space. The distance between the streets are always the same. They are NOT scaled (that is the issue).
Title: Re: dpi independent map/theme
Post by: menion on March 13, 2016, 22:34:28
hmm that sound logical. Oki. And solution for this?
Title: Re: dpi independent map/theme
Post by: Tobias on March 13, 2016, 22:42:15
hmm that sound logical. Oki. And solution for this?

As mentioned above, that's the possibilities I see:

Quote
There's two solutions:

- scale tile size with dpi (as mapsforge did starting with 0.4, 256px for 160dpi, 512px for 320dpi etc.), not implemented in Locus (and most other apps)

- use different zoom levels for comparison (e.g. one tile at ZL15 at 160dpi=256px is equal to four tiles at ZL16 at 320dpi=512px) and adapt you theme files accordingly, e.g. extra files for different dpi (disadvantage: zoom-min/max in theme files have also to be adjusted for real conversion, and zoom-appear in map files can't be adjusted)

With the second option I meant you have to use higher ZL at higher dpi devices, so e.g. if ZL15 is fine for you at 160dpi, someone has to use ZL16 for the same area at 320dpi, and someone else ZL17 at 640dpi.
Title: Re: dpi independent map/theme
Post by: menion on March 14, 2016, 12:10:41
Ah thanks!

Fine, so it looks like best possible solution should be draw tiles based on some DPI scale. Hmm as Petr wrote, it's not most hot topic now and I also have on first sight no idea, how to do it, anyway we will try to focus on it probably during May when I hope I'll finally have some time to look on all these "MapsForge" stuff.
Title: Re: dpi independent map/theme
Post by: Lacerta on May 20, 2016, 09:39:43
Oruxmaps has a different approaching to handle it.
It has a Mapsforge map setting option where the user can independently set the scaling of text, icon size and overall scaling.
I just guessing but likely does on the fly the same as scale= tags in the render xml.
Mabe a similar system could be also implemented in Locus.
Title: Re: dpi independent map/theme
Post by: john_percy on May 21, 2016, 11:24:40
The disadvantage of the Locus method is that requiring different zoom levels for different dpi to see the same area alters the detail seen (because of fixed zoom appear). The Orux method avoid that and something similar could presumably be built in to the renderer by detecting dpi and magnifying accordingly. However high resolution devices would display a magnified version of low resolution devices maps.