When trying to draw adjacent raster files, to achieve smooth hillshading using more then one raster, there is missalignment.
The problem is conversion from range extend in float values to int image position and height. I.e. 399.999999998 goes to 399 and in effect, two adjacent rasters are misalignment even in perfect conditions.
I attached fix, that uses rounding using:
This way, it is possible to use multiple rasters to cover area with only little artifacts coming from interpolation (unable to predict next value on edge).
Unfortunatelly, when interpolating scaled version, there are still possible small artefacts, that can be explained with this simple
With one big raster You have:
Source: A C E G I K
Scaled: A b C d E f G h I j K ?
and with two adjacent rasters:
Source: A C E | G I K
Scaled: A b C d E ? | G h I j K ?
f would be E+G/2, but in second case, G is unknown in first raster, so
interpolation could assigns only value E (same with K in both cases).
Solution to this would be using multiple raster files in one Layer, and
scaling/composing merge of all in actual projection window. Now I have
to create separate layer for each tiff.
Another solution would be passing one pixel wider/higher image to scaling and additional row/column would be then used only to handle interpolation at edge. Also rasters should be provided with 1px overlaping then for this to work.
[mar_rud] Sample geotiff rasters and more comparision images at:[[BR]]
image2_*a.png are made from merged hlt.tif, hrt.tif files using:[[BR]]
gdal_merge.py hlt.tif hrt.tif -o merged.tif
[springmeyer] Marcin, this looks great.
My only thought is whether a similar tweak will be needed to the Raster input plugin as you have made to the gdal plugin.
I will let Artem take a look at this before applying, but great patch!
[springmeyer] Thanks Marcin!
Artem ok'd in #mapnik and I've applied in r1079