You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/src/advanced/rendering.md
+52-33Lines changed: 52 additions & 33 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -16,19 +16,22 @@ Titiler supports both default colormaps (each with a name) and custom color maps
16
16
17
17
### Default Colormaps
18
18
19
-
Default colormaps pre-made, each with a given name. These maps come from the `rio-tiler` library, which has taken colormaps packaged with Matplotlib and has added others that are commonly used with raster data.
19
+
Default colormaps pre-made, each with a given name. These maps come from the `rio-tiler` library, which has taken colormaps packaged with Matplotlib and has added others that are commonly used with raster data.
20
20
21
21
A list of available color maps can be found in Titiler's Swagger docs, or in the [rio-tiler documentation](https://cogeotiff.github.io/rio-tiler/colormap/#default-rio-tilers-colormaps).
22
22
23
23
To use a default colormap, simply use the parameter `colormap_name`:
Rescaling is the act of adjusting the minimum and maximum values when rendering an image. In an image with a single band, the rescaled minimum value will be set to black, and the rescaled maximum value will be set to white. This is useful if you want to accentuate features that only appear at a certain pixel value (e.g. you have a DEM, but you want to highlight how the terrain changes between sea level and 100m).
93
96
94
-
Titiler supports rescaling on a per-band basis, using the `rescaling` parameter. The input is a list of comma-delimited min-max ranges (e.g. ["0,100", "100,200", "0,1000]).
97
+
All titiler endpoinds returning *image* support `rescale` parameter. The parameter should be in form of `"rescale={min},{max}"`.
95
98
96
-
```python3
97
-
importrequests
99
+
```python
100
+
importhttpx
98
101
99
-
response =requests.get(
100
-
f"titiler.xyz/cog/preview",
102
+
response =httpx.get(
103
+
"https;//titiler.xyz/cog/preview",
101
104
params={
102
-
"url": "<YOUR COG HERE>",
103
-
"rescaling": ["0,100", "0,1000", "0,10000"]
104
-
}
105
+
"url": "<YOUR DATASET URL HERE>",
106
+
"rescale": "0,100",
107
+
},
108
+
)
109
+
```
110
+
111
+
Titiler supports rescaling on a per-band basis, using multiple `rescale` parameters.
112
+
113
+
```python
114
+
import httpx
115
+
116
+
response = httpx.get(
117
+
"https;//titiler.xyz/cog/preview",
118
+
params=(
119
+
("url", "<YOUR DATASET URL HERE>"),
120
+
("rescale", "0,100"),
121
+
("rescale", "0,1000"),
122
+
("rescale", "0,10000"),
123
+
),
105
124
)
106
125
```
107
126
108
127
By default, Titiler will rescale the bands using the min/max values of the input datatype. For example, PNG images 8- or 16-bit unsigned pixels,
109
-
giving a possible range of 0 to 255 or 0 to 65,536, so Titiler will use these ranges to rescale to the output format.
128
+
giving a possible range of 0 to 255 or 0 to 65,536, so Titiler will use these ranges to rescale to the output format.
110
129
111
-
For certain datasets (e.g. DEMs) this default behaviour can make the image seem washed out (or even entirely one color),
130
+
For certain datasets (e.g. DEMs) this default behaviour can make the image seem washed out (or even entirely one color),
112
131
so if you see this happen look into rescaling your images to something that makes sense for your data.
113
132
114
133
It is also possible to add a [rescaling dependency](../../api/titiler/core/dependencies/#rescalingparams) to automatically apply
0 commit comments