Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 4df748f

Browse files
committed
Create index.md
1 parent aa7419e commit 4df748f

File tree

1 file changed

+48
-0
lines changed

1 file changed

+48
-0
lines changed

docs/Python/TiTiler/index.md

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
# TiTiler
2+
3+
[TiTiler](https://developmentseed.org/titiler/): A modern dynamic tile server built on top of FastAPI and Rasterio/GDAL.
4+
5+
## /cog
6+
7+
### colormap
8+
9+
#### 离散
10+
11+
```js
12+
const colormap = encodeURIComponent(
13+
JSON.stringify({
14+
0: "#f00",
15+
1: "#0f0",
16+
2: "#00f",
17+
})
18+
);
19+
```
20+
21+
#### 线性
22+
23+
```js
24+
// 从 0 到 255 的 256 个值
25+
const linearColors: Record<number, string> = {};
26+
for (let i = 0; i < 256; i++) {
27+
colormap[i] = `#${i.toString(16).padStart(2, "0")}0000`;
28+
}
29+
30+
colormap = encodeURIComponent(JSON.stringify(linearColors));
31+
```
32+
33+
#### 区间
34+
35+
```js
36+
const colormap = JSON.stringify([
37+
// [[min, max], [r, g, b, a]]
38+
[[0, 40], "#FF0000"],
39+
[
40+
[40, 200],
41+
[0, 255, 0, 255],
42+
],
43+
[
44+
[200, 255],
45+
[0, 0, 255, 255],
46+
],
47+
]);
48+
```

0 commit comments

Comments
 (0)