OruxMaps

Uncategorized Boards => MEJORAS/NEW FEATURES => Topic started by: hundundhund on March 11, 2014, 12:53:29 AM

Title: relief shading for my OpenAndroMap???
Post by: hundundhund on March 11, 2014, 12:53:29 AM
Hello,



I have a openandromap (=vector).

is it possible to relief shading over my Map.

perhaps there is a option to make this relief shading based from the .hgt-File. And then merge this with my Map?

i hope there is any solution for this problem.

srry, but my english is not so good :U



sonja
Title: Re: relief shading for my OpenAndroMap???
Post by: Maki on March 11, 2014, 11:24:39 PM
At the moment it isn't possible. But we all dream about it. :-)
Title: Re: relief shading for my OpenAndroMap???
Post by: hundundhund on March 12, 2014, 02:56:01 AM
who is the engineer who can make this`? or where can we suggest our wishes?



and i want to know if any such solution is in planing.
Title: Re: relief shading for my OpenAndroMap???
Post by: eartrumpet on March 12, 2014, 08:17:09 AM
Quote from: "hundundhund"or where can we suggest our wishes?

You can do it here - //http://www.oruxmaps.com/foro/viewforum.php?f=8 - or this thread should be moved there.



This is the major missing feature for me at the moment, and there are several ways how this could be solved:



- Generate from hgt files

- Combine offline maps - at the moment you can only combine online maps, but if you have a transparent hillshading offline map combined with another one it would be great.

- Allow PNGs in kml overlays



The main problem is probably that all those have the same projection.
Title: Re: relief shading for my OpenAndroMap???
Post by: hundundhund on March 12, 2014, 05:24:18 PM
locus has a overlay-function "hillshading". but its only online available :(

..i think the relief shading based on the .hgt-file is better. because it is the smallest and it goes offline :)





- - how can we move this thread to the other group?
Title: Re: relief shading for my OpenAndroMap???
Post by: eartrumpet on March 12, 2014, 07:46:33 PM
Quote from: "hundundhund"locus has a overlay-function "hillshading". but its only online available :(

OsmAnd has also a paid plugin which provides hillshading. I would happily buy another donate version (or more) of Oruxmaps just for this.


Quote..i think the relief shading based on the .hgt-file is better. because it is the smallest and it goes offline :)

It depends, because it has to be rendered live and would slow down your device. A transparent PNG layer also works offline, and would be the base of the other solutions.


Quote- - how can we move this thread to the other group?


Only Orux can as far as I know.
Title: Re: relief shading for my OpenAndroMap???
Post by: Maki on March 12, 2014, 10:05:31 PM
I recently asked on mapsforge-dev about the possible inclusion of hill shading in the MF library, which would allow to control it in themes. Ludwig basically declined saying "Hillshading itself is probably better left to more powerful computers with download of hillshaded background tiles. This should already be possible with the Rescue concept of transparent layers". If I get this correctly it means that with the current version of mapsforge transparent layers aren't available, so you can't draw the map on top of the shades. Doing the inverse (semitransparent hills on top of the map) would IMHO look bad since it would change the colors of everything. I'd like roads to stay constant.



Anyway IMHO .hgt would be the way to go since you can control the shade generation in detail and intensity to fit different tastes and CPUs, caching on disk for faster rendering. Pre-rendered tiles would be huge and without control.



I would happily buy another donate version (or more) of Oruxmaps too. It really changes the perception of the map.
Title: Re: relief shading for my OpenAndroMap???
Post by: panda on October 01, 2014, 12:30:07 AM
Hello,

is there an advance in this topic?



I would really enjoy this very much !  :D
Title: Re: relief shading for my OpenAndroMap???
Post by: orux on October 01, 2014, 06:08:47 PM
Quote from: "panda"Hello,

is there an advance in this topic?



I would really enjoy this very much !  :D


Hi,



It is a heavy task for an android device;



It is similar to the 'relief map' that you can activate in settings--maps. This map uses the hgt files to draw the relief.



But you can check that it is very slow, even with new deviced.





orux
Title: Re: relief shading for my OpenAndroMap???
Post by: rvb on October 01, 2014, 08:40:42 PM
there are relief shading tiles on osm maps.



i don't like them and they take more space then the maptiles.



http://wiki.openstreetmap.org/wiki/Relief_maps



you can download a map with that kind of relief.
Title: Re: relief shading for my OpenAndroMap???
Post by: eartrumpet on October 01, 2014, 10:27:36 PM
Quote from: "orux"
It is a heavy task for an android device;



It is similar to the 'relief map' that you can activate in settings--maps. This map uses the hgt files to draw the relief.



But you can check that it is very slow, even with new deviced.


I think live rendering is not necessary; a great solution would be to pre-generate relief shading overlays from hgt files in advance, comparable to the map creator.
Title: Re: relief shading for my OpenAndroMap???
Post by: Maki on October 02, 2014, 10:26:04 PM
Well, I don't find relief shading *that* slow, on a 3 years old device, but I wouldn't call it "realtime" either. Prerendering is a good idea.



Another approach, if with MF0.4 layers can indeed be transparent, is multilayer offline maps. From personal experience a DEM vith 10 meters grid is good to generate hillshading up to ZL16 with 256px tiles and up from there digital zoom is fine. Working with 30m DEM there is probably no need to go beyond ZL15 (or maybe 14) natively. Since there are no sharp transitions heavy JPEG compression can be used to keep size down without visible image degradation. So an mbtiles base layer with one Mapsforge on top could work well.
Title: Re: relief shading for my OpenAndroMap???
Post by: Maki on October 15, 2014, 01:49:34 PM
This is not to pull Jose's foot, I was just playing yesterday with this stuff and couldn't resist building a mock-up of what it can be.

(//%3C/s%3E%3CLINK_TEXT%20text=%22https://farm6.staticflickr.com/5601/153%20...%206316_z.jpg%22%3Ehttps://farm6.staticflickr.com/5601/15351324790_b1fe566316_z.jpg%3C/LINK_TEXT%3E%3Ce%3E) (//https)(//%3C/s%3E%3CLINK_TEXT%20text=%22https://farm4.staticflickr.com/3942/153%20...%20b589_z.jpg%22%3Ehttps://farm4.staticflickr.com/3942/15350798648_38fca1b589_z.jpg%3C/LINK_TEXT%3E%3Ce%3E) (//https)

Full resolution available on Flickr (click the image)



Some straight facts:

* rendering with gdaldem a 1x1 degree tile of 30m dem takes under 4 seconds on my 4 years old PC (i5 750). That's a 80x100 Km rectangle. So rendering a smaller portion on a phone could be probably done on the fly.

* the resulting .mbtiles file up to zoom level 13 takes around 5Mb, but it looks like it is already interpolated, so limiting to ZL12 could very well be under 2MB per tile, without any quality loss.



I noticed however that mixing contour lines from various sources there are differences, so generating the hillshade with one set of data and blending it with contours from another source isn't always good. So if this has to be done it's probably better to just use multilayer maps rather than rendering on the phone.
Title: Re: relief shading for my OpenAndroMap???
Post by: panda on October 16, 2014, 06:13:22 PM
Hi Maki,

this is great stuff!!



Can you give more details how you did it, I#d like to try on my own.
Title: Re: relief shading for my OpenAndroMap???
Post by: Maki on October 17, 2014, 11:17:57 PM
Hi Panda, it's a bit too long to explain in detail.

You can get elevation data from //http://www.viewfinderpanoramas.org/dem3.html and generate the hillshading with a GIS software, like //http://qgis.org.

Then you import the generated geotiff in //https://www.mapbox.com/tilemill/ and export it in mbtiles format that is recognised by OruxMaps.



If you want the quick and dirty solution you are almost done. Just take a screenshot of the map in the place you like, switch without moving to the hillshade and take another screenshot. Move the two screenshots to a PC and overlay the two in Photoshop/Gimp/Krita/whatever. Put the hillshade on top and set blending mode to "multiply" and then play with opacity. This method works, but applies the shade to everything, something that I don't particularly like.



The other approach is to split you favourite theme in two: one with the background you want to shade (typically landuse), the other with the foreground (roads, buildings etc.). Take the usual screenshots and assemble accordingly.



If you want some ready to use material grab this (my theme split in two, and a couple of shaded tiles) //https://app.box.com/s/p8ra7k4suy1jy0954kn4
Title: Re: relief shading for my OpenAndroMap???
Post by: 6745th@web.de on October 18, 2014, 08:09:40 PM
Quote from: "panda"Hi Maki,

this is great stuff!!

Can you give more details how you did it, I#d like to try on my own.


Why not just using MOBAC?

http://mobac.sourceforge.net/index.html
Title: Re: relief shading for my OpenAndroMap???
Post by: orux on October 18, 2014, 10:22:18 PM
Quote from: "Maki"Hi Panda, it's a bit too long to explain in detail.

You can get elevation data from //http://www.viewfinderpanoramas.org/dem3.html and generate the hillshading with a GIS software, like //http://qgis.org.

Then you import the generated geotiff in //https://www.mapbox.com/tilemill/ and export it in mbtiles format that is recognised by OruxMaps.



If you want the quick and dirty solution you are almost done. Just take a screenshot of the map in the place you like, switch without moving to the hillshade and take another screenshot. Move the two screenshots to a PC and overlay the two in Photoshop/Gimp/Krita/whatever. Put the hillshade on top and set blending mode to "multiply" and then play with opacity. This method works, but applies the shade to everything, something that I don't particularly like.



The other approach is to split you favourite theme in two: one with the background you want to shade (typically landuse), the other with the foreground (roads, buildings etc.). Take the usual screenshots and assemble accordingly.



If you want some ready to use material grab this (my theme split in two, and a couple of shaded tiles) //https://app.box.com/s/p8ra7k4suy1jy0954kn4


Hi,



I have been able to draw basic hill shadows:



(//%3C/s%3E%3CLINK_TEXT%20text=%22http://s1.postimg.org/bpnwlfp1r/device_%20...%20183502.png%22%3Ehttp://s1.postimg.org/bpnwlfp1r/device_2014_10_17_183502.png%3C/LINK_TEXT%3E%3Ce%3E) (//http)



And create a composite map, using the hill shadow map as background:



(//%3C/s%3E%3CLINK_TEXT%20text=%22http://s28.postimg.org/xr72dpafx/device%20...%20220403.jpg%22%3Ehttp://s28.postimg.org/xr72dpafx/device_2014_10_18_220403.jpg%3C/LINK_TEXT%3E%3Ce%3E) (//http)(//%3C/s%3E%3CLINK_TEXT%20text=%22http://s27.postimg.org/b67x8a7qr/device%20...%20220104.jpg%22%3Ehttp://s27.postimg.org/b67x8a7qr/device_2014_10_18_220104.jpg%3C/LINK_TEXT%3E%3Ce%3E) (//http)





But it needs more tests,



orux
Title: Re: relief shading for my OpenAndroMap???
Post by: Maki on October 19, 2014, 03:53:06 PM
Great, Orux!



Some observations. The map looks quite dull, because you put the hillshading below and made the foreground semitrasparent. If you reverse the things with a 20-30% opacity for the hillshading on top and 100% for the map below it gets better, but still a bit flat. If you then multiply the layers rather than just blending them the shadows are better defined and the contrast is retained (black remains black rather than turning grey). If Android standard functions don't help and you have to do the compositing by yourself, the Photoshop formula for multiply is (layer1*layer2)/256. If I have done the maths correctly the formula to multiply and lighten the shadows in one passage could be map*((hillshade*opacity)/255+1-opacity) where opacity is between 0 and 1.



To compare start from this (emulated) screenshot //https://www.flickr.com/photos/30914757@N04/15572753175/ and use the arrows to see the next two. The first is normal blending, the second is "multiply", the third the previous emulation I made.



As I said above this is just the "quick and dirty" way. The advantage is that it can be immediately applied to any map, the problem is that it changes the map colours significantly, unless you make the effect rather light. Changing colours for the background is the desired effect, but changing paths and roads in a non uniform way may pose problems since we relay (also) on colour to distinguish things. The best way to handle this (and the one I emulated in the third screenshot above) is to apply the shadowing only to the background. As you can see the shadow effect is much more evident, but still the paths and the tracks aren't obscured.



In theory that's easy, you just need a theme with a semi-transparent background. Any existing theme can be adapted very quickly. In practice there is a particular problem with OpenandroMaps, because they draw the sea below everything else. Making the map background transparent will just reveal the sea instead of the hillshading. Christian has surely a good reason to do that, but maybe he can change it. At a first look it seems that Freizeitkarte and standard Mapsforge maps don't have this problem, so if you want to do tests I can put together a transparent theme for that.
Title: Re: relief shading for my OpenAndroMap???
Post by: orux on October 19, 2014, 05:29:28 PM
Quote from: "Maki"Great, Orux!



Some observations. The map looks quite dull, because you put the hillshading below and made the foreground semitrasparent. If you reverse the things with a 20-30% opacity for the hillshading on top and 100% for the map below it gets better, but still a bit flat. If you then multiply the layers rather than just blending them the shadows are better defined and the contrast is retained (black remains black rather than turning grey). If Android standard functions don't help and you have to do the compositing by yourself, the Photoshop formula for multiply is (layer1*layer2)/256. If I have done the maths correctly the formula to multiply and lighten the shadows in one passage could be map*((hillshade*opacity)/255+1-opacity) where opacity is between 0 and 1.



To compare start from this (emulated) screenshot //https://www.flickr.com/photos/30914757@N04/15572753175/ and use the arrows to see the next two. The first is normal blending, the second is "multiply", the third the previous emulation I made.



As I said above this is just the "quick and dirty" way. The advantage is that it can be immediately applied to any map, the problem is that it changes the map colours significantly, unless you make the effect rather light. Changing colours for the background is the desired effect, but changing paths and roads in a non uniform way may pose problems since we relay (also) on colour to distinguish things. The best way to handle this (and the one I emulated in the third screenshot above) is to apply the shadowing only to the background. As you can see the shadow effect is much more evident, but still the paths and the tracks aren't obscured.



In theory that's easy, you just need a theme with a semi-transparent background. Any existing theme can be adapted very quickly. In practice there is a particular problem with OpenandroMaps, because they draw the sea below everything else. Making the map background transparent will just reveal the sea instead of the hillshading. Christian has surely a good reason to do that, but maybe he can change it. At a first look it seems that Freizeitkarte and standard Mapsforge maps don't have this problem, so if you want to do tests I can put together a transparent theme for that.


Hi, Maki,



Thanks for the information.



In the last beta I have added the option to apply hill shadows.



That version uses "multiply", it seems that the best effect is achieved.



I'll continue testing.



The first time a zone is rendered, it can be very slow, but the following times it will be faster, because the tiles with shadows are cached.





orux
Title: Re: relief shading for my OpenAndroMap???
Post by: Maki on October 19, 2014, 09:32:22 PM
Just tried it. Very, very promising...



First thoughts:

1) the light is wrong, it really should come from top left which is pretty much an industry standard. I know the sun is from south(-east) but that's not how our brain works. Lights and shadows are interpreted with reference to the situation in which we are. So, since light is usually coming from above if you light the map from below you reverse the perception of valleys and peaks. See //http://blog.thematicmapping.org/2012/06/creating-hillshades-with-gdaldem.html for some nice examples.

2) the intensity is good for low zoom levels, say 11 or below. It's way too high at higher ZL. It also depends on the terrain nature, smooth hills require a more intense effect than steep mountains where things get black fast.

3) it is a lot pixellated, at every ZL. I would expect it at higher ZL, but not at ZL 13 and below. This, combined with rendering times at different zoom levels, makes me suspect that shadow tiles are recalculated at every zoom step. According to my tests rendering at ZL12 and scaling with filters at other ZL is very fast and gives a very smooth effect without pixellation.



I don't find the rendering especially slow, but given the above, and considering that a 1x1° tile can be saved in JPEG without noticeable quality loss at around 1MB, I'd explore Tobias idea of prerendering at ZL12 and scale that. I doubt people has hundreds of DEMs on the phone, and in any case it's 4% the size of the DEM itself, so no big deal.



I think that the user should have control on the shadow intensity, because the ideal setting will depend on both the map and the area (smooth vs. rugged). Maybe a quick setting in the tweaks menu. It would also be interesting to explore the possibility of automatically changing the intensity according to zoom level, in addition to what the user sets his preference. I'm doing this with buildings, for example, that are solid black when they appear and get progressively lighter when you zoom in. It helps things stand out when they are smaller, without becoming oppressive when they are bigger.



Thanks,

Maki.
Title: Re: relief shading for my OpenAndroMap???
Post by: goosiebn on October 19, 2014, 11:20:49 PM
Would be nice for this to be an option on any map including things like Open Cycle map and the new file maps. This would mean caching the shading by itself I suppose and blending always on the fly.
Title: Re: relief shading for my OpenAndroMap???
Post by: goosiebn on October 20, 2014, 10:58:41 AM
I haven't been able to post an image yet, but there's an error in the hill shading at the following co-ordinates:

54.4972N 1.0034W



If you can tell me the name of the DEM file that would be affected, and where to send it, I could e-mail you that file.



The error is a diagonal line bisecting a rectangle, with no shading in the upper left half and in the bottom right half every other line, has hill shading, the other lines do not.  The shading/no shading rows also extends the entire column of the map above and below this diagonal.
Title: Re: relief shading for my OpenAndroMap???
Post by: Maki on October 20, 2014, 01:25:33 PM
Hi goosiebin, you are simply at a tile border. An horizontal junction would be even worse...



Commonly available DEM data is far from perfect, there are artefacts in a lot of places and especially mismatches at tile borders. If you check OpenAndroMaps or OpenCycleMaps contour lines in the same situation you'll easily find mismatches there too (obviously since those are calculated from the same dataset).



The artefacts we are seeing in Oruxmaps are probably due to interpolation at higher zoom levels since they do not show at ZL13 and below. That's part of  the reasons why I say to render at ZL12 and just scale up and down. You can't expect photo-realistic results from DEM data and in any case hillshading doesn't have to be photo-realistic to begin with. It just serves the purpose of guiding our brain into interpreting the contours.



Also keep in mind that currently the shading is very intense, so any defect is immediately visible, with a lower opacity it would be a lot less objectionable.
Title: Re: relief shading for my OpenAndroMap???
Post by: goosiebn on October 20, 2014, 03:40:10 PM
Quote from: "Maki"Hi goosiebin, you are simply at a tile border. An horizontal junction would be even worse...



Commonly available DEM data is far from perfect, there are artefacts in a lot of places and especially mismatches at tile borders. If you check OpenAndroMaps or OpenCycleMaps contour lines in the same situation you'll easily find mismatches there too (obviously since those are calculated from the same dataset).



The artefacts we are seeing in Oruxmaps are probably due to interpolation at higher zoom levels since they do not show at ZL13 and below. That's part of  the reasons why I say to render at ZL12 and just scale up and down. You can't expect photo-realistic results from DEM data and in any case hillshading doesn't have to be photo-realistic to begin with. It just serves the purpose of guiding our brain into interpreting the contours.



Also keep in mind that currently the shading is very intense, so any defect is immediately visible, with a lower opacity it would be a lot less objectionable.

No, it's worse than that. When I get the screenshot uploaded. It's like an overflow in calculations that rolls over into subequent rows, diagonally. Up and down the column above the error some problem persists as every other row is rendered as flat, between fully hill shaded rows. It'll be an error in the DEM file that doesn't show in the regular colourised version, but due to the more complex calculations and near neghbouring data comparisons required for hill shading, this error is overflowing and becoming a huge abberation. I suppose yes the error could be a mismach at a file border, but the overflow could do with being looked at.
Title: Re: relief shading for my OpenAndroMap???
Post by: goosiebn on October 20, 2014, 04:20:41 PM
There are some other clusters of single pixel artifacts with very high cotrast. This is happening around negative values of elevation.
Title: Re: relief shading for my OpenAndroMap???
Post by: orux on October 20, 2014, 04:59:53 PM
Quote from: "Maki"Just tried it. Very, very promising...



First thoughts:

1) the light is wrong, it really should come from top left which is pretty much an industry standard. I know the sun is from south(-east) but that's not how our brain works. Lights and shadows are interpreted with reference to the situation in which we are. So, since light is usually coming from above if you light the map from below you reverse the perception of valleys and peaks. See //http://blog.thematicmapping.org/2012/06/creating-hillshades-with-gdaldem.html for some nice examples.

2) the intensity is good for low zoom levels, say 11 or below. It's way too high at higher ZL. It also depends on the terrain nature, smooth hills require a more intense effect than steep mountains where things get black fast.

3) it is a lot pixellated, at every ZL. I would expect it at higher ZL, but not at ZL 13 and below. This, combined with rendering times at different zoom levels, makes me suspect that shadow tiles are recalculated at every zoom step. According to my tests rendering at ZL12 and scaling with filters at other ZL is very fast and gives a very smooth effect without pixellation.



I don't find the rendering especially slow, but given the above, and considering that a 1x1° tile can be saved in JPEG without noticeable quality loss at around 1MB, I'd explore Tobias idea of prerendering at ZL12 and scale that. I doubt people has hundreds of DEMs on the phone, and in any case it's 4% the size of the DEM itself, so no big deal.



I think that the user should have control on the shadow intensity, because the ideal setting will depend on both the map and the area (smooth vs. rugged). Maybe a quick setting in the tweaks menu. It would also be interesting to explore the possibility of automatically changing the intensity according to zoom level, in addition to what the user sets his preference. I'm doing this with buildings, for example, that are solid black when they appear and get progressively lighter when you zoom in. It helps things stand out when they are smaller, without becoming oppressive when they are bigger.



Thanks,

Maki.


Hi, Maki;



about ligth, you are right, changed to left-top.



about pixelation;



if you have DEM files with 30 mts. resolution, check your 'settings--maps--relief map--Relief map, resolution'. Try with 'high' or 'very high'.



Delete first the raster cache in 'settings--maps--reset raster cache'.





orux
Title: Re: relief shading for my OpenAndroMap???
Post by: Maki on October 20, 2014, 10:17:23 PM
It gets better, but it is very slow, way too slow and I still see the pixels. I tried the various settings and IMHO "medium-low" is detailed enough and plenty fast. It mostly needs to be blurred and especially toned down. Too much detail is actually detrimental, and high contrast makes pixelation more visible. I worry about the performance hit that could arise from blurring, though.
Title: Re: relief shading for my OpenAndroMap???
Post by: Quercus.JB on October 21, 2014, 03:02:02 PM
Quote from: "orux"
Quote from: "Maki"Just tried it. Very, very promising...



First thoughts:

1) the light is wrong, it really should come from top left which is pretty much an industry standard. I know the sun is from south(-east) but that's not how our brain works. Lights and shadows are interpreted with reference to the situation in which we are. So, since light is usually coming from above if you light the map from below you reverse the perception of valleys and peaks. See //http://blog.thematicmapping.org/2012/06/creating-hillshades-with-gdaldem.html for some nice examples.

2) the intensity is good for low zoom levels, say 11 or below. It's way too high at higher ZL. It also depends on the terrain nature, smooth hills require a more intense effect than steep mountains where things get black fast.

3) it is a lot pixellated, at every ZL. I would expect it at higher ZL, but not at ZL 13 and below. This, combined with rendering times at different zoom levels, makes me suspect that shadow tiles are recalculated at every zoom step. According to my tests rendering at ZL12 and scaling with filters at other ZL is very fast and gives a very smooth effect without pixellation.



I don't find the rendering especially slow, but given the above, and considering that a 1x1° tile can be saved in JPEG without noticeable quality loss at around 1MB, I'd explore Tobias idea of prerendering at ZL12 and scale that. I doubt people has hundreds of DEMs on the phone, and in any case it's 4% the size of the DEM itself, so no big deal.



I think that the user should have control on the shadow intensity, because the ideal setting will depend on both the map and the area (smooth vs. rugged). Maybe a quick setting in the tweaks menu. It would also be interesting to explore the possibility of automatically changing the intensity according to zoom level, in addition to what the user sets his preference. I'm doing this with buildings, for example, that are solid black when they appear and get progressively lighter when you zoom in. It helps things stand out when they are smaller, without becoming oppressive when they are bigger.



Thanks,

Maki.


Hi, Maki;



about ligth, you are right, changed to left-top.



about pixelation;



if you have DEM files with 30 mts. resolution, check your 'settings--maps--relief map--Relief map, resolution'. Try with 'high' or 'very high'.



Delete first the raster cache in 'settings--maps--reset raster cache'.





orux

hola a todos, he realizado todo lo que indicas y este es el resultado:(//%3C/s%3E%3CURL%20url=%22http://tapatalk.imageshack.com/v2/14/10/21/317b3fc87c083bf24a2c3edc8a863d52.jpg%22%3E%3CLINK_TEXT%20text=%22http://tapatalk.imageshack.com/v2/14/10%20...%20863d52.jpg%22%3Ehttp://tapatalk.imageshack.com/v2/14/10/21/317b3fc87c083bf24a2c3edc8a863d52.jpg%3C/LINK_TEXT%3E%3C/URL%3E%3Ce%3E) ¿Que puedo hacer? gracias



Enviado desde mi LG-E460 mediante Tapatalk
Title: Re: relief shading for my OpenAndroMap???
Post by: goosiebn on October 21, 2014, 03:57:31 PM
This is the overflow screenshot:

(//%3C/s%3E%3CURL%20url=%22http://tapatalk.imageshack.com/v2/14/10/21/057dbb1c8577a1e7ca0249e999d5370b.jpg%22%3E%3CLINK_TEXT%20text=%22http://tapatalk.imageshack.com/v2/14/10%20...%20d5370b.jpg%22%3Ehttp://tapatalk.imageshack.com/v2/14/10/21/057dbb1c8577a1e7ca0249e999d5370b.jpg%3C/LINK_TEXT%3E%3C/URL%3E%3Ce%3E)



This is the negative height high contrast issue:

(//%3C/s%3E%3CURL%20url=%22http://tapatalk.imageshack.com/v2/14/10/21/09a8b92547571d566a7fc750e362604b.jpg%22%3E%3CLINK_TEXT%20text=%22http://tapatalk.imageshack.com/v2/14/10%20...%2062604b.jpg%22%3Ehttp://tapatalk.imageshack.com/v2/14/10/21/09a8b92547571d566a7fc750e362604b.jpg%3C/LINK_TEXT%3E%3C/URL%3E%3Ce%3E)
Title: Re: relief shading for my OpenAndroMap???
Post by: Maki on October 21, 2014, 11:05:47 PM
The overflow is the same I see at every tile border. It's much worse in mountain areas and at horizontal borders. The negative height high contrast is probably due to DEM errors, you can't do much about them. That would actually be one advantage of rendering offline on a PC, since this stuff can easily be fixed with an image editor when found. On the other side you'd have to manage multilayer maps.



I made another simulation, this time using Oruxmaps generated hillshading at "medium-low" setting. I inverted the image to compensate for the wrong lightning and rebalanced it since it become too dark. I then applied a 10 px radius gaussian blur and multiplied at around 40% opacity. Just enough to see the reliefs, not enough to screw up the colors; and no pixels in sight even at 1:1.

The flat one //https://www.flickr.com/photos/30914757@N04/15592384171/in/photostream/

The shadowed one //https://www.flickr.com/photos/30914757@N04/14974311384/in/photostream/
Title: Re: relief shading for my OpenAndroMap???
Post by: goosiebn on October 22, 2014, 08:03:00 AM
Quote from: "Maki"The overflow is the same I see at every tile border.

Ah, yes, I see the repetition of this now.
Quote from: "Maki"The negative height high contrast is probably due to DEM errors

I think that's what's commonly known as 'below sea level' ;)



If we're discussing cotrast, I find 'sombreadohikebike' to be particularly good, from this post:

//http://www.oruxmaps.com/foro/viewtopic.php?t=1183



Much like the demo we've seen in Oruxmaps, there's a general light grey cast to the relief to allow room in the pallete for highlights as well as shade.
Title: Re: relief shading for my OpenAndroMap???
Post by: orux on October 23, 2014, 08:16:50 PM
Quote from: "goosiebn"
Quote from: "Maki"The overflow is the same I see at every tile border.

Ah, yes, I see the repetition of this now.
Quote from: "Maki"The negative height high contrast is probably due to DEM errors

I think that's what's commonly known as 'below sea level' ;)



If we're discussing cotrast, I find 'sombreadohikebike' to be particularly good, from this post:

//http://www.oruxmaps.com/foro/viewtopic.php?t=1183



Much like the demo we've seen in Oruxmaps, there's a general light grey cast to the relief to allow room in the pallete for highlights as well as shade.


Hi,



thanks for your help.



I think that we are near the final version :P



There is a new beta.



'overflow' problem solved, I hope.



changed light orientation.



added some blur effect. It seems to work fine till ZL16 more or less, but below this level the effect is not good because it is applied to each tile, and the junctions of each tile to the next, the effect is not good.



remember to delete render cache before testing the new version.





(//%3C/s%3E%3CLINK_TEXT%20text=%22http://s28.postimg.org/vbi7jbpdp/device%20...%20200126.jpg%22%3Ehttp://s28.postimg.org/vbi7jbpdp/device_2014_10_23_200126.jpg%3C/LINK_TEXT%3E%3Ce%3E) (//http)



orux
Title: Re: relief shading for my OpenAndroMap???
Post by: goosiebn on October 23, 2014, 09:11:11 PM
Quote from: "orux"'overflow' problem solved, I hope.


Hi Orux,



The below sea level bug is still there. Very high contrast areas around negative altitudes.
Title: Re: relief shading for my OpenAndroMap???
Post by: 6745th@web.de on October 23, 2014, 09:14:18 PM
Now the relief shading looks very good for me.
Title: Re: relief shading for my OpenAndroMap???
Post by: goosiebn on October 23, 2014, 09:18:28 PM
Quote from: "orux"'overflow' problem solved, I hope.


Almost. I've managed to find an example of it:

(//%3C/s%3E%3CURL%20url=%22http://tapatalk.imageshack.com/v2/14/10/23/6e75caaf6834f815e65990f157466c4b.jpg%22%3E%3CLINK_TEXT%20text=%22http://tapatalk.imageshack.com/v2/14/10%20...%20466c4b.jpg%22%3Ehttp://tapatalk.imageshack.com/v2/14/10/23/6e75caaf6834f815e65990f157466c4b.jpg%3C/LINK_TEXT%3E%3C/URL%3E%3Ce%3E)
Title: Re: relief shading for my OpenAndroMap???
Post by: orux on October 23, 2014, 09:55:20 PM
Quote from: "goosiebn"
Quote from: "orux"'overflow' problem solved, I hope.


Almost. I've managed to find an example of it:




Hmmm,



sorry, the patch wasn't applied correctly.



Try with last beta34b version. Remember to delete first the raster cache.



Which is the resolution of the DEM files you use, 30 mts.?



orux
Title: Re: relief shading for my OpenAndroMap???
Post by: goosiebn on October 23, 2014, 10:10:59 PM
Quote from: "orux"
Quote from: "goosiebn"
Quote from: "orux"'overflow' problem solved, I hope.


Almost. I've managed to find an example of it:




Hmmm,



sorry, the patch wasn't applied correctly.



Try with last beta34b version. Remember to delete first the raster cache.



Which is the resolution of the DEM files you use, 30 mts.?



orux

Not sure, it's not the flaky highest resolution, so it may be the 3 arc second data?



Below sea level:



(//%3C/s%3E%3CURL%20url=%22http://tapatalk.imageshack.com/v2/14/10/23/8101f674c9806b091fa52cc0659027a0.jpg%22%3E%3CLINK_TEXT%20text=%22http://tapatalk.imageshack.com/v2/14/10%20...%209027a0.jpg%22%3Ehttp://tapatalk.imageshack.com/v2/14/10/23/8101f674c9806b091fa52cc0659027a0.jpg%3C/LINK_TEXT%3E%3C/URL%3E%3Ce%3E)
Title: Re: relief shading for my OpenAndroMap???
Post by: Maki on October 24, 2014, 09:00:58 PM
I tried beta 34b. The overflow problem seems mostly gone for vertical seams, horizontal ones are still imperfect, but I think it's the DEM data, since in the same place contour lines in OAM go wild. Good news.



The shading looks ok-ish on low angle terrain but, when you move to the mountains, steep south-facing slopes go almost black; outdoors the map is unreadable. There is no way that a single setting works for everyone everywhere. There really should be a setting for opacity.



Ditto for the blur, it's ok for low contrast areas, but in high contrast ones it gets blotchy, sometimes it's even disturbing. I suppose you kept the blur radius low to reduce the seam visibility, which is still a problem in the aforementioned areas. There is a better solution, if you can implement it without rewriting the whole app. Basically you need a buffer area around the tile that is calculated but not shown (render, blur, then crop). The overhead generated by this technique can be reduced with metatiles, to use MapBox lingo. See //https://www.mapbox.com/tilemill/docs/guides/metatiles/. In this way you can use a larger radius and still completely avoid the seams.



Nice work, thanks.



Maki
Title: Re: relief shading for my OpenAndroMap???
Post by: orux on October 26, 2014, 07:41:13 PM
Hello,



updated beta 36;



I think that there are no more 'black holes' near the sea.





orux
Title: Re: relief shading for my OpenAndroMap???
Post by: goosiebn on October 26, 2014, 08:01:07 PM
Quote from: "orux"Hello,



updated beta 36;



I think that there are no more 'black holes' near the sea.





orux

Yeah, looks ok for below sea level stuff.
Title: Re: relief shading for my OpenAndroMap???
Post by: eartrumpet on October 29, 2014, 02:56:56 PM
Thanks for adding relief shading, I really like that!

But I have to agree with Maki, it's too dark for the mountains, so opacity/brightness settings would be very welcome!
Title: Re: relief shading for my OpenAndroMap???
Post by: 6745th@web.de on October 29, 2014, 06:56:16 PM
Wouldn't it be good, if we can switch relief on/off without cleaning cache? Maybe with 2 caches, one for relief, one for normal maps. And a button for easy switch on/off relief shading.

Outdoor without relief for maximum brightness,

While tour planning with relief for nice maps.

Just a idea,

Thomas
Title: Re: relief shading for my OpenAndroMap???
Post by: panda on October 29, 2014, 07:50:15 PM
Hello Orux,

the relief shading is really great, you did a super job here, thank you!



In my home region it works good until ZL 15 with 3" DEM-files, in the alps it works good until ZL 14 with 1" DEM files.

In flat regions  with normally white background it's a bit too grey for my impression. So agree with maki and eartrumpet, that settings for that could be useful.



@Thomas: I use different profiles for that. But you have to quit om and restart to take effect.



panda
Title: Re: relief shading for my OpenAndroMap???
Post by: orux on October 29, 2014, 08:11:16 PM
Quote from: "6745th@web.de"Wouldn't it be good, if we can switch relief on/off without cleaning cache? Maybe with 2 caches, one for relief, one for normal maps. And a button for easy switch on/off relief shading.

Outdoor without relief for maximum brightness,

While tour planning with relief for nice maps.

Just a idea,

Thomas


Hi, Thomas;



the mapsforge and the relief are cached in different files. You don't need to restart the cache if you want to change to no relief mode. But currently requires a map reload.



It is difficult to find the right parameters.



I will add a new setting, the minimum/maximum zoom level to apply hill shading, and a fast mode to change without needing of map reload.





orux
Title: Re: relief shading for my OpenAndroMap???
Post by: 6745th@web.de on October 30, 2014, 06:56:19 PM
Quote from: "orux"
Hi, Thomas;

the mapsforge and the relief are cached in different files. You don't need to restart the cache if you want to change to no relief mode. But currently requires a map reload.



I will add a new setting, the minimum/maximum zoom level to apply hill shading, and a fast mode to change without needing of map reload.

orux


Thats Great, thanks Orux.



@panda:

Using the Profiles is also a good idea, but when Orux give us the new Functions it is the best Solution.
Title: Re: relief shading for my OpenAndroMap???
Post by: panda on November 01, 2014, 09:05:56 PM
Hi Orux,

I just like to ask: is there a reason why hillshading is only added to mapsforge maps?



I also use garmin maps and the contourlines there are very thin and hard to see, so applying hillshade to that would improve

the information about heights and elevation.
Title: Re: relief shading for my OpenAndroMap???
Post by: Maki on November 02, 2014, 09:47:28 PM
Quote from: "orux"It is difficult to find the right parameters.orux


I can't be sure since I don't know the internals, but I think that the source of the difficulties is the separate rendering for each zoom level. Ideally hillshading should be rendered at the native DEM resolution and then just scaled up/down with a simple bilinear interpolation. Doing so the result is a very smooth yet detailed rendering at every ZL, the only needed setting is opacity, which is best left to the user due to variance in people tastes and map theme contrast.



The current system needs gaussian blur to work around pixelation, but there is no way you can find an ideal setting for every DEM out there (with different grid distances), and you have to chose between blotchy rendering or seams at the edges.



Maki
Title: Re: relief shading for my OpenAndroMap???
Post by: eartrumpet on November 04, 2014, 12:33:10 PM
I looked at other maps, which are of course not on the fly generated but from tile servers, so it's a slightly invalid comparison.



But to get the idea why I think the hill shading is too dark at the moment and also too detailed I made this comparison:



(//%3C/s%3Ehttp://s27.postimg.org/nmxzu408v/hillshade.jpg%3Ce%3E) (//http)



I included also the darkest hill shading of other maps I could find which is hike bike maps and google terrain.



But also these are more blurred and less detailed.

I think the hill shading is a bit too distracting at the moment, I personally prefer a light one which only helps the user to see slopes and hills, but shouldn't be as humpy as it is now.



So more blur and more opacity as in 4umaps, outdooractive or opencyclemap would be very welcome!

Thanks again for your efforts.
Title: Re: relief shading for my OpenAndroMap???
Post by: orux on November 04, 2014, 07:45:48 PM
Hi all;



I will try to modify the curve I use to give value to each pixel color. Currently it is very simple, is proportional to the cosine of the angle between the normal to the plane with the inclination of the light source. I do this to avoid complex computations, but may consider other formulas.



Then OruxMaps uses multiplication of both layers, using the android native libraries, so I do not know if I can apply some transparency to the shadow layer before.



Currently, the default configuration does not apply shadows, so normal users will not be affected because they will see the mapsforge maps as usual.



Later I will apply the shadows to all types of maps, now it's an experiment.



It is difficult to implement the solution to generate the shadows to the native resolution of the DEM file, and then applied to the corresponding tile.



Perhaps the best solution is to have one or more sqlite maps with shadows applied, and make the composition with the other maps at rendering time.



orux
Title: Re: relief shading for my OpenAndroMap???
Post by: Maki on November 04, 2014, 11:22:43 PM
Hi Orux,



I have some knowledge, but I'm not a coder, so while I understand the processing limits on a portable device I don't know exactly what happens and what can or cannot be done. However, reasoning on what I see and comparing to my (very limited) GIS experience I don't think the situation is bad at all.



The formula seems ok to me. If you compare the screenshots from Tobias you'll see that's perfectly good in terms of shading. The OM shading looks a lot noisier than the others, but so are contour lines. Tobias is probably using 30m DEMs and the Alps OAM that is based on the same DEMs. The others are probably using 90m DEMs with corresponding contour lines, surely they are smoother, but it's the source data in itself. Plus, yes, they are probably post-processed, but commonly available 30m DEMs have a lot of problems, and they show.



Note also that Google shadows aren't actually that much lighter than yours, but they can take advantage of the fact that roads are drawn on top of the shadow and remain legible also on SE slopes. Unfortunately you can't do that right now, not with OAM at least.



I don't know if there is a direct way to set opacity when doing the multiplication in Android. But in a worst case scenario you can simply lighten up the shadow before the multiplication. I'm doing it right now in Tilemill, if you just translate the 0-255 range to 128-255, the effect is the same as a 50% opacity.


QuotePerhaps the best solution is to have one or more sqlite maps with shadows applied, and make the composition with the other maps at rendering time.


I think that could be a viable solution. The disadvantage is that the user has to manage one more thing, but rendering and postprocessing on a PC gives more opportunities. And in a later phase you can always pre-render those shadow maps on the phone.



Thanks, Maki
Title: Re: relief shading for my OpenAndroMap???
Post by: eartrumpet on November 05, 2014, 10:12:57 AM
I agree with Maki, the shading is already pretty good, there is only some fine tuning which is still needed. I think Makis idea with a different luminosity range is probably a good solution for the dark slopes.



Maki, you're right, I'm using 1'' DEM data from viewfinderpanorama where available; 3'' DEM looks better for this usage. But it's possible to make 1'' data look good too:



I played a bit around with 1'' and 3'' data and various setting for Relief map resolution, and it seems that with low to very very low settings 1'' looks better, at least at higher zoom levels. Medium to very high don't make much difference to me, all not very pretty for 1'' DEM at level 15.



So smoothing is already kind of included (ZL15):

(//%3C/s%3Ehttp://s24.postimg.org/hkl7vjbcx/hillshade_settings.jpg%3Ce%3E) (//http)



But very very low isn't working well at lower zoom levels (ZL11):

(//%3C/s%3E%3CLINK_TEXT%20text=%22http://s29.postimg.org/69rpb0z2b/hillsh%20...%20tings2.jpg%22%3Ehttp://s29.postimg.org/69rpb0z2b/hillshade_settings2.jpg%3C/LINK_TEXT%3E%3Ce%3E) (//http)



So maybe splitting up relief map resolution settings in two separate settings for high and low zoom levels and a custom value where high begins would solve the smoothing problem for 1'' DEM data, and it wouldn't hurt for 3'' DEM data as well.
Title: Re: relief shading for my OpenAndroMap???
Post by: orux on November 05, 2014, 07:19:59 PM
Hi,



using color values from 64 to 255:



(//%3C/s%3E%3CLINK_TEXT%20text=%22http://s30.postimg.org/p83hinpfl/device%20...%20182133.jpg%22%3Ehttp://s30.postimg.org/p83hinpfl/device_2014_11_05_182133.jpg%3C/LINK_TEXT%3E%3Ce%3E) (//http)





orux
Title: Re: relief shading for my OpenAndroMap???
Post by: 6745th@web.de on November 05, 2014, 07:43:09 PM
Great!

Thank you all for the professional team working :-)
Title: Re: relief shading for my OpenAndroMap???
Post by: eartrumpet on November 05, 2014, 10:27:26 PM
Quote from: "orux"Hi,



using color values from 64 to 255:




Thanks, looks very promising!
Title: Re: relief shading for my OpenAndroMap???
Post by: Maki on November 16, 2014, 09:01:42 PM
Eventually it quit raining and I could test outdoors after playing at home. I think it is still a bit dark especially with low contrast themes, but still way better than before. Making it lighter also makes the imperfections less visible.



I tried with 3" DEMs and it's much smoother, as expected, but it's not because of the lower resolution, it's just that commonly available 1" DEMs are full of artefacts. I made hillshadings from high quality 10m DTM (in QGIS) and they are silky smooth, yet detailed. The problem is that it turns out to be impossible to find a settings that works well across a wide range of zoom levels, but I have to say that when everything matches (no visible seams) the result is very good, so very promising.



One problem I'm seeing is green blotches, especially at higher zoom levels. Those are usually masked by patterns where there is some land-use, but on poorly mapped areas I find them annoying. Maybe a too aggressive JPEG compression artefact?
Title: Re: relief shading for my OpenAndroMap???
Post by: valleyofdawn on November 18, 2014, 07:49:57 AM
For those of us who haven't been following can you give us shortcuts on how to get this wonderful feature?

Thanks!
Title: Re: relief shading for my OpenAndroMap???
Post by: Maki on November 18, 2014, 08:04:54 AM
Quote from: "valleyofdawn"For those of us who haven't been following can you give us shortcuts on how to get this wonderful feature?

Thanks!


It's all explained in this thread, except maybe the source for DEMs, that you can download, amongst others, from //http://viewfinderpanoramas.org/. Unzip and copy them in the "dem" folder, inside the "oruxmaps" folder on your phone. Then activate hillshading in the Mapsforge preference panel, and tweak the parameters in the "relief map" panel.
Title: Re: relief shading for my OpenAndroMap???
Post by: valleyofdawn on November 18, 2014, 08:31:58 AM
Found it. Wonderful, thanks.

Actually oruxmas automatically downloaded the local DEM data the first time I asked for a 3D map.

Is the quality of that data source inferior to what you are suggesting?
Title: Re: relief shading for my OpenAndroMap???
Post by: Maki on November 18, 2014, 09:36:29 PM
I don't know what OM downloads, so I can't answer. But I think the original source is mostly the same for all suppliers.