I have the following GeoTIFF layer:
new WebGLTileLayer({
title: 'mb',
style: slope,
source: new GeoTIFF({
normalize: false,
sources: [{
url: 'raster/mb_p_sl.tif',
overviews: ['raster/mb_p_sl.tif.ovr'],
min: 0,
max: 76,
nodata: -9999,
}],
}),
}),
and the white-to-black color styling is as follows (range value of 0-76):
const slope = {
color: [
'interpolate',
['linear'],
['band', 1],
0,
[255, 255, 255],
76,
[0, 0, 0],
],
};
The problem is the white background that covers the layer's extent as it is shown here:
[![enter image description here][1]][1]
Not sure how to make that background transparent, any hint is welcomed,
Layer's info here:
Driver: GTiff/GeoTIFF
Files: raster/mb_p_sl.tif
raster/mb_p_sl.tif.ovr
Size is 833, 1319
Coordinate System is:
GEOGCRS["WGS 84",
DATUM["World Geodetic System 1984",
ELLIPSOID["WGS 84",6378137,298.257223563,
LENGTHUNIT["metre",1]]],
PRIMEM["Greenwich",0,
ANGLEUNIT["degree",0.0174532925199433]],
CS[ellipsoidal,2],
AXIS["geodetic latitude (Lat)",north,
ORDER[1],
ANGLEUNIT["degree",0.0174532925199433]],
AXIS["geodetic longitude (Lon)",east,
ORDER[2],
ANGLEUNIT["degree",0.0174532925199433]],
ID["EPSG",4326]]
Data axis to CRS axis mapping: 2,1
Origin = (-77.598083833395464,-15.699601330547507)
Pixel Size = (0.000935666790919,-0.000903654660184)
Metadata:
AREA_OR_POINT=Area
Image Structure Metadata:
INTERLEAVE=BAND
Corner Coordinates:
Upper Left ( -77.5980838, -15.6996013) ( 77d35'53.10"W, 15d41'58.56"S)
Lower Left ( -77.5980838, -16.8915218) ( 77d35'53.10"W, 16d53'29.48"S)
Upper Right ( -76.8186734, -15.6996013) ( 76d49' 7.22"W, 15d41'58.56"S)
Lower Right ( -76.8186734, -16.8915218) ( 76d49' 7.22"W, 16d53'29.48"S)
Center ( -77.2083786, -16.2955616) ( 77d12'30.16"W, 16d17'44.02"S)
Band 1 Block=833x2 Type=Float32, ColorInterp=Gray
Computed Min/Max=0.000,45.349
Minimum=0.000, Maximum=45.349, Mean=4.120, StdDev=4.657
NoData Value=-9999
Overviews: 417x660, 209x330, 105x165
Metadata:
STATISTICS_MAXIMUM=45.349166870117
STATISTICS_MEAN=4.1197140260889
STATISTICS_MINIMUM=0
STATISTICS_STDDEV=4.6573973577461
STATISTICS_VALID_PERCENT=9.514
specifying nodata
adds another band for alpha, so you could use
color: [
'case',
['>', ['band', 2], 0],
[
'interpolate',
['linear'],
['band', 1],
0,
[255, 255, 255],
76,
[0, 0, 0],
],
[0, 0, 0, 0],
],