Skip to content

Commit 56cbc1b

Browse files
committed
update examples
1 parent dcf5a46 commit 56cbc1b

File tree

2 files changed

+433
-72
lines changed

2 files changed

+433
-72
lines changed

examples/Display_tiles_in_notebook.ipynb

Lines changed: 136 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
},
1111
{
1212
"cell_type": "code",
13-
"execution_count": 1,
13+
"execution_count": 5,
1414
"id": "55915667",
1515
"metadata": {},
1616
"outputs": [],
@@ -25,7 +25,7 @@
2525
},
2626
{
2727
"cell_type": "code",
28-
"execution_count": 2,
28+
"execution_count": 6,
2929
"id": "5c65b3d5",
3030
"metadata": {},
3131
"outputs": [
@@ -50,7 +50,7 @@
5050
},
5151
{
5252
"cell_type": "code",
53-
"execution_count": 3,
53+
"execution_count": 7,
5454
"id": "85e4c1e0",
5555
"metadata": {
5656
"scrolled": false
@@ -59,11 +59,9 @@
5959
{
6060
"data": {
6161
"text/plain": [
62-
"{'bounds': [7.090624928537461,\n",
63-
" 45.916058441028206,\n",
64-
" 7.1035698381384185,\n",
65-
" 45.925093000254144],\n",
66-
" 'band_metadata': [['1',\n",
62+
"{'bounds': [2573000.0, 1085000.0, 2574000.0, 1086000.0],\n",
63+
" 'crs': 'http://www.opengis.net/def/crs/EPSG/0/2056',\n",
64+
" 'band_metadata': [['b1',\n",
6765
" {'STATISTICS_COVARIANCES': '10685.98787505646',\n",
6866
" 'STATISTICS_EXCLUDEDVALUES': '-9999',\n",
6967
" 'STATISTICS_MAXIMUM': '2015.0944824219',\n",
@@ -72,19 +70,21 @@
7270
" 'STATISTICS_SKIPFACTORX': '1',\n",
7371
" 'STATISTICS_SKIPFACTORY': '1',\n",
7472
" 'STATISTICS_STDDEV': '103.37305197708'}]],\n",
75-
" 'band_descriptions': [['1', '']],\n",
73+
" 'band_descriptions': [['b1', '']],\n",
7674
" 'dtype': 'float32',\n",
7775
" 'nodata_type': 'Nodata',\n",
7876
" 'colorinterp': ['gray'],\n",
79-
" 'overviews': [2, 4, 8],\n",
80-
" 'height': 2000,\n",
81-
" 'nodata_value': -9999.0,\n",
82-
" 'count': 1,\n",
77+
" 'scales': [1.0],\n",
78+
" 'offsets': [0.0],\n",
8379
" 'driver': 'GTiff',\n",
84-
" 'width': 2000}"
80+
" 'count': 1,\n",
81+
" 'width': 2000,\n",
82+
" 'height': 2000,\n",
83+
" 'overviews': [2, 4, 8],\n",
84+
" 'nodata_value': -9999.0}"
8585
]
8686
},
87-
"execution_count": 3,
87+
"execution_count": 7,
8888
"metadata": {},
8989
"output_type": "execute_result"
9090
}
@@ -96,7 +96,7 @@
9696
},
9797
{
9898
"cell_type": "code",
99-
"execution_count": 4,
99+
"execution_count": 8,
100100
"id": "4cc8c900",
101101
"metadata": {
102102
"scrolled": false
@@ -105,27 +105,120 @@
105105
{
106106
"data": {
107107
"text/html": [
108-
"<div style=\"width:100%;\"><div style=\"position:relative;width:100%;height:0;padding-bottom:60%;\"><span style=\"color:#565656\">Make this Notebook Trusted to load map: File -> Trust Notebook</span><iframe src=\"about:blank\" style=\"position:absolute;width:100%;height:100%;left:0;top:0;border:none !important;\" data-html=%3C%21DOCTYPE%20html%3E%0A%3Chead%3E%20%20%20%20%0A%20%20%20%20%3Cmeta%20http-equiv%3D%22content-type%22%20content%3D%22text/html%3B%20charset%3DUTF-8%22%20/%3E%0A%20%20%20%20%0A%20%20%20%20%20%20%20%20%3Cscript%3E%0A%20%20%20%20%20%20%20%20%20%20%20%20L_NO_TOUCH%20%3D%20false%3B%0A%20%20%20%20%20%20%20%20%20%20%20%20L_DISABLE_3D%20%3D%20false%3B%0A%20%20%20%20%20%20%20%20%3C/script%3E%0A%20%20%20%20%0A%20%20%20%20%3Cstyle%3Ehtml%2C%20body%20%7Bwidth%3A%20100%25%3Bheight%3A%20100%25%3Bmargin%3A%200%3Bpadding%3A%200%3B%7D%3C/style%3E%0A%20%20%20%20%3Cstyle%3E%23map%20%7Bposition%3Aabsolute%3Btop%3A0%3Bbottom%3A0%3Bright%3A0%3Bleft%3A0%3B%7D%3C/style%3E%0A%20%20%20%20%3Cscript%20src%3D%22https%3A//cdn.jsdelivr.net/npm/leaflet%401.6.0/dist/leaflet.js%22%3E%3C/script%3E%0A%20%20%20%20%3Cscript%20src%3D%22https%3A//code.jquery.com/jquery-1.12.4.min.js%22%3E%3C/script%3E%0A%20%20%20%20%3Cscript%20src%3D%22https%3A//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js%22%3E%3C/script%3E%0A%20%20%20%20%3Cscript%20src%3D%22https%3A//cdnjs.cloudflare.com/ajax/libs/Leaflet.awesome-markers/2.0.2/leaflet.awesome-markers.js%22%3E%3C/script%3E%0A%20%20%20%20%3Clink%20rel%3D%22stylesheet%22%20href%3D%22https%3A//cdn.jsdelivr.net/npm/leaflet%401.6.0/dist/leaflet.css%22/%3E%0A%20%20%20%20%3Clink%20rel%3D%22stylesheet%22%20href%3D%22https%3A//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css%22/%3E%0A%20%20%20%20%3Clink%20rel%3D%22stylesheet%22%20href%3D%22https%3A//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap-theme.min.css%22/%3E%0A%20%20%20%20%3Clink%20rel%3D%22stylesheet%22%20href%3D%22https%3A//maxcdn.bootstrapcdn.com/font-awesome/4.6.3/css/font-awesome.min.css%22/%3E%0A%20%20%20%20%3Clink%20rel%3D%22stylesheet%22%20href%3D%22https%3A//cdnjs.cloudflare.com/ajax/libs/Leaflet.awesome-markers/2.0.2/leaflet.awesome-markers.css%22/%3E%0A%20%20%20%20%3Clink%20rel%3D%22stylesheet%22%20href%3D%22https%3A//cdn.jsdelivr.net/gh/python-visualization/folium/folium/templates/leaflet.awesome.rotate.min.css%22/%3E%0A%20%20%20%20%0A%20%20%20%20%20%20%20%20%20%20%20%20%3Cmeta%20name%3D%22viewport%22%20content%3D%22width%3Ddevice-width%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20initial-scale%3D1.0%2C%20maximum-scale%3D1.0%2C%20user-scalable%3Dno%22%20/%3E%0A%20%20%20%20%20%20%20%20%20%20%20%20%3Cstyle%3E%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%23map_becaf3665d874004ba1a1e9d0034e713%20%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20position%3A%20relative%3B%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20width%3A%20100.0%25%3B%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20height%3A%20100.0%25%3B%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20left%3A%200.0%25%3B%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20top%3A%200.0%25%3B%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%7D%0A%20%20%20%20%20%20%20%20%20%20%20%20%3C/style%3E%0A%20%20%20%20%20%20%20%20%0A%3C/head%3E%0A%3Cbody%3E%20%20%20%20%0A%20%20%20%20%0A%20%20%20%20%20%20%20%20%20%20%20%20%3Cdiv%20class%3D%22folium-map%22%20id%3D%22map_becaf3665d874004ba1a1e9d0034e713%22%20%3E%3C/div%3E%0A%20%20%20%20%20%20%20%20%0A%3C/body%3E%0A%3Cscript%3E%20%20%20%20%0A%20%20%20%20%0A%20%20%20%20%20%20%20%20%20%20%20%20var%20map_becaf3665d874004ba1a1e9d0034e713%20%3D%20L.map%28%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%22map_becaf3665d874004ba1a1e9d0034e713%22%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20center%3A%20%5B45.920575720641175%2C%207.09709738333794%5D%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20crs%3A%20L.CRS.EPSG3857%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20zoom%3A%2015%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20zoomControl%3A%20true%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20preferCanvas%3A%20false%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%7D%0A%20%20%20%20%20%20%20%20%20%20%20%20%29%3B%0A%0A%20%20%20%20%20%20%20%20%20%20%20%20%0A%0A%20%20%20%20%20%20%20%20%0A%20%20%20%20%0A%20%20%20%20%20%20%20%20%20%20%20%20var%20tile_layer_de47a4b556344b78857002fcf60e2b2f%20%3D%20L.tileLayer%28%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%22https%3A//%7Bs%7D.tile.openstreetmap.org/%7Bz%7D/%7Bx%7D/%7By%7D.png%22%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%7B%22attribution%22%3A%20%22Data%20by%20%5Cu0026copy%3B%20%5Cu003ca%20href%3D%5C%22http%3A//openstreetmap.org%5C%22%5Cu003eOpenStreetMap%5Cu003c/a%5Cu003e%2C%20under%20%5Cu003ca%20href%3D%5C%22http%3A//www.openstreetmap.org/copyright%5C%22%5Cu003eODbL%5Cu003c/a%5Cu003e.%22%2C%20%22detectRetina%22%3A%20false%2C%20%22maxNativeZoom%22%3A%2018%2C%20%22maxZoom%22%3A%2018%2C%20%22minZoom%22%3A%200%2C%20%22noWrap%22%3A%20false%2C%20%22opacity%22%3A%201%2C%20%22subdomains%22%3A%20%22abc%22%2C%20%22tms%22%3A%20false%7D%0A%20%20%20%20%20%20%20%20%20%20%20%20%29.addTo%28map_becaf3665d874004ba1a1e9d0034e713%29%3B%0A%20%20%20%20%20%20%20%20%0A%20%20%20%20%0A%20%20%20%20%20%20%20%20%20%20%20%20var%20tile_layer_84bbe6fb7aba4cec8db73c2dd5cc5c37%20%3D%20L.tileLayer%28%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%22http%3A//127.0.0.1%3A8080/tiles/%7Bz%7D/%7Bx%7D/%7By%7D%3Frescale%3D1600%252C2000%5Cu0026colormap_name%3Dterrain%22%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%7B%22attribution%22%3A%20%22Yo%21%21%22%2C%20%22detectRetina%22%3A%20false%2C%20%22maxNativeZoom%22%3A%2018%2C%20%22maxZoom%22%3A%2018%2C%20%22minZoom%22%3A%200%2C%20%22noWrap%22%3A%20false%2C%20%22opacity%22%3A%201%2C%20%22subdomains%22%3A%20%22abc%22%2C%20%22tms%22%3A%20false%7D%0A%20%20%20%20%20%20%20%20%20%20%20%20%29.addTo%28map_becaf3665d874004ba1a1e9d0034e713%29%3B%0A%20%20%20%20%20%20%20%20%0A%3C/script%3E onload=\"this.contentDocument.open();this.contentDocument.write( decodeURIComponent(this.getAttribute('data-html')));this.contentDocument.close();\" allowfullscreen webkitallowfullscreen mozallowfullscreen></iframe></div></div>"
108+
"<div style=\"width:100%;\"><div style=\"position:relative;width:100%;height:0;padding-bottom:60%;\"><span style=\"color:#565656\">Make this Notebook Trusted to load map: File -> Trust Notebook</span><iframe srcdoc=\"&lt;!DOCTYPE html&gt;\n",
109+
"&lt;html&gt;\n",
110+
"&lt;head&gt;\n",
111+
" \n",
112+
" &lt;meta http-equiv=&quot;content-type&quot; content=&quot;text/html; charset=UTF-8&quot; /&gt;\n",
113+
" \n",
114+
" &lt;script&gt;\n",
115+
" L_NO_TOUCH = false;\n",
116+
" L_DISABLE_3D = false;\n",
117+
" &lt;/script&gt;\n",
118+
" \n",
119+
" &lt;style&gt;html, body {width: 100%;height: 100%;margin: 0;padding: 0;}&lt;/style&gt;\n",
120+
" &lt;style&gt;#map {position:absolute;top:0;bottom:0;right:0;left:0;}&lt;/style&gt;\n",
121+
" &lt;script src=&quot;https://cdn.jsdelivr.net/npm/[email protected]/dist/leaflet.js&quot;&gt;&lt;/script&gt;\n",
122+
" &lt;script src=&quot;https://code.jquery.com/jquery-3.7.1.min.js&quot;&gt;&lt;/script&gt;\n",
123+
" &lt;script src=&quot;https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js&quot;&gt;&lt;/script&gt;\n",
124+
" &lt;script src=&quot;https://cdnjs.cloudflare.com/ajax/libs/Leaflet.awesome-markers/2.0.2/leaflet.awesome-markers.js&quot;&gt;&lt;/script&gt;\n",
125+
" &lt;link rel=&quot;stylesheet&quot; href=&quot;https://cdn.jsdelivr.net/npm/[email protected]/dist/leaflet.css&quot;/&gt;\n",
126+
" &lt;link rel=&quot;stylesheet&quot; href=&quot;https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css&quot;/&gt;\n",
127+
" &lt;link rel=&quot;stylesheet&quot; href=&quot;https://netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap-glyphicons.css&quot;/&gt;\n",
128+
" &lt;link rel=&quot;stylesheet&quot; href=&quot;https://cdn.jsdelivr.net/npm/@fortawesome/[email protected]/css/all.min.css&quot;/&gt;\n",
129+
" &lt;link rel=&quot;stylesheet&quot; href=&quot;https://cdnjs.cloudflare.com/ajax/libs/Leaflet.awesome-markers/2.0.2/leaflet.awesome-markers.css&quot;/&gt;\n",
130+
" &lt;link rel=&quot;stylesheet&quot; href=&quot;https://cdn.jsdelivr.net/gh/python-visualization/folium/folium/templates/leaflet.awesome.rotate.min.css&quot;/&gt;\n",
131+
" \n",
132+
" &lt;meta name=&quot;viewport&quot; content=&quot;width=device-width,\n",
133+
" initial-scale=1.0, maximum-scale=1.0, user-scalable=no&quot; /&gt;\n",
134+
" &lt;style&gt;\n",
135+
" #map_523ab0fbed0a980477d009327c813376 {\n",
136+
" position: relative;\n",
137+
" width: 100.0%;\n",
138+
" height: 100.0%;\n",
139+
" left: 0.0%;\n",
140+
" top: 0.0%;\n",
141+
" }\n",
142+
" .leaflet-container { font-size: 1rem; }\n",
143+
" &lt;/style&gt;\n",
144+
" \n",
145+
"&lt;/head&gt;\n",
146+
"&lt;body&gt;\n",
147+
" \n",
148+
" \n",
149+
" &lt;div class=&quot;folium-map&quot; id=&quot;map_523ab0fbed0a980477d009327c813376&quot; &gt;&lt;/div&gt;\n",
150+
" \n",
151+
"&lt;/body&gt;\n",
152+
"&lt;script&gt;\n",
153+
" \n",
154+
" \n",
155+
" var map_523ab0fbed0a980477d009327c813376 = L.map(\n",
156+
" &quot;map_523ab0fbed0a980477d009327c813376&quot;,\n",
157+
" {\n",
158+
" center: [45.92057572064118, 7.09709738333794],\n",
159+
" crs: L.CRS.EPSG3857,\n",
160+
" ...{\n",
161+
" &quot;zoom&quot;: 15,\n",
162+
" &quot;zoomControl&quot;: true,\n",
163+
" &quot;preferCanvas&quot;: false,\n",
164+
"}\n",
165+
"\n",
166+
" }\n",
167+
" );\n",
168+
"\n",
169+
" \n",
170+
"\n",
171+
" \n",
172+
" \n",
173+
" var tile_layer_b99227e7e4371d1adc9dcbdf4e733cb4 = L.tileLayer(\n",
174+
" &quot;https://tile.openstreetmap.org/{z}/{x}/{y}.png&quot;,\n",
175+
" {\n",
176+
" &quot;minZoom&quot;: 0,\n",
177+
" &quot;maxZoom&quot;: 19,\n",
178+
" &quot;maxNativeZoom&quot;: 19,\n",
179+
" &quot;noWrap&quot;: false,\n",
180+
" &quot;attribution&quot;: &quot;\\u0026copy; \\u003ca href=\\&quot;https://www.openstreetmap.org/copyright\\&quot;\\u003eOpenStreetMap\\u003c/a\\u003e contributors&quot;,\n",
181+
" &quot;subdomains&quot;: &quot;abc&quot;,\n",
182+
" &quot;detectRetina&quot;: false,\n",
183+
" &quot;tms&quot;: false,\n",
184+
" &quot;opacity&quot;: 1,\n",
185+
"}\n",
186+
"\n",
187+
" );\n",
188+
" \n",
189+
" \n",
190+
" tile_layer_b99227e7e4371d1adc9dcbdf4e733cb4.addTo(map_523ab0fbed0a980477d009327c813376);\n",
191+
" \n",
192+
" \n",
193+
" var tile_layer_51ba91bec6d6daf44f907902fcf69fbd = L.tileLayer(\n",
194+
" &quot;http://127.0.0.1:8080/tiles/WebMercatorQuad/{z}/{x}/{y}?rescale=1600%2C2000\\u0026colormap_name=terrain&quot;,\n",
195+
" {\n",
196+
" &quot;minZoom&quot;: 0,\n",
197+
" &quot;maxZoom&quot;: 18,\n",
198+
" &quot;maxNativeZoom&quot;: 18,\n",
199+
" &quot;noWrap&quot;: false,\n",
200+
" &quot;attribution&quot;: &quot;Yo!!&quot;,\n",
201+
" &quot;subdomains&quot;: &quot;abc&quot;,\n",
202+
" &quot;detectRetina&quot;: false,\n",
203+
" &quot;tms&quot;: false,\n",
204+
" &quot;opacity&quot;: 1,\n",
205+
"}\n",
206+
"\n",
207+
" );\n",
208+
" \n",
209+
" \n",
210+
" tile_layer_51ba91bec6d6daf44f907902fcf69fbd.addTo(map_523ab0fbed0a980477d009327c813376);\n",
211+
" \n",
212+
"&lt;/script&gt;\n",
213+
"&lt;/html&gt;\" style=\"position:absolute;width:100%;height:100%;left:0;top:0;border:none !important;\" allowfullscreen webkitallowfullscreen mozallowfullscreen></iframe></div></div>"
109214
],
110215
"text/plain": [
111-
"<folium.folium.Map at 0x174f17670>"
216+
"<folium.folium.Map at 0x138ed49e0>"
112217
]
113218
},
114-
"execution_count": 4,
219+
"execution_count": 8,
115220
"metadata": {},
116221
"output_type": "execute_result"
117-
},
118-
{
119-
"name": "stderr",
120-
"output_type": "stream",
121-
"text": [
122-
"/Users/vincentsarago/Dev/vincentsarago/rasterio/rasterio/io.py:140: NotGeoreferencedWarning: Dataset has no geotransform, gcps, or rpcs. The identity matrix will be returned.\n",
123-
" return writer(mempath, 'w+', driver=driver, width=width,\n",
124-
"ERROR 4: `/vsimem/c3a718d1-01e9-4503-8f86-519ae94e88c8/c3a718d1-01e9-4503-8f86-519ae94e88c8.tif' not recognized as a supported file format.\n",
125-
"ERROR 4: `/vsimem/d141fe57-b93d-404c-805d-ff44812698e3/d141fe57-b93d-404c-805d-ff44812698e3.tif' not recognized as a supported file format.\n",
126-
"ERROR 4: `/vsimem/ec85c789-d8a9-4bc6-ac09-e55b5498af6b/ec85c789-d8a9-4bc6-ac09-e55b5498af6b.tif' not recognized as a supported file format.\n",
127-
"ERROR 4: `/vsimem/bd8ac208-f160-471d-be61-c9f42fe49fd7/bd8ac208-f160-471d-be61-c9f42fe49fd7.tif' not recognized as a supported file format.\n"
128-
]
129222
}
130223
],
131224
"source": [
@@ -154,10 +247,20 @@
154247
},
155248
{
156249
"cell_type": "code",
157-
"execution_count": null,
250+
"execution_count": 9,
158251
"id": "54d674e9",
159252
"metadata": {},
160253
"outputs": [],
254+
"source": [
255+
"client.shutdown()"
256+
]
257+
},
258+
{
259+
"cell_type": "code",
260+
"execution_count": null,
261+
"id": "adc13756",
262+
"metadata": {},
263+
"outputs": [],
161264
"source": []
162265
}
163266
],
@@ -177,7 +280,7 @@
177280
"name": "python",
178281
"nbconvert_exporter": "python",
179282
"pygments_lexer": "ipython3",
180-
"version": "3.8.9"
283+
"version": "3.12.3"
181284
},
182285
"vscode": {
183286
"interpreter": {

0 commit comments

Comments
 (0)