Avoid sign flip computation

pull/1584/head
Piero Toffanin 2025-01-11 17:19:39 -05:00
rodzic e89c838aa2
commit 35c191efe4
3 zmienionych plików z 2 dodań i 8 usunięć

Wyświetl plik

@ -71,12 +71,6 @@ class LightSource:
A 2d array of illumination values between 0-1, where 0 is
completely in shadow and 1 is completely illuminated.
"""
# Because most image and raster GIS data has the first row in the array
# as the "top" of the image, dy is implicitly negative. This is
# consistent to what `imshow` assumes, as well.
dy = -dy
# compute the normal vectors from the partial derivatives
e_dy, e_dx = np.gradient(vert_exag * elevation, dy, dx)

Wyświetl plik

@ -465,7 +465,7 @@ class Tiles(TaskNestedView):
_("Cannot compute hillshade of non-elevation raster (multiple bands found)"))
delta_scale = (maxzoom + ZOOM_EXTRA_LEVELS + 1 - z) ** 2
dx = src.dataset.meta["transform"][0] * delta_scale
dy = -src.dataset.meta["transform"][4] * delta_scale
dy = src.dataset.meta["transform"][4] * delta_scale
ls = LightSource(azdeg=315, altdeg=45)
# Remove elevation data from edge buffer tiles

Wyświetl plik

@ -235,7 +235,7 @@ def export_raster(input, output, **opts):
if hillshade is not None and hillshade > 0:
delta_scale = ZOOM_EXTRA_LEVELS ** 2
dx = src.meta["transform"][0] * delta_scale
dy = -src.meta["transform"][4] * delta_scale
dy = src.meta["transform"][4] * delta_scale
ls = LightSource(azdeg=315, altdeg=45)
intensity = ls.hillshade(arr[0], dx=dx, dy=dy, vert_exag=hillshade)
intensity = intensity * 255.0