Skip to content

Commit 5cbdea1

Browse files
author
Stefan Kuethe
committed
Add geopandas notebook
1 parent 8ebf16e commit 5cbdea1

File tree

7 files changed

+340
-248
lines changed

7 files changed

+340
-248
lines changed

jupyterlite/contents/data/ne_110m_land.geojson

Lines changed: 1 addition & 0 deletions
Large diffs are not rendered by default.

jupyterlite/contents/data/ne_50m_populated_places_simple.geojson

Lines changed: 1 addition & 0 deletions
Large diffs are not rendered by default.

jupyterlite/contents/geopandas.ipynb

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
{
2+
"cells": [
3+
{
4+
"cell_type": "code",
5+
"execution_count": null,
6+
"id": "8cd64f43",
7+
"metadata": {},
8+
"outputs": [],
9+
"source": [
10+
"%pip install openlayers"
11+
]
12+
},
13+
{
14+
"cell_type": "code",
15+
"execution_count": null,
16+
"id": "33ad894a",
17+
"metadata": {},
18+
"outputs": [],
19+
"source": [
20+
"import openlayers as ol"
21+
]
22+
},
23+
{
24+
"cell_type": "code",
25+
"execution_count": null,
26+
"id": "71348f7d",
27+
"metadata": {},
28+
"outputs": [],
29+
"source": [
30+
"gpd = ol.GeoDataFrame.from_file(\"data/ne_50m_populated_places_simple.geojson\")"
31+
]
32+
},
33+
{
34+
"cell_type": "code",
35+
"execution_count": null,
36+
"id": "31772b8b",
37+
"metadata": {},
38+
"outputs": [],
39+
"source": [
40+
"gpd.ol.color_category(\"scalerank\").explore(fit_bounds=False)"
41+
]
42+
},
43+
{
44+
"cell_type": "code",
45+
"execution_count": null,
46+
"id": "e53e89e2",
47+
"metadata": {},
48+
"outputs": [],
49+
"source": []
50+
}
51+
],
52+
"metadata": {
53+
"kernelspec": {
54+
"display_name": ".venv",
55+
"language": "python",
56+
"name": "python3"
57+
},
58+
"language_info": {
59+
"codemirror_mode": {
60+
"name": "ipython",
61+
"version": 3
62+
},
63+
"file_extension": ".py",
64+
"mimetype": "text/x-python",
65+
"name": "python",
66+
"nbconvert_exporter": "python",
67+
"pygments_lexer": "ipython3",
68+
"version": "3.11.11"
69+
}
70+
},
71+
"nbformat": 4,
72+
"nbformat_minor": 5
73+
}

jupyterlite/contents/geotiff.ipynb

Lines changed: 67 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -1,119 +1,124 @@
11
{
2-
"metadata": {
3-
"kernelspec": {
4-
"name": "python",
5-
"display_name": "Python (Pyodide)",
6-
"language": "python"
7-
},
8-
"language_info": {
9-
"codemirror_mode": {
10-
"name": "python",
11-
"version": 3
12-
},
13-
"file_extension": ".py",
14-
"mimetype": "text/x-python",
15-
"name": "python",
16-
"nbconvert_exporter": "python",
17-
"pygments_lexer": "ipython3",
18-
"version": "3.8"
19-
}
20-
},
21-
"nbformat_minor": 5,
22-
"nbformat": 4,
232
"cells": [
243
{
25-
"id": "9107e9f6-fb76-4f0c-89f7-576226375420",
264
"cell_type": "code",
27-
"source": "%pip install openlayers",
5+
"execution_count": null,
6+
"id": "9107e9f6-fb76-4f0c-89f7-576226375420",
287
"metadata": {
298
"trusted": true
309
},
3110
"outputs": [],
32-
"execution_count": 1
11+
"source": [
12+
"%pip install openlayers"
13+
]
3314
},
3415
{
35-
"id": "853579b6-8499-4927-a7a1-bfae79f78107",
3616
"cell_type": "code",
37-
"source": "import openlayers as ol",
17+
"execution_count": null,
18+
"id": "853579b6-8499-4927-a7a1-bfae79f78107",
3819
"metadata": {
3920
"trusted": true
4021
},
4122
"outputs": [],
42-
"execution_count": 2
23+
"source": [
24+
"import openlayers as ol"
25+
]
4326
},
4427
{
45-
"id": "d4dfb1d9-3d1a-44c3-9bdc-5e7458811fd4",
4628
"cell_type": "code",
47-
"source": "data = \"https://sentinel-cogs.s3.us-west-2.amazonaws.com/sentinel-s2-l2a-cogs/36/Q/WD/2020/7/S2A_36QWD_20200701_0_L2A/TCI.tif\"",
29+
"execution_count": null,
30+
"id": "d4dfb1d9-3d1a-44c3-9bdc-5e7458811fd4",
4831
"metadata": {
4932
"trusted": true
5033
},
5134
"outputs": [],
52-
"execution_count": 3
35+
"source": [
36+
"data = \"https://sentinel-cogs.s3.us-west-2.amazonaws.com/sentinel-s2-l2a-cogs/36/Q/WD/2020/7/S2A_36QWD_20200701_0_L2A/TCI.tif\""
37+
]
5338
},
5439
{
55-
"id": "ed79ba6a-65e5-4a3b-afbb-ada812fad00f",
5640
"cell_type": "code",
57-
"source": "geotiff = ol.WebGLTileLayer(\n id=\"cog\",\n opacity=0.5,\n source=ol.GeoTIFFSource(sources=[dict(url=data)])\n)",
41+
"execution_count": null,
42+
"id": "ed79ba6a-65e5-4a3b-afbb-ada812fad00f",
5843
"metadata": {
5944
"trusted": true
6045
},
6146
"outputs": [],
62-
"execution_count": 4
47+
"source": [
48+
"geotiff = ol.WebGLTileLayer(\n",
49+
" id=\"cog\",\n",
50+
" opacity=0.5,\n",
51+
" source=ol.GeoTIFFSource(sources=[dict(url=data)])\n",
52+
")"
53+
]
6354
},
6455
{
65-
"id": "466d9454-2ff5-42cf-b16f-e16438904977",
6656
"cell_type": "code",
67-
"source": "m = ol.MapWidget()\nm.add_layer(geotiff)",
57+
"execution_count": null,
58+
"id": "466d9454-2ff5-42cf-b16f-e16438904977",
6859
"metadata": {
6960
"trusted": true
7061
},
7162
"outputs": [],
72-
"execution_count": 9
63+
"source": [
64+
"m = ol.MapWidget()\n",
65+
"m.add_layer(geotiff)"
66+
]
7367
},
7468
{
75-
"id": "91d8bb71-ba0b-4206-b36a-e0098c462ec7",
7669
"cell_type": "code",
77-
"source": "m",
70+
"execution_count": null,
71+
"id": "91d8bb71-ba0b-4206-b36a-e0098c462ec7",
7872
"metadata": {
7973
"trusted": true
8074
},
81-
"outputs": [
82-
{
83-
"execution_count": 10,
84-
"output_type": "execute_result",
85-
"data": {
86-
"text/plain": "MapWidget(calls=[{'method': 'addLayer', 'args': ({'id': 'cog', 'source': {'sources': [{'url': 'https://sentine…",
87-
"application/vnd.jupyter.widget-view+json": {
88-
"version_major": 2,
89-
"version_minor": 1,
90-
"model_id": "b888fe271d0e4e4bbcbbddb5bc949f79"
91-
}
92-
},
93-
"metadata": {}
94-
}
95-
],
96-
"execution_count": 10
75+
"outputs": [],
76+
"source": [
77+
"m"
78+
]
9779
},
9880
{
99-
"id": "0d072d98-399d-44c6-a180-985c799e3ed1",
10081
"cell_type": "code",
101-
"source": "m.set_view_from_source(\"cog\")",
82+
"execution_count": null,
83+
"id": "0d072d98-399d-44c6-a180-985c799e3ed1",
10284
"metadata": {
10385
"trusted": true
10486
},
10587
"outputs": [],
106-
"execution_count": 11
88+
"source": [
89+
"m.set_view_from_source(\"cog\")"
90+
]
10791
},
10892
{
109-
"id": "399cf8c8-0e53-4513-96b3-4bf916cc6fa8",
11093
"cell_type": "code",
111-
"source": "",
94+
"execution_count": null,
95+
"id": "399cf8c8-0e53-4513-96b3-4bf916cc6fa8",
11296
"metadata": {
11397
"trusted": true
11498
},
11599
"outputs": [],
116-
"execution_count": null
100+
"source": []
117101
}
118-
]
119-
}
102+
],
103+
"metadata": {
104+
"kernelspec": {
105+
"display_name": "Python (Pyodide)",
106+
"language": "python",
107+
"name": "python"
108+
},
109+
"language_info": {
110+
"codemirror_mode": {
111+
"name": "python",
112+
"version": 3
113+
},
114+
"file_extension": ".py",
115+
"mimetype": "text/x-python",
116+
"name": "python",
117+
"nbconvert_exporter": "python",
118+
"pygments_lexer": "ipython3",
119+
"version": "3.8"
120+
}
121+
},
122+
"nbformat": 4,
123+
"nbformat_minor": 5
124+
}
Lines changed: 47 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -1,89 +1,83 @@
11
{
2-
"metadata": {
3-
"kernelspec": {
4-
"name": "python",
5-
"display_name": "Python (Pyodide)",
6-
"language": "python"
7-
},
8-
"language_info": {
9-
"codemirror_mode": {
10-
"name": "python",
11-
"version": 3
12-
},
13-
"file_extension": ".py",
14-
"mimetype": "text/x-python",
15-
"name": "python",
16-
"nbconvert_exporter": "python",
17-
"pygments_lexer": "ipython3",
18-
"version": "3.8"
19-
}
20-
},
21-
"nbformat_minor": 5,
22-
"nbformat": 4,
232
"cells": [
243
{
25-
"id": "66605b1e-7af5-4148-8239-c3812cfad687",
264
"cell_type": "code",
27-
"source": "%pip install openlayers",
5+
"execution_count": null,
6+
"id": "66605b1e-7af5-4148-8239-c3812cfad687",
287
"metadata": {
298
"trusted": true
309
},
3110
"outputs": [],
32-
"execution_count": 3
11+
"source": [
12+
"%pip install openlayers"
13+
]
3314
},
3415
{
35-
"id": "03aad39a-c9f9-443f-9e2d-cd5a25ce0407",
3616
"cell_type": "code",
37-
"source": "import openlayers as ol",
17+
"execution_count": null,
18+
"id": "03aad39a-c9f9-443f-9e2d-cd5a25ce0407",
3819
"metadata": {
3920
"trusted": true
4021
},
4122
"outputs": [],
42-
"execution_count": 4
23+
"source": [
24+
"import openlayers as ol"
25+
]
4326
},
4427
{
45-
"id": "b2b99974-7e84-4712-8f76-043ed6319049",
4628
"cell_type": "code",
47-
"source": "m = ol.MapWidget()",
29+
"execution_count": null,
30+
"id": "b2b99974-7e84-4712-8f76-043ed6319049",
4831
"metadata": {
4932
"trusted": true
5033
},
5134
"outputs": [],
52-
"execution_count": 5
35+
"source": [
36+
"m = ol.MapWidget()"
37+
]
5338
},
5439
{
55-
"id": "6afbefe8-254b-405e-905c-5a035325fe13",
5640
"cell_type": "code",
57-
"source": "m",
41+
"execution_count": null,
42+
"id": "6afbefe8-254b-405e-905c-5a035325fe13",
5843
"metadata": {
5944
"trusted": true
6045
},
61-
"outputs": [
62-
{
63-
"execution_count": 6,
64-
"output_type": "execute_result",
65-
"data": {
66-
"text/plain": "MapWidget(height='400px', options={'view': {'center': (0.0, 0.0), 'zoom': 0, 'projection': 'EPSG:3857', '@@typ…",
67-
"application/vnd.jupyter.widget-view+json": {
68-
"version_major": 2,
69-
"version_minor": 1,
70-
"model_id": "594077a998d04fd4a78680779fb1cd23"
71-
}
72-
},
73-
"metadata": {}
74-
}
75-
],
76-
"execution_count": 6
46+
"outputs": [],
47+
"source": [
48+
"m"
49+
]
7750
},
7851
{
79-
"id": "f2aa5a68-adf1-4fcb-9d5d-06050c8e1641",
8052
"cell_type": "code",
81-
"source": "",
53+
"execution_count": null,
54+
"id": "f2aa5a68-adf1-4fcb-9d5d-06050c8e1641",
8255
"metadata": {
8356
"trusted": true
8457
},
8558
"outputs": [],
86-
"execution_count": null
59+
"source": []
60+
}
61+
],
62+
"metadata": {
63+
"kernelspec": {
64+
"display_name": "Python (Pyodide)",
65+
"language": "python",
66+
"name": "python"
67+
},
68+
"language_info": {
69+
"codemirror_mode": {
70+
"name": "python",
71+
"version": 3
72+
},
73+
"file_extension": ".py",
74+
"mimetype": "text/x-python",
75+
"name": "python",
76+
"nbconvert_exporter": "python",
77+
"pygments_lexer": "ipython3",
78+
"version": "3.8"
8779
}
88-
]
89-
}
80+
},
81+
"nbformat": 4,
82+
"nbformat_minor": 5
83+
}

0 commit comments

Comments
 (0)