0

I have my OSM data in a local server. I already done with the contour lines using Phyghtmap and achieve a good result.

Now I'm trying to show the relief "shadows" like this beautiful map:enter image description here

I know it is not OSM data, just some kind of transparent PNG layer, but I don't know how to create it...

EDIT

By reading this I'm now able to convert my HGT files downloaded by Phyghtmap to GeoTIFF but it have a very bad resolution...

enter image description here

Ian Turton
  • 81,417
  • 6
  • 84
  • 185
Magno C
  • 2,140
  • 3
  • 24
  • 63
  • Hillshade is the term for it. What software do you have available? There's a tutorial for QGIS https://ieqgis.wordpress.com/2015/04/04/create-great-looking-topographic-maps-in-qgis-2/ but if you have Esri you can use the Hillshade tool http://resources.arcgis.com/en/help/main/10.2/index.html#//009z000000v0000000 or as display property of the DEM. – Michael Stimson May 30 '17 at 00:26
  • Thanks for give me the correct term. I have PostGIS + Geoserver – Magno C May 30 '17 at 00:27
  • Have you some tips on create it using Geoserver layers? – Magno C May 30 '17 at 00:30
  • You can also create a hillshade with GDAL, tutorial here https://github.com/clhenrick/gdal_hillshade_tutorial with the GDALDEM command. I would create a static raster with the same resolution (or a bit coarser) as the DEM to be consumed by the server; I'm definitely not an expert on GeoServer, I wouldn't even venture an opinion on that, but PostGIS should have some GDAL functionality inbuilt. – Michael Stimson May 30 '17 at 00:30
  • It is a complex tutorial and involving a lot of "by hand" steps... still searching... – Magno C May 30 '17 at 00:41
  • 1
    See TopOSM for rendering shaded relief https://github.com/Ahlzen/TopOSM the code is https://github.com/Ahlzen/TopOSM/blob/master/prep_toposm_data using gdal – Mapperz May 30 '17 at 00:53
  • Thanks @Mapperz. I'll try it. I think I'll spend a lot of time to understand the code and what kind of files I must serve to it (and where to find them). The Phyghtmap contour creator is very easy because all I must to do is give the bounding box and it will download all HGT files from NASA...any chance to use these HGT files? – Magno C May 30 '17 at 00:58
  • Well... now I can convert my HGT files to TIF... https://thangbui.wordpress.com/2012/06/24/create-map-tiles-from-srtm-data-gdal-and-imagemagick/ but the results are not very good... see my edit. – Magno C May 30 '17 at 01:19

2 Answers2

1

You can use gdaldem hillshade to create hillshades.

This command outputs an 8-bit raster with a nice shaded relief effect. It’s very useful for visualizing the terrain. You can optionally specify the azimuth and altitude of the light source, a vertical exaggeration factor and a scaling factor to account for differences between vertical and horizontal units.

The value 0 is used as the output nodata value.

The following specific options are available :

-z zFactor:
vertical exaggeration used to pre-multiply the elevations
-s scale:
ratio of vertical units to horizontal. If the horizontal unit of the source DEM is degrees (e.g Lat/Long WGS84 projection), you can use scale=111120 if the vertical units are meters (or scale=370400 if they are in feet)
-az azimuth:
azimuth of the light, in degrees. 0 if it comes from the top of the raster, 90 from the east, ... The default value, 315, should rarely be changed as it is the value generally used to generate shaded maps.
-alt altitude:
altitude of the light, in degrees. 90 if the light comes from above the DEM, 0 if it is raking light.
-combined:
(starting with GDAL 1.10) combined shading, a combination of slope and oblique shading.
-multidirectional:
(starting with GDAL 2.2) multidirectional shading, a combination of hillshading illuminated from 225 deg, 270 deg, 315 deg, and 360 deg azimuth.

The result you show in your EDIT is an expected result. However, the shade effect is very stark, which is probably not what you want for an overlay. To get a lighter/smoother result, make sure you have the correct -s factor set for your source height data, and then use the -z factor to tweak the vertical exaggeration.

Alternatively, you can use regular image manipulation to smoothen the image to produce an overlay that is pleasant for your usecase.

Senshi
  • 1,767
  • 1
  • 9
  • 22
  • Hum..promising. Can I use my HGT or TIFF files? I don't like to download other stuff again... – Magno C May 30 '17 at 11:33
  • This is what I need, but now I have other question: https://gis.stackexchange.com/questions/242516/losing-resolution-of-my-dem-tiff-when-converting-from-hgt?noredirect=1#comment379187_242516 – Magno C Jun 02 '17 at 18:10
1

I'd say use gdaladdo like others suggested, the ugly look is probably due to high z exxageration and too high resolution... try with a smaller z factor, and then add overviews to the output, that might help (otherwise, you'll need to find a too to perform an interpolation pass even on the native resolution, you might want to look at https://mapzen.com/blog/terrain-generalization/ )

Then, import it in GeoServer and use multiply compositing to get a good looking result when merging it with your base map.

Andrea Aime
  • 17,410
  • 1
  • 18
  • 28
  • I'm use z factor as 1 (one). I'm almost there, but now I'm facing a resolution problem. See other question: https://gis.stackexchange.com/questions/242516/losing-resolution-of-my-dem-tiff-when-converting-from-hgt?noredirect=1#comment379187_242516 – Magno C Jun 02 '17 at 18:10