Repository navigation
Keep NoData transparent in the documented hillshade colour-relief pipeline - #732
borismasis wants to merge 4 commits into
Conversation
|
Hi, Thanks for this MR. However, before reviewing it it would help me have a bit more context on how you noticed this issue and what lead you to fix it. The tests fixtures are not real world examples, and no screenshot is attached. The hillshades documentation is heavily based on OpenTopoMap, which likely has the same behavior/issue: https://github.com/der-stefan/OpenTopoMap/blob/master/mapnik/HOWTO_DEM.md. Additionally, since it is rather obvious a large part of this contribution is AI-assisted, I would welcome a disclaimer about it and more details on what work was contributed by AI and what is the human contribution/oversight about it. Thanks |
|
Thanks for asking for this context. The connection between the observed site issue and this patch needs to be stated more explicitly, and the AI-assistance disclosure should have been included from the start. What prompted the investigationBoris reported a broad black gradient when viewing the full CyclOSM basemap over Europe at about map zoom 3.185, centered on approximately 43.07915 N, 14.28667 E. The viewport requests z4 raster tiles. We isolated the basemap from the application overlays: the gradient was already in the provider-delivered PNGs, and remained with those overlays removed. These are the real-world images that prompted the investigation, not outputs of the synthetic test: At the time of capture (12 November 2026), their SHA-256 values were Why this particular patchInvestigating the published elevation-data instructions led to a separately reproducible problem: I cannot establish that this is the cause of the two official tiles above. The active production terrain configuration and source raster/mask/overview metadata were not available in the public sources inspected. This PR should be reviewed as a correction to the documented color-relief procedure, not as a demonstrated fix of the official low-zoom gradient. It would not help a deployed pipeline that bypasses I also read the OpenTopoMap document you linked. It explicitly fills DEM voids first and has separate grayscale AI assistance and human oversightThis contribution and this reply are substantially AI-assisted. The AI agent performed the source/issue investigation, authored the patch, tests and documentation, executed the reported local tests and rendering probes, and submitted the PR through Boris's authorized browser session. A separate AI agent reviewed the candidate; that was not a human code review. Boris's human contribution was reporting the visual problem, directing the investigation and explicitly authorizing the upstream PR. There has not been a separate human audit of the code, the test results or the production-cause hypothesis, and I should not imply otherwise. Maintainer review and production-data validation are still needed. The public evidence and reproducible tests above are intended to make that review possible. |
|
Hi @Phyks - thanks for taking a look! Here's a live link showing the issue: https://www.cyclosm.org/#map=2/-7.1/-83.0/cyclosm - we're also seeing it when trying to use the tiles |
|
AFAIK the hillshades used online on cyclosm.org are not the same ones as the ones described in the documentation, since they have been factored out with another codebase in use by openstreetmap-fr. Then, the live issue should be reported to https://github.com/osm-fr/infrastructure/. cc-ing @cquest who deployed these online hillshades. |


Summary
dem/shade.ramp.Why
gdaldem hillshademarks missing elevation as NoData=0. Without annventry, the current ramp's numeric zero stop becomes black with alpha220. Missing terrain is therefore drawn as a dark overlay rather than left unshaded.Test plan
python3 -m unittest discover -s scripts/tests -p 'test_hillshade_nodata.py' -vFour tests pass with GDAL3.12.2. Before the change, the two NoData tests fail. Valid shadow/highlight stops and valid numeric zero without NoData metadata retain their original values.
Also rendered the synthetic before/after colour-relief rasters using Mapnik4.3.2 with the existing hillshade settings (
bilinear,multiply, opacity0.85). The missing-data area changes from a dark overlay to the untouched background, while valid flat terrain is unchanged.Scope
This fixes a reproducible problem in the documented hillshade preparation procedure. It does not establish the full active configuration or input provenance of the official tile servers, and it does not claim a verified fix for the broad low-zoom gradient currently visible in some official z4 tiles. Existing semi-transparent terrain rasters and rendered tiles need regeneration to adopt the ramp correction.
Contribution checks
scripts/generate_taginfo.py project.mmlwas run. Its output is byte-identical to the upstream baseline with the same dependencies. The existing checked-in tag list differs from that generator output already, so this terrain-only change leavestaginfo.jsonuntouched rather than remove unrelated tags.Synthetic rendering evidence
The rendering check uses a generated DEM, not official site imagery. The fixture is EPSG:3857, extent
(0, 0, 256, 256), with missing data on the left and valid flat terrain on the right. With Mapnik's bilinear/multiply raster settings at opacity 0.85:(49, 57, 57)(181, 208, 208)(181, 208, 208)(181, 208, 208)The integration regression additionally uses valid sloping terrain with nonzero alpha, writes colour relief to GeoTIFF, and reopens an on-disk VRT before asserting transparency and preservation of valid shading.
Screenshot upload was unavailable through the paired browser's file-upload interface. The synthetic fixture and exact regression command above are provided for reproducibility.