gdalwarp holsnoy.vrt holsnoy.tif gdal_translate -scale 0 500 0 255 -outsize 1000 1000 -of PNG holsnoy.tif holsnoy.png gdal_translate -scale 0 500 0 65535 -ot UInt16 -outsize 200 200 -of ENVI holsnoy.tif holsnoy.binNote that compared to the blog post, I changed the second parameter of "scale" to a smaller number. This is the min/max meters. My area had a maximum height of around 500 meters.
gdal_translate -outsize 1000 1000 -of GTiff holsnoy.tif holsnoy_small.tif gdaldem color-relief holsnoy_small.tif color-relief-holsnoy.txt -of png holsnoy-relief.pngHere is the color-relief file I used (saved as "color-relief-holsnoy.txt"):
0 80 80 255 5 110 220 110 100 240 250 160 200 230 220 170 300 220 220 220 400 250 250 250
[..] terrainLoader.load('holsnoy.bin' ... // my bin-file from above [..] geometry.vertices[i].z = data[i] / 65535 * 5; // Adjust scale of height [..] map: THREE.ImageUtils.loadTexture('holsnoy-relief.png') // my relief [..]
So here is how I did it:
las2dem laztest.laz -o laztest.ascThis however gives me a black diagonal in the resulting file as I need to have a license to work with this many las points in laz2dem. So insteaed of finding an alternative way to convert to DEM, I reduce the number of points in my las-file by thinning out my las-data using las2las. I don't need that many points for the remaining process anyway:
las2las -o laztest_thin.laz laztest.laz -keep_class 2 -keep_random_fraction 0.1Note that I also use "-keep-class 2" to only keep the ground points.
Now I can make my DEM-file (asc-format) using the following command:
las2dem laztest_thin.laz -o laztest.asc
gdalbuildvrt laztest.vrt laztest.asc gdalwarp laztest.vrt laztest.tif gdal_translate -scale 0 200 0 65535 -ot UInt16 -outsize 200 200 -of ENVI laztest.tif laztest.bin
Note that for generating nice looking hillshaded DTMs it is often it is better to first create an elevation raster in BIL format and then hillshade this raster. Why? Because shading the (often small and irregular) triangles is lightly to generate jitter and aliasing during the lighting computation of the (often instable) surface normals of the (often tiny or slivery) triangles. After rasterization onto a BIL the LiDAR gets essentially resampled and using these regular spaced points avoids all these shading irregularities. Hence instead of las2dem -i lidar.laz -keep_class 2 -hillshade -o dtm.png try running las2dem -i lidar.laz -keep_class 2 -o dtm.bil las2dem -i dtm.bil -hillshade -o dtm.png
Edit: Turns out it should be possible to work directly with xyz-files without converting from laz to dem using e.g. this or this. I won't dive into this now, but maybe later some time... Maybe one could even get the elevation data from a WMS-server like they do here. This would only give the 10m data and not the accurate elevation data used in the Pullautin generation, but would still be quite elegant. Note that it also looks like I can get the 10m data for Norway directly using vrt-files in GDAL.
Edit 2: Looking a bit further, I also found this nice service for plotting a GPS-track in Norway on a 3D map - some nice elements there also.