|
39 | 39 | "metadata": {}, |
40 | 40 | "outputs": [], |
41 | 41 | "source": [ |
42 | | - "titiler_endpoint = \"https://titiler.xyz\" # Developmentseed Demo endpoint. Please be kind." |
| 42 | + "titiler_endpoint = (\n", |
| 43 | + " \"https://titiler.xyz\" # Developmentseed Demo endpoint. Please be kind.\n", |
| 44 | + ")" |
43 | 45 | ] |
44 | 46 | }, |
45 | 47 | { |
|
70 | 72 | "# Fetch dataset Metadata\n", |
71 | 73 | "r = httpx.get(\n", |
72 | 74 | " f\"{titiler_endpoint}/cog/info\",\n", |
73 | | - " params = {\n", |
| 75 | + " params={\n", |
74 | 76 | " \"url\": url,\n", |
75 | | - " }\n", |
| 77 | + " },\n", |
76 | 78 | ").json()\n", |
77 | 79 | "\n", |
78 | 80 | "print(r)" |
|
97 | 99 | "source": [ |
98 | 100 | "r = httpx.get(\n", |
99 | 101 | " f\"{titiler_endpoint}/cog/WebMercatorQuad/tilejson.json\",\n", |
100 | | - " params = {\n", |
| 102 | + " params={\n", |
101 | 103 | " \"url\": url,\n", |
102 | | - " }\n", |
| 104 | + " },\n", |
103 | 105 | ").json()\n", |
104 | 106 | "\n", |
105 | 107 | "bounds = r[\"bounds\"]\n", |
106 | 108 | "m = Map(\n", |
107 | | - " location=((bounds[1] + bounds[3]) / 2,(bounds[0] + bounds[2]) / 2),\n", |
108 | | - " zoom_start=r[\"minzoom\"]\n", |
| 109 | + " location=((bounds[1] + bounds[3]) / 2, (bounds[0] + bounds[2]) / 2),\n", |
| 110 | + " zoom_start=r[\"minzoom\"],\n", |
109 | 111 | ")\n", |
110 | 112 | "\n", |
111 | 113 | "TileLayer(\n", |
112 | | - " tiles=r[\"tiles\"][0],\n", |
113 | | - " opacity=1,\n", |
114 | | - " attr=\"Office fédéral de topographie swisstopo\"\n", |
| 114 | + " tiles=r[\"tiles\"][0], opacity=1, attr=\"Office fédéral de topographie swisstopo\"\n", |
115 | 115 | ").add_to(m)\n", |
116 | 116 | "m" |
117 | 117 | ] |
|
127 | 127 | "source": [ |
128 | 128 | "r = httpx.get(\n", |
129 | 129 | " f\"{titiler_endpoint}/cog/WebMercatorQuad/tilejson.json\",\n", |
130 | | - " params = {\n", |
| 130 | + " params={\n", |
131 | 131 | " \"url\": url,\n", |
132 | 132 | " # rio-tiler cannot rescale automatically the data when using a colormap\n", |
133 | 133 | " \"rescale\": \"1615.812,2015.09448\",\n", |
134 | 134 | " \"colormap_name\": \"terrain\",\n", |
135 | | - " }\n", |
| 135 | + " },\n", |
136 | 136 | ").json()\n", |
137 | 137 | "\n", |
138 | 138 | "bounds = r[\"bounds\"]\n", |
139 | 139 | "m = Map(\n", |
140 | | - " location=((bounds[1] + bounds[3]) / 2,(bounds[0] + bounds[2]) / 2),\n", |
141 | | - " zoom_start=r[\"minzoom\"]\n", |
| 140 | + " location=((bounds[1] + bounds[3]) / 2, (bounds[0] + bounds[2]) / 2),\n", |
| 141 | + " zoom_start=r[\"minzoom\"],\n", |
142 | 142 | ")\n", |
143 | 143 | "\n", |
144 | 144 | "aod_layer = TileLayer(\n", |
145 | | - " tiles=r[\"tiles\"][0],\n", |
146 | | - " opacity=1,\n", |
147 | | - " attr=\"Office fédéral de topographie swisstopo\"\n", |
| 145 | + " tiles=r[\"tiles\"][0], opacity=1, attr=\"Office fédéral de topographie swisstopo\"\n", |
148 | 146 | ")\n", |
149 | 147 | "aod_layer.add_to(m)\n", |
150 | 148 | "m" |
|
200 | 198 | "source": [ |
201 | 199 | "r = httpx.get(\n", |
202 | 200 | " f\"{titiler_endpoint}/cog/WebMercatorQuad/tilejson.json\",\n", |
203 | | - " params = {\n", |
| 201 | + " params={\n", |
204 | 202 | " \"url\": url,\n", |
205 | 203 | " \"algorithm\": \"hillshade\",\n", |
206 | 204 | " # Hillshade algorithm use a 3pixel buffer so we need\n", |
207 | 205 | " # to tell the tiler to apply a 3 pixel buffer around each tile\n", |
208 | 206 | " \"buffer\": 3,\n", |
209 | | - " }\n", |
| 207 | + " },\n", |
210 | 208 | ").json()\n", |
211 | 209 | "\n", |
212 | 210 | "bounds = r[\"bounds\"]\n", |
213 | 211 | "m = Map(\n", |
214 | | - " location=((bounds[1] + bounds[3]) / 2,(bounds[0] + bounds[2]) / 2),\n", |
215 | | - " zoom_start=r[\"minzoom\"]\n", |
| 212 | + " location=((bounds[1] + bounds[3]) / 2, (bounds[0] + bounds[2]) / 2),\n", |
| 213 | + " zoom_start=r[\"minzoom\"],\n", |
216 | 214 | ")\n", |
217 | 215 | "\n", |
218 | | - "aod_layer = TileLayer(\n", |
219 | | - " tiles=r[\"tiles\"][0],\n", |
220 | | - " opacity=1,\n", |
221 | | - " attr=\"Yo!!\"\n", |
222 | | - ")\n", |
| 216 | + "aod_layer = TileLayer(tiles=r[\"tiles\"][0], opacity=1, attr=\"Yo!!\")\n", |
223 | 217 | "aod_layer.add_to(m)\n", |
224 | 218 | "m" |
225 | 219 | ] |
|
241 | 235 | "source": [ |
242 | 236 | "r = httpx.get(\n", |
243 | 237 | " f\"{titiler_endpoint}/cog/WebMercatorQuad/tilejson.json\",\n", |
244 | | - " params = {\n", |
| 238 | + " params={\n", |
245 | 239 | " \"url\": url,\n", |
246 | 240 | " \"algorithm\": \"contours\",\n", |
247 | 241 | " \"algorithm_params\": json.dumps(\n", |
248 | 242 | " {\n", |
249 | | - " \"increment\": 20, # contour line every 20 meters\n", |
250 | | - " \"thickness\": 2, # 2m thickness\n", |
| 243 | + " \"increment\": 20, # contour line every 20 meters\n", |
| 244 | + " \"thickness\": 2, # 2m thickness\n", |
251 | 245 | " \"minz\": 1600,\n", |
252 | | - " \"maxz\": 2000\n", |
| 246 | + " \"maxz\": 2000,\n", |
253 | 247 | " }\n", |
254 | 248 | " ),\n", |
255 | | - " }\n", |
| 249 | + " },\n", |
256 | 250 | ").json()\n", |
257 | 251 | "\n", |
258 | 252 | "bounds = r[\"bounds\"]\n", |
259 | 253 | "m = Map(\n", |
260 | | - " location=((bounds[1] + bounds[3]) / 2,(bounds[0] + bounds[2]) / 2),\n", |
261 | | - " zoom_start=r[\"minzoom\"]\n", |
| 254 | + " location=((bounds[1] + bounds[3]) / 2, (bounds[0] + bounds[2]) / 2),\n", |
| 255 | + " zoom_start=r[\"minzoom\"],\n", |
262 | 256 | ")\n", |
263 | 257 | "\n", |
264 | | - "TileLayer(\n", |
265 | | - " tiles=r[\"tiles\"][0],\n", |
266 | | - " opacity=1,\n", |
267 | | - " attr=\"Yo!!\"\n", |
268 | | - ").add_to(m)\n", |
| 258 | + "TileLayer(tiles=r[\"tiles\"][0], opacity=1, attr=\"Yo!!\").add_to(m)\n", |
269 | 259 | "m" |
270 | 260 | ] |
271 | 261 | }, |
|
278 | 268 | "source": [ |
279 | 269 | "r = httpx.get(\n", |
280 | 270 | " f\"{titiler_endpoint}/cog/WebMercatorQuad/tilejson.json\",\n", |
281 | | - " params = {\n", |
| 271 | + " params={\n", |
282 | 272 | " \"url\": url,\n", |
283 | 273 | " \"algorithm\": \"contours\",\n", |
284 | 274 | " \"algorithm_params\": json.dumps(\n", |
285 | 275 | " {\n", |
286 | | - " \"increment\": 5, # contour line every 5 meters\n", |
287 | | - " \"thickness\": 1, # 1m thickness\n", |
| 276 | + " \"increment\": 5, # contour line every 5 meters\n", |
| 277 | + " \"thickness\": 1, # 1m thickness\n", |
288 | 278 | " \"minz\": 1600,\n", |
289 | | - " \"maxz\": 2000\n", |
| 279 | + " \"maxz\": 2000,\n", |
290 | 280 | " }\n", |
291 | 281 | " ),\n", |
292 | | - " }\n", |
| 282 | + " },\n", |
293 | 283 | ").json()\n", |
294 | 284 | "\n", |
295 | 285 | "bounds = r[\"bounds\"]\n", |
296 | 286 | "m = Map(\n", |
297 | | - " location=((bounds[1] + bounds[3]) / 2,(bounds[0] + bounds[2]) / 2),\n", |
298 | | - " zoom_start=r[\"minzoom\"]\n", |
| 287 | + " location=((bounds[1] + bounds[3]) / 2, (bounds[0] + bounds[2]) / 2),\n", |
| 288 | + " zoom_start=r[\"minzoom\"],\n", |
299 | 289 | ")\n", |
300 | 290 | "\n", |
301 | | - "TileLayer(\n", |
302 | | - " tiles=r[\"tiles\"][0],\n", |
303 | | - " opacity=1,\n", |
304 | | - " attr=\"Yo!!\"\n", |
305 | | - ").add_to(m)\n", |
| 291 | + "TileLayer(tiles=r[\"tiles\"][0], opacity=1, attr=\"Yo!!\").add_to(m)\n", |
306 | 292 | "m" |
307 | 293 | ] |
308 | 294 | }, |
|
0 commit comments