geoai-py 0.5.4__tar.gz → 0.5.6__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {geoai_py-0.5.4 → geoai_py-0.5.6}/.gitignore +1 -0
- {geoai_py-0.5.4 → geoai_py-0.5.6}/PKG-INFO +1 -1
- geoai_py-0.5.6/docs/examples/download_naip.ipynb +175 -0
- geoai_py-0.5.6/docs/examples/globe_projection.ipynb +300 -0
- geoai_py-0.5.6/docs/examples/water_dynamics.ipynb +222 -0
- geoai_py-0.5.6/docs/workshops/GeoAI_Workshop_2025.ipynb +1303 -0
- geoai_py-0.5.6/docs/workshops/jupytext.toml +1 -0
- {geoai_py-0.5.4 → geoai_py-0.5.6}/geoai/__init__.py +1 -1
- {geoai_py-0.5.4 → geoai_py-0.5.6}/geoai/download.py +132 -2
- {geoai_py-0.5.4 → geoai_py-0.5.6}/geoai/geoai.py +3 -0
- {geoai_py-0.5.4 → geoai_py-0.5.6}/geoai/utils.py +2 -2
- {geoai_py-0.5.4 → geoai_py-0.5.6}/geoai_py.egg-info/PKG-INFO +1 -1
- {geoai_py-0.5.4 → geoai_py-0.5.6}/geoai_py.egg-info/SOURCES.txt +5 -0
- {geoai_py-0.5.4 → geoai_py-0.5.6}/mkdocs.yml +8 -8
- {geoai_py-0.5.4 → geoai_py-0.5.6}/pyproject.toml +2 -2
- {geoai_py-0.5.4 → geoai_py-0.5.6}/.editorconfig +0 -0
- {geoai_py-0.5.4 → geoai_py-0.5.6}/.github/FUNDING.yml +0 -0
- {geoai_py-0.5.4 → geoai_py-0.5.6}/.github/ISSUE_TEMPLATE/bug_report.md +0 -0
- {geoai_py-0.5.4 → geoai_py-0.5.6}/.github/ISSUE_TEMPLATE/config.yml +0 -0
- {geoai_py-0.5.4 → geoai_py-0.5.6}/.github/ISSUE_TEMPLATE/feature_request.md +0 -0
- {geoai_py-0.5.4 → geoai_py-0.5.6}/.github/dependabot.yml +0 -0
- {geoai_py-0.5.4 → geoai_py-0.5.6}/.github/workflows/docs-build.yml +0 -0
- {geoai_py-0.5.4 → geoai_py-0.5.6}/.github/workflows/docs.yml +0 -0
- {geoai_py-0.5.4 → geoai_py-0.5.6}/.github/workflows/macos.yml +0 -0
- {geoai_py-0.5.4 → geoai_py-0.5.6}/.github/workflows/pypi.yml +0 -0
- {geoai_py-0.5.4 → geoai_py-0.5.6}/.github/workflows/ubuntu.yml +0 -0
- {geoai_py-0.5.4 → geoai_py-0.5.6}/.github/workflows/windows.yml +0 -0
- {geoai_py-0.5.4 → geoai_py-0.5.6}/.pre-commit-config.yaml +0 -0
- {geoai_py-0.5.4 → geoai_py-0.5.6}/LICENSE +0 -0
- {geoai_py-0.5.4 → geoai_py-0.5.6}/MANIFEST.in +0 -0
- {geoai_py-0.5.4 → geoai_py-0.5.6}/README.md +0 -0
- {geoai_py-0.5.4 → geoai_py-0.5.6}/docs/CNAME +0 -0
- {geoai_py-0.5.4 → geoai_py-0.5.6}/docs/assets/logo.ico +0 -0
- {geoai_py-0.5.4 → geoai_py-0.5.6}/docs/assets/logo.png +0 -0
- {geoai_py-0.5.4 → geoai_py-0.5.6}/docs/assets/logo_rect.png +0 -0
- {geoai_py-0.5.4 → geoai_py-0.5.6}/docs/changelog.md +0 -0
- {geoai_py-0.5.4 → geoai_py-0.5.6}/docs/classify.md +0 -0
- {geoai_py-0.5.4 → geoai_py-0.5.6}/docs/contributing.md +0 -0
- {geoai_py-0.5.4 → geoai_py-0.5.6}/docs/download.md +0 -0
- {geoai_py-0.5.4 → geoai_py-0.5.6}/docs/examples/_template.ipynb +0 -0
- {geoai_py-0.5.4 → geoai_py-0.5.6}/docs/examples/building_footprints_africa.ipynb +0 -0
- {geoai_py-0.5.4 → geoai_py-0.5.6}/docs/examples/building_footprints_china.ipynb +0 -0
- {geoai_py-0.5.4 → geoai_py-0.5.6}/docs/examples/building_footprints_usa.ipynb +0 -0
- {geoai_py-0.5.4 → geoai_py-0.5.6}/docs/examples/building_regularization.ipynb +0 -0
- {geoai_py-0.5.4 → geoai_py-0.5.6}/docs/examples/car_detection.ipynb +0 -0
- {geoai_py-0.5.4 → geoai_py-0.5.6}/docs/examples/create_vector.ipynb +0 -0
- {geoai_py-0.5.4 → geoai_py-0.5.6}/docs/examples/data_visualization.ipynb +0 -0
- {geoai_py-0.5.4 → geoai_py-0.5.6}/docs/examples/dataviz/lidar_viz.ipynb +0 -0
- {geoai_py-0.5.4 → geoai_py-0.5.6}/docs/examples/dataviz/raster_viz.ipynb +0 -0
- {geoai_py-0.5.4 → geoai_py-0.5.6}/docs/examples/dataviz/vector_viz.ipynb +0 -0
- {geoai_py-0.5.4 → geoai_py-0.5.6}/docs/examples/download_data.ipynb +0 -0
- {geoai_py-0.5.4 → geoai_py-0.5.6}/docs/examples/download_sentinel2.ipynb +0 -0
- {geoai_py-0.5.4 → geoai_py-0.5.6}/docs/examples/edit_vector.ipynb +0 -0
- {geoai_py-0.5.4 → geoai_py-0.5.6}/docs/examples/geometric_properties.ipynb +0 -0
- {geoai_py-0.5.4 → geoai_py-0.5.6}/docs/examples/image_chips.ipynb +0 -0
- {geoai_py-0.5.4 → geoai_py-0.5.6}/docs/examples/jupytext.toml +0 -0
- {geoai_py-0.5.4 → geoai_py-0.5.6}/docs/examples/parking_spot_detection.ipynb +0 -0
- {geoai_py-0.5.4 → geoai_py-0.5.6}/docs/examples/planetary_computer.ipynb +0 -0
- {geoai_py-0.5.4 → geoai_py-0.5.6}/docs/examples/rastervision/semantic_segmentation.ipynb +0 -0
- {geoai_py-0.5.4 → geoai_py-0.5.6}/docs/examples/regularization.ipynb +0 -0
- {geoai_py-0.5.4 → geoai_py-0.5.6}/docs/examples/samgeo/arcgis.ipynb +0 -0
- {geoai_py-0.5.4 → geoai_py-0.5.6}/docs/examples/samgeo/automatic_mask_generator.ipynb +0 -0
- {geoai_py-0.5.4 → geoai_py-0.5.6}/docs/examples/samgeo/automatic_mask_generator_hq.ipynb +0 -0
- {geoai_py-0.5.4 → geoai_py-0.5.6}/docs/examples/samgeo/box_prompts.ipynb +0 -0
- {geoai_py-0.5.4 → geoai_py-0.5.6}/docs/examples/samgeo/fast_sam.ipynb +0 -0
- {geoai_py-0.5.4 → geoai_py-0.5.6}/docs/examples/samgeo/input_prompts.ipynb +0 -0
- {geoai_py-0.5.4 → geoai_py-0.5.6}/docs/examples/samgeo/input_prompts_hq.ipynb +0 -0
- {geoai_py-0.5.4 → geoai_py-0.5.6}/docs/examples/samgeo/maxar_open_data.ipynb +0 -0
- {geoai_py-0.5.4 → geoai_py-0.5.6}/docs/examples/samgeo/satellite-predictor.ipynb +0 -0
- {geoai_py-0.5.4 → geoai_py-0.5.6}/docs/examples/samgeo/satellite.ipynb +0 -0
- {geoai_py-0.5.4 → geoai_py-0.5.6}/docs/examples/samgeo/swimming_pools.ipynb +0 -0
- {geoai_py-0.5.4 → geoai_py-0.5.6}/docs/examples/samgeo/text_prompts.ipynb +0 -0
- {geoai_py-0.5.4 → geoai_py-0.5.6}/docs/examples/samgeo/text_prompts_batch.ipynb +0 -0
- {geoai_py-0.5.4 → geoai_py-0.5.6}/docs/examples/ship_detection.ipynb +0 -0
- {geoai_py-0.5.4 → geoai_py-0.5.6}/docs/examples/solar_panel_detection.ipynb +0 -0
- {geoai_py-0.5.4 → geoai_py-0.5.6}/docs/examples/text_prompt_segmentation.ipynb +0 -0
- {geoai_py-0.5.4 → geoai_py-0.5.6}/docs/examples/train_building_footprints_usa.ipynb +0 -0
- {geoai_py-0.5.4 → geoai_py-0.5.6}/docs/examples/train_car_detection.ipynb +0 -0
- {geoai_py-0.5.4 → geoai_py-0.5.6}/docs/examples/train_object_detection_model.ipynb +0 -0
- {geoai_py-0.5.4 → geoai_py-0.5.6}/docs/examples/train_ship_detection.ipynb +0 -0
- {geoai_py-0.5.4 → geoai_py-0.5.6}/docs/examples/train_solar_panel_detection.ipynb +0 -0
- {geoai_py-0.5.4 → geoai_py-0.5.6}/docs/examples/train_water_detection.ipynb +0 -0
- {geoai_py-0.5.4 → geoai_py-0.5.6}/docs/examples/view_metadata.ipynb +0 -0
- {geoai_py-0.5.4 → geoai_py-0.5.6}/docs/examples/wetland_mapping.ipynb +0 -0
- {geoai_py-0.5.4 → geoai_py-0.5.6}/docs/extract.md +0 -0
- {geoai_py-0.5.4 → geoai_py-0.5.6}/docs/faq.md +0 -0
- {geoai_py-0.5.4 → geoai_py-0.5.6}/docs/geoai.md +0 -0
- {geoai_py-0.5.4 → geoai_py-0.5.6}/docs/hf.md +0 -0
- {geoai_py-0.5.4 → geoai_py-0.5.6}/docs/index.md +0 -0
- {geoai_py-0.5.4 → geoai_py-0.5.6}/docs/installation.md +0 -0
- {geoai_py-0.5.4 → geoai_py-0.5.6}/docs/overrides/main.html +0 -0
- {geoai_py-0.5.4 → geoai_py-0.5.6}/docs/segment.md +0 -0
- {geoai_py-0.5.4 → geoai_py-0.5.6}/docs/segmentation.md +0 -0
- {geoai_py-0.5.4 → geoai_py-0.5.6}/docs/train.md +0 -0
- {geoai_py-0.5.4 → geoai_py-0.5.6}/docs/usage.md +0 -0
- {geoai_py-0.5.4 → geoai_py-0.5.6}/docs/utils.md +0 -0
- {geoai_py-0.5.4 → geoai_py-0.5.6}/geoai/classify.py +0 -0
- {geoai_py-0.5.4 → geoai_py-0.5.6}/geoai/extract.py +0 -0
- {geoai_py-0.5.4 → geoai_py-0.5.6}/geoai/hf.py +0 -0
- {geoai_py-0.5.4 → geoai_py-0.5.6}/geoai/segment.py +0 -0
- {geoai_py-0.5.4 → geoai_py-0.5.6}/geoai/segmentation.py +0 -0
- {geoai_py-0.5.4 → geoai_py-0.5.6}/geoai/train.py +0 -0
- {geoai_py-0.5.4 → geoai_py-0.5.6}/geoai_py.egg-info/dependency_links.txt +0 -0
- {geoai_py-0.5.4 → geoai_py-0.5.6}/geoai_py.egg-info/entry_points.txt +0 -0
- {geoai_py-0.5.4 → geoai_py-0.5.6}/geoai_py.egg-info/requires.txt +0 -0
- {geoai_py-0.5.4 → geoai_py-0.5.6}/geoai_py.egg-info/top_level.txt +0 -0
- {geoai_py-0.5.4 → geoai_py-0.5.6}/requirements.txt +0 -0
- {geoai_py-0.5.4 → geoai_py-0.5.6}/requirements_docs.txt +0 -0
- {geoai_py-0.5.4 → geoai_py-0.5.6}/setup.cfg +0 -0
- {geoai_py-0.5.4 → geoai_py-0.5.6}/tests/__init__.py +0 -0
- {geoai_py-0.5.4 → geoai_py-0.5.6}/tests/test_geoai.py +0 -0
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
{
|
|
2
|
+
"cells": [
|
|
3
|
+
{
|
|
4
|
+
"cell_type": "markdown",
|
|
5
|
+
"id": "0",
|
|
6
|
+
"metadata": {},
|
|
7
|
+
"source": [
|
|
8
|
+
"# Download NAIP Imagery\n",
|
|
9
|
+
"\n",
|
|
10
|
+
"[](https://colab.research.google.com/github/opengeos/geoai/blob/main/docs/examples/download_naip.ipynb)\n",
|
|
11
|
+
"\n",
|
|
12
|
+
"## Install package\n",
|
|
13
|
+
"\n",
|
|
14
|
+
"To use the `geoai-py` package, ensure it is installed in your environment. Uncomment the command below if needed."
|
|
15
|
+
]
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
"cell_type": "code",
|
|
19
|
+
"execution_count": null,
|
|
20
|
+
"id": "1",
|
|
21
|
+
"metadata": {},
|
|
22
|
+
"outputs": [],
|
|
23
|
+
"source": [
|
|
24
|
+
"# %pip install geoai-py"
|
|
25
|
+
]
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
"cell_type": "markdown",
|
|
29
|
+
"id": "2",
|
|
30
|
+
"metadata": {},
|
|
31
|
+
"source": [
|
|
32
|
+
"## Import library"
|
|
33
|
+
]
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
"cell_type": "code",
|
|
37
|
+
"execution_count": null,
|
|
38
|
+
"id": "3",
|
|
39
|
+
"metadata": {},
|
|
40
|
+
"outputs": [],
|
|
41
|
+
"source": [
|
|
42
|
+
"import geoai"
|
|
43
|
+
]
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
"cell_type": "markdown",
|
|
47
|
+
"id": "4",
|
|
48
|
+
"metadata": {},
|
|
49
|
+
"source": [
|
|
50
|
+
"## Create an interactive map"
|
|
51
|
+
]
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
"cell_type": "code",
|
|
55
|
+
"execution_count": null,
|
|
56
|
+
"id": "5",
|
|
57
|
+
"metadata": {},
|
|
58
|
+
"outputs": [],
|
|
59
|
+
"source": [
|
|
60
|
+
"m = geoai.Map(center=[47.031260, -99.156360], zoom=14)\n",
|
|
61
|
+
"m.add_basemap(\"Esri.WorldImagery\")\n",
|
|
62
|
+
"m"
|
|
63
|
+
]
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
"cell_type": "markdown",
|
|
67
|
+
"id": "6",
|
|
68
|
+
"metadata": {},
|
|
69
|
+
"source": [
|
|
70
|
+
"Use the drawing tool to select an area of interest (AOI) on the map. The selected area will be used to search for NAIP imagery."
|
|
71
|
+
]
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
"cell_type": "code",
|
|
75
|
+
"execution_count": null,
|
|
76
|
+
"id": "7",
|
|
77
|
+
"metadata": {},
|
|
78
|
+
"outputs": [],
|
|
79
|
+
"source": [
|
|
80
|
+
"if m.user_roi is not None:\n",
|
|
81
|
+
" bbox = m.user_roi_bounds()\n",
|
|
82
|
+
"else:\n",
|
|
83
|
+
" bbox = [-99.1705, 47.0149, -99.1296, 47.0365]"
|
|
84
|
+
]
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
"cell_type": "markdown",
|
|
88
|
+
"id": "8",
|
|
89
|
+
"metadata": {},
|
|
90
|
+
"source": [
|
|
91
|
+
"## Search for NAIP imagery"
|
|
92
|
+
]
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
"cell_type": "code",
|
|
96
|
+
"execution_count": null,
|
|
97
|
+
"id": "9",
|
|
98
|
+
"metadata": {},
|
|
99
|
+
"outputs": [],
|
|
100
|
+
"source": [
|
|
101
|
+
"items = geoai.pc_stac_search(\n",
|
|
102
|
+
" collection=\"naip\",\n",
|
|
103
|
+
" bbox=bbox,\n",
|
|
104
|
+
")"
|
|
105
|
+
]
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
"cell_type": "code",
|
|
109
|
+
"execution_count": null,
|
|
110
|
+
"id": "10",
|
|
111
|
+
"metadata": {},
|
|
112
|
+
"outputs": [],
|
|
113
|
+
"source": [
|
|
114
|
+
"items"
|
|
115
|
+
]
|
|
116
|
+
},
|
|
117
|
+
{
|
|
118
|
+
"cell_type": "markdown",
|
|
119
|
+
"id": "11",
|
|
120
|
+
"metadata": {},
|
|
121
|
+
"source": [
|
|
122
|
+
"## Visualize the search results"
|
|
123
|
+
]
|
|
124
|
+
},
|
|
125
|
+
{
|
|
126
|
+
"cell_type": "code",
|
|
127
|
+
"execution_count": null,
|
|
128
|
+
"id": "12",
|
|
129
|
+
"metadata": {},
|
|
130
|
+
"outputs": [],
|
|
131
|
+
"source": [
|
|
132
|
+
"geoai.view_pc_items(items=items)"
|
|
133
|
+
]
|
|
134
|
+
},
|
|
135
|
+
{
|
|
136
|
+
"cell_type": "markdown",
|
|
137
|
+
"id": "13",
|
|
138
|
+
"metadata": {},
|
|
139
|
+
"source": [
|
|
140
|
+
"## Download NAIP imagery"
|
|
141
|
+
]
|
|
142
|
+
},
|
|
143
|
+
{
|
|
144
|
+
"cell_type": "code",
|
|
145
|
+
"execution_count": null,
|
|
146
|
+
"id": "14",
|
|
147
|
+
"metadata": {},
|
|
148
|
+
"outputs": [],
|
|
149
|
+
"source": [
|
|
150
|
+
"geoai.pc_stac_download(items, output_dir=\"naip\", assets=[\"image\"])"
|
|
151
|
+
]
|
|
152
|
+
}
|
|
153
|
+
],
|
|
154
|
+
"metadata": {
|
|
155
|
+
"kernelspec": {
|
|
156
|
+
"display_name": "geo",
|
|
157
|
+
"language": "python",
|
|
158
|
+
"name": "python3"
|
|
159
|
+
},
|
|
160
|
+
"language_info": {
|
|
161
|
+
"codemirror_mode": {
|
|
162
|
+
"name": "ipython",
|
|
163
|
+
"version": 3
|
|
164
|
+
},
|
|
165
|
+
"file_extension": ".py",
|
|
166
|
+
"mimetype": "text/x-python",
|
|
167
|
+
"name": "python",
|
|
168
|
+
"nbconvert_exporter": "python",
|
|
169
|
+
"pygments_lexer": "ipython3",
|
|
170
|
+
"version": "3.12.2"
|
|
171
|
+
}
|
|
172
|
+
},
|
|
173
|
+
"nbformat": 4,
|
|
174
|
+
"nbformat_minor": 5
|
|
175
|
+
}
|
|
@@ -0,0 +1,300 @@
|
|
|
1
|
+
{
|
|
2
|
+
"cells": [
|
|
3
|
+
{
|
|
4
|
+
"cell_type": "markdown",
|
|
5
|
+
"metadata": {},
|
|
6
|
+
"source": [
|
|
7
|
+
"[](https://colab.research.google.com/github/opengeos/geoai/blob/main/docs/maplibre/globe_projection.ipynb)\n",
|
|
8
|
+
"\n",
|
|
9
|
+
"**Visualize geospatial data on a 3D globe**\n",
|
|
10
|
+
"\n",
|
|
11
|
+
"Uncomment the following line to install geoai if needed."
|
|
12
|
+
]
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
"cell_type": "code",
|
|
16
|
+
"execution_count": null,
|
|
17
|
+
"metadata": {},
|
|
18
|
+
"outputs": [],
|
|
19
|
+
"source": [
|
|
20
|
+
"# %pip install geoai-py"
|
|
21
|
+
]
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
"cell_type": "markdown",
|
|
25
|
+
"metadata": {},
|
|
26
|
+
"source": [
|
|
27
|
+
"## Import library"
|
|
28
|
+
]
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
"cell_type": "code",
|
|
32
|
+
"execution_count": null,
|
|
33
|
+
"metadata": {},
|
|
34
|
+
"outputs": [],
|
|
35
|
+
"source": [
|
|
36
|
+
"import geoai"
|
|
37
|
+
]
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
"cell_type": "markdown",
|
|
41
|
+
"metadata": {},
|
|
42
|
+
"source": [
|
|
43
|
+
"## Add globe control"
|
|
44
|
+
]
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
"cell_type": "code",
|
|
48
|
+
"execution_count": null,
|
|
49
|
+
"metadata": {},
|
|
50
|
+
"outputs": [],
|
|
51
|
+
"source": [
|
|
52
|
+
"m = geoai.MapLibre(center=[-100, 40], zoom=3, style=\"liberty\")\n",
|
|
53
|
+
"m.add_globe_control()\n",
|
|
54
|
+
"m"
|
|
55
|
+
]
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
"cell_type": "markdown",
|
|
59
|
+
"metadata": {},
|
|
60
|
+
"source": [
|
|
61
|
+
""
|
|
62
|
+
]
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
"cell_type": "markdown",
|
|
66
|
+
"metadata": {},
|
|
67
|
+
"source": [
|
|
68
|
+
"## Use globe projection"
|
|
69
|
+
]
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
"cell_type": "code",
|
|
73
|
+
"execution_count": null,
|
|
74
|
+
"metadata": {},
|
|
75
|
+
"outputs": [],
|
|
76
|
+
"source": [
|
|
77
|
+
"m = geoai.MapLibre(center=[-100, 40], zoom=3, style=\"positron\", projection=\"globe\")\n",
|
|
78
|
+
"m.add_basemap(\"Esri.WorldImagery\")\n",
|
|
79
|
+
"m.add_overture_3d_buildings()\n",
|
|
80
|
+
"m"
|
|
81
|
+
]
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
"cell_type": "markdown",
|
|
85
|
+
"metadata": {},
|
|
86
|
+
"source": [
|
|
87
|
+
""
|
|
88
|
+
]
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
"cell_type": "markdown",
|
|
92
|
+
"metadata": {},
|
|
93
|
+
"source": [
|
|
94
|
+
"## Create 3D choropleth maps"
|
|
95
|
+
]
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
"cell_type": "code",
|
|
99
|
+
"execution_count": null,
|
|
100
|
+
"metadata": {},
|
|
101
|
+
"outputs": [],
|
|
102
|
+
"source": [
|
|
103
|
+
"m = geoai.MapLibre(\n",
|
|
104
|
+
" center=[19.43, 49.49], zoom=3, pitch=60, style=\"positron\", projection=\"globe\"\n",
|
|
105
|
+
")\n",
|
|
106
|
+
"source = {\n",
|
|
107
|
+
" \"type\": \"geojson\",\n",
|
|
108
|
+
" \"data\": \"https://docs.maptiler.com/sdk-js/assets/Mean_age_of_women_at_first_marriage_in_2019.geojson\",\n",
|
|
109
|
+
"}\n",
|
|
110
|
+
"m.add_source(\"countries\", source)\n",
|
|
111
|
+
"layer = {\n",
|
|
112
|
+
" \"id\": \"eu-countries\",\n",
|
|
113
|
+
" \"source\": \"countries\",\n",
|
|
114
|
+
" \"type\": \"fill-extrusion\",\n",
|
|
115
|
+
" \"paint\": {\n",
|
|
116
|
+
" \"fill-extrusion-color\": [\n",
|
|
117
|
+
" \"interpolate\",\n",
|
|
118
|
+
" [\"linear\"],\n",
|
|
119
|
+
" [\"get\", \"age\"],\n",
|
|
120
|
+
" 23.0,\n",
|
|
121
|
+
" \"#fff5eb\",\n",
|
|
122
|
+
" 24.0,\n",
|
|
123
|
+
" \"#fee6ce\",\n",
|
|
124
|
+
" 25.0,\n",
|
|
125
|
+
" \"#fdd0a2\",\n",
|
|
126
|
+
" 26.0,\n",
|
|
127
|
+
" \"#fdae6b\",\n",
|
|
128
|
+
" 27.0,\n",
|
|
129
|
+
" \"#fd8d3c\",\n",
|
|
130
|
+
" 28.0,\n",
|
|
131
|
+
" \"#f16913\",\n",
|
|
132
|
+
" 29.0,\n",
|
|
133
|
+
" \"#d94801\",\n",
|
|
134
|
+
" 30.0,\n",
|
|
135
|
+
" \"#8c2d04\",\n",
|
|
136
|
+
" ],\n",
|
|
137
|
+
" \"fill-extrusion-opacity\": 1,\n",
|
|
138
|
+
" \"fill-extrusion-height\": [\"*\", [\"get\", \"age\"], 5000],\n",
|
|
139
|
+
" },\n",
|
|
140
|
+
"}\n",
|
|
141
|
+
"first_symbol_layer_id = m.find_first_symbol_layer()[\"id\"]\n",
|
|
142
|
+
"m.add_layer(layer, first_symbol_layer_id)\n",
|
|
143
|
+
"m.add_layer_control()\n",
|
|
144
|
+
"m"
|
|
145
|
+
]
|
|
146
|
+
},
|
|
147
|
+
{
|
|
148
|
+
"cell_type": "code",
|
|
149
|
+
"execution_count": null,
|
|
150
|
+
"metadata": {},
|
|
151
|
+
"outputs": [],
|
|
152
|
+
"source": [
|
|
153
|
+
"data = \"https://github.com/opengeos/datasets/releases/download/vector/countries.geojson\""
|
|
154
|
+
]
|
|
155
|
+
},
|
|
156
|
+
{
|
|
157
|
+
"cell_type": "code",
|
|
158
|
+
"execution_count": null,
|
|
159
|
+
"metadata": {},
|
|
160
|
+
"outputs": [],
|
|
161
|
+
"source": [
|
|
162
|
+
"m = geoai.MapLibre(style=\"liberty\", projection=\"globe\")\n",
|
|
163
|
+
"first_symbol_id = m.find_first_symbol_layer()[\"id\"]\n",
|
|
164
|
+
"m.add_data(\n",
|
|
165
|
+
" data,\n",
|
|
166
|
+
" column=\"POP_EST\",\n",
|
|
167
|
+
" scheme=\"Quantiles\",\n",
|
|
168
|
+
" cmap=\"Blues\",\n",
|
|
169
|
+
" legend_title=\"Population\",\n",
|
|
170
|
+
" name=\"Population\",\n",
|
|
171
|
+
" before_id=first_symbol_id,\n",
|
|
172
|
+
" extrude=True,\n",
|
|
173
|
+
" scale_factor=1000,\n",
|
|
174
|
+
")\n",
|
|
175
|
+
"m.add_layer_control()\n",
|
|
176
|
+
"m"
|
|
177
|
+
]
|
|
178
|
+
},
|
|
179
|
+
{
|
|
180
|
+
"cell_type": "markdown",
|
|
181
|
+
"metadata": {},
|
|
182
|
+
"source": [
|
|
183
|
+
""
|
|
184
|
+
]
|
|
185
|
+
},
|
|
186
|
+
{
|
|
187
|
+
"cell_type": "markdown",
|
|
188
|
+
"metadata": {},
|
|
189
|
+
"source": [
|
|
190
|
+
"## Vector data"
|
|
191
|
+
]
|
|
192
|
+
},
|
|
193
|
+
{
|
|
194
|
+
"cell_type": "code",
|
|
195
|
+
"execution_count": null,
|
|
196
|
+
"metadata": {},
|
|
197
|
+
"outputs": [],
|
|
198
|
+
"source": [
|
|
199
|
+
"m = geoai.MapLibre(style=\"liberty\", projection=\"globe\")\n",
|
|
200
|
+
"train_raster_url = (\n",
|
|
201
|
+
" \"https://huggingface.co/datasets/giswqs/geospatial/resolve/main/naip_rgb_train.tif\"\n",
|
|
202
|
+
")\n",
|
|
203
|
+
"train_vector_url = \"https://huggingface.co/datasets/giswqs/geospatial/resolve/main/naip_train_buildings.geojson\"\n",
|
|
204
|
+
"m.add_cog_layer(train_raster_url, name=\"NAIP\")\n",
|
|
205
|
+
"paint = {\"fill-color\": \"#ff0000\", \"fill-opacity\": 0.4, \"fill-outline-color\": \"#ffff00\"}\n",
|
|
206
|
+
"m.add_geojson(train_vector_url, name=\"Buildings\", layer_type=\"fill\", paint=paint)\n",
|
|
207
|
+
"m.add_layer_control()\n",
|
|
208
|
+
"m"
|
|
209
|
+
]
|
|
210
|
+
},
|
|
211
|
+
{
|
|
212
|
+
"cell_type": "markdown",
|
|
213
|
+
"metadata": {},
|
|
214
|
+
"source": [
|
|
215
|
+
"## Planetary Computer"
|
|
216
|
+
]
|
|
217
|
+
},
|
|
218
|
+
{
|
|
219
|
+
"cell_type": "code",
|
|
220
|
+
"execution_count": null,
|
|
221
|
+
"metadata": {},
|
|
222
|
+
"outputs": [],
|
|
223
|
+
"source": [
|
|
224
|
+
"collection = \"landsat-8-c2-l2\"\n",
|
|
225
|
+
"item = \"LC08_L2SP_047027_20201204_02_T1\""
|
|
226
|
+
]
|
|
227
|
+
},
|
|
228
|
+
{
|
|
229
|
+
"cell_type": "code",
|
|
230
|
+
"execution_count": null,
|
|
231
|
+
"metadata": {},
|
|
232
|
+
"outputs": [],
|
|
233
|
+
"source": [
|
|
234
|
+
"m = geoai.MapLibre(projection=\"globe\")\n",
|
|
235
|
+
"m.add_stac_layer(\n",
|
|
236
|
+
" collection=collection, item=item, assets=\"SR_B7,SR_B5,SR_B4\", name=\"False color\"\n",
|
|
237
|
+
")\n",
|
|
238
|
+
"m"
|
|
239
|
+
]
|
|
240
|
+
},
|
|
241
|
+
{
|
|
242
|
+
"cell_type": "code",
|
|
243
|
+
"execution_count": null,
|
|
244
|
+
"metadata": {},
|
|
245
|
+
"outputs": [],
|
|
246
|
+
"source": [
|
|
247
|
+
"m = geoai.MapLibre(projection=\"globe\")\n",
|
|
248
|
+
"m.add_stac_layer(\n",
|
|
249
|
+
" collection=collection,\n",
|
|
250
|
+
" item=item,\n",
|
|
251
|
+
" assets=[\"SR_B5\", \"SR_B4\", \"SR_B3\"],\n",
|
|
252
|
+
" name=\"Color infrared\",\n",
|
|
253
|
+
")\n",
|
|
254
|
+
"m"
|
|
255
|
+
]
|
|
256
|
+
},
|
|
257
|
+
{
|
|
258
|
+
"cell_type": "code",
|
|
259
|
+
"execution_count": null,
|
|
260
|
+
"metadata": {},
|
|
261
|
+
"outputs": [],
|
|
262
|
+
"source": [
|
|
263
|
+
"m = geoai.MapLibre(projection=\"globe\")\n",
|
|
264
|
+
"m.add_stac_layer(\n",
|
|
265
|
+
" collection=collection, item=item, assets=\"SR_B5,SR_B4,SR_B3\", name=\"Color infrared\"\n",
|
|
266
|
+
")\n",
|
|
267
|
+
"m.add_stac_layer(\n",
|
|
268
|
+
" collection=collection,\n",
|
|
269
|
+
" item=item,\n",
|
|
270
|
+
" expression=\"(SR_B5-SR_B4)/(SR_B5+SR_B4)\",\n",
|
|
271
|
+
" rescale=\"-1,1\",\n",
|
|
272
|
+
" colormap_name=\"greens\",\n",
|
|
273
|
+
" name=\"NDVI Green\",\n",
|
|
274
|
+
")\n",
|
|
275
|
+
"m"
|
|
276
|
+
]
|
|
277
|
+
}
|
|
278
|
+
],
|
|
279
|
+
"metadata": {
|
|
280
|
+
"kernelspec": {
|
|
281
|
+
"display_name": "Python 3 (ipykernel)",
|
|
282
|
+
"language": "python",
|
|
283
|
+
"name": "python3"
|
|
284
|
+
},
|
|
285
|
+
"language_info": {
|
|
286
|
+
"codemirror_mode": {
|
|
287
|
+
"name": "ipython",
|
|
288
|
+
"version": 3
|
|
289
|
+
},
|
|
290
|
+
"file_extension": ".py",
|
|
291
|
+
"mimetype": "text/x-python",
|
|
292
|
+
"name": "python",
|
|
293
|
+
"nbconvert_exporter": "python",
|
|
294
|
+
"pygments_lexer": "ipython3",
|
|
295
|
+
"version": "3.12.2"
|
|
296
|
+
}
|
|
297
|
+
},
|
|
298
|
+
"nbformat": 4,
|
|
299
|
+
"nbformat_minor": 4
|
|
300
|
+
}
|
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
{
|
|
2
|
+
"cells": [
|
|
3
|
+
{
|
|
4
|
+
"cell_type": "markdown",
|
|
5
|
+
"id": "0",
|
|
6
|
+
"metadata": {},
|
|
7
|
+
"source": [
|
|
8
|
+
"# Mapping Water Dynamics with NAIP Imagery and GeoAI\n",
|
|
9
|
+
"\n",
|
|
10
|
+
"[](https://colab.research.google.com/github/opengeos/geoai/blob/main/docs/examples/water_dynamics.ipynb)\n",
|
|
11
|
+
"\n",
|
|
12
|
+
"## Install package\n",
|
|
13
|
+
"\n",
|
|
14
|
+
"To use the `geoai-py` package, ensure it is installed in your environment. Uncomment the command below if needed."
|
|
15
|
+
]
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
"cell_type": "code",
|
|
19
|
+
"execution_count": null,
|
|
20
|
+
"id": "1",
|
|
21
|
+
"metadata": {},
|
|
22
|
+
"outputs": [],
|
|
23
|
+
"source": [
|
|
24
|
+
"# %pip install geoai-py"
|
|
25
|
+
]
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
"cell_type": "markdown",
|
|
29
|
+
"id": "2",
|
|
30
|
+
"metadata": {},
|
|
31
|
+
"source": [
|
|
32
|
+
"## Import library"
|
|
33
|
+
]
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
"cell_type": "code",
|
|
37
|
+
"execution_count": null,
|
|
38
|
+
"id": "3",
|
|
39
|
+
"metadata": {},
|
|
40
|
+
"outputs": [],
|
|
41
|
+
"source": [
|
|
42
|
+
"import geoai"
|
|
43
|
+
]
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
"cell_type": "markdown",
|
|
47
|
+
"id": "4",
|
|
48
|
+
"metadata": {},
|
|
49
|
+
"source": [
|
|
50
|
+
"## Create an interactive map"
|
|
51
|
+
]
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
"cell_type": "code",
|
|
55
|
+
"execution_count": null,
|
|
56
|
+
"id": "5",
|
|
57
|
+
"metadata": {},
|
|
58
|
+
"outputs": [],
|
|
59
|
+
"source": [
|
|
60
|
+
"m = geoai.Map(center=[47.031260, -99.156360], zoom=14)\n",
|
|
61
|
+
"m.add_basemap(\"Esri.WorldImagery\")\n",
|
|
62
|
+
"m"
|
|
63
|
+
]
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
"cell_type": "markdown",
|
|
67
|
+
"id": "6",
|
|
68
|
+
"metadata": {},
|
|
69
|
+
"source": [
|
|
70
|
+
"Use the drawing tool to select an area of interest (AOI) on the map. The selected area will be used to search for NAIP imagery."
|
|
71
|
+
]
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
"cell_type": "code",
|
|
75
|
+
"execution_count": null,
|
|
76
|
+
"id": "7",
|
|
77
|
+
"metadata": {},
|
|
78
|
+
"outputs": [],
|
|
79
|
+
"source": [
|
|
80
|
+
"if m.user_roi is not None:\n",
|
|
81
|
+
" bbox = m.user_roi_bounds()\n",
|
|
82
|
+
"else:\n",
|
|
83
|
+
" bbox = [-99.1705, 47.0149, -99.1296, 47.0365]"
|
|
84
|
+
]
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
"cell_type": "markdown",
|
|
88
|
+
"id": "8",
|
|
89
|
+
"metadata": {},
|
|
90
|
+
"source": [
|
|
91
|
+
"## Search for NAIP imagery"
|
|
92
|
+
]
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
"cell_type": "code",
|
|
96
|
+
"execution_count": null,
|
|
97
|
+
"id": "9",
|
|
98
|
+
"metadata": {},
|
|
99
|
+
"outputs": [],
|
|
100
|
+
"source": [
|
|
101
|
+
"items = geoai.pc_stac_search(\n",
|
|
102
|
+
" collection=\"naip\",\n",
|
|
103
|
+
" bbox=bbox,\n",
|
|
104
|
+
")"
|
|
105
|
+
]
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
"cell_type": "code",
|
|
109
|
+
"execution_count": null,
|
|
110
|
+
"id": "10",
|
|
111
|
+
"metadata": {},
|
|
112
|
+
"outputs": [],
|
|
113
|
+
"source": [
|
|
114
|
+
"items"
|
|
115
|
+
]
|
|
116
|
+
},
|
|
117
|
+
{
|
|
118
|
+
"cell_type": "markdown",
|
|
119
|
+
"id": "11",
|
|
120
|
+
"metadata": {},
|
|
121
|
+
"source": [
|
|
122
|
+
"## Visualize the search results"
|
|
123
|
+
]
|
|
124
|
+
},
|
|
125
|
+
{
|
|
126
|
+
"cell_type": "code",
|
|
127
|
+
"execution_count": null,
|
|
128
|
+
"id": "12",
|
|
129
|
+
"metadata": {},
|
|
130
|
+
"outputs": [],
|
|
131
|
+
"source": [
|
|
132
|
+
"geoai.view_pc_items(items=items)"
|
|
133
|
+
]
|
|
134
|
+
},
|
|
135
|
+
{
|
|
136
|
+
"cell_type": "markdown",
|
|
137
|
+
"id": "13",
|
|
138
|
+
"metadata": {},
|
|
139
|
+
"source": [
|
|
140
|
+
"## Download NAIP imagery"
|
|
141
|
+
]
|
|
142
|
+
},
|
|
143
|
+
{
|
|
144
|
+
"cell_type": "code",
|
|
145
|
+
"execution_count": null,
|
|
146
|
+
"id": "14",
|
|
147
|
+
"metadata": {},
|
|
148
|
+
"outputs": [],
|
|
149
|
+
"source": [
|
|
150
|
+
"geoai.pc_stac_download(items, output_dir=\"naip\", assets=[\"image\"])"
|
|
151
|
+
]
|
|
152
|
+
},
|
|
153
|
+
{
|
|
154
|
+
"cell_type": "markdown",
|
|
155
|
+
"id": "15",
|
|
156
|
+
"metadata": {},
|
|
157
|
+
"source": [
|
|
158
|
+
"## Object detection"
|
|
159
|
+
]
|
|
160
|
+
},
|
|
161
|
+
{
|
|
162
|
+
"cell_type": "code",
|
|
163
|
+
"execution_count": null,
|
|
164
|
+
"id": "16",
|
|
165
|
+
"metadata": {},
|
|
166
|
+
"outputs": [],
|
|
167
|
+
"source": [
|
|
168
|
+
"geoai.object_detection_batch(\n",
|
|
169
|
+
" input_paths=\"naip\",\n",
|
|
170
|
+
" output_dir=\"water\",\n",
|
|
171
|
+
" model_path=\"water_detection.pth\",\n",
|
|
172
|
+
" window_size=512,\n",
|
|
173
|
+
" overlap=128,\n",
|
|
174
|
+
" confidence_threshold=0.5,\n",
|
|
175
|
+
" batch_size=4,\n",
|
|
176
|
+
" num_channels=4,\n",
|
|
177
|
+
")"
|
|
178
|
+
]
|
|
179
|
+
},
|
|
180
|
+
{
|
|
181
|
+
"cell_type": "markdown",
|
|
182
|
+
"id": "17",
|
|
183
|
+
"metadata": {},
|
|
184
|
+
"source": [
|
|
185
|
+
"## Convert raster to vector"
|
|
186
|
+
]
|
|
187
|
+
},
|
|
188
|
+
{
|
|
189
|
+
"cell_type": "code",
|
|
190
|
+
"execution_count": null,
|
|
191
|
+
"id": "18",
|
|
192
|
+
"metadata": {},
|
|
193
|
+
"outputs": [],
|
|
194
|
+
"source": [
|
|
195
|
+
"geoai.raster_to_vector_batch(\n",
|
|
196
|
+
" input_dir=\"water\", output_dir=\"vector\", min_area=100, simplify_tolerance=1\n",
|
|
197
|
+
")"
|
|
198
|
+
]
|
|
199
|
+
}
|
|
200
|
+
],
|
|
201
|
+
"metadata": {
|
|
202
|
+
"kernelspec": {
|
|
203
|
+
"display_name": "Python 3 (ipykernel)",
|
|
204
|
+
"language": "python",
|
|
205
|
+
"name": "python3"
|
|
206
|
+
},
|
|
207
|
+
"language_info": {
|
|
208
|
+
"codemirror_mode": {
|
|
209
|
+
"name": "ipython",
|
|
210
|
+
"version": 3
|
|
211
|
+
},
|
|
212
|
+
"file_extension": ".py",
|
|
213
|
+
"mimetype": "text/x-python",
|
|
214
|
+
"name": "python",
|
|
215
|
+
"nbconvert_exporter": "python",
|
|
216
|
+
"pygments_lexer": "ipython3",
|
|
217
|
+
"version": "3.12.9"
|
|
218
|
+
}
|
|
219
|
+
},
|
|
220
|
+
"nbformat": 4,
|
|
221
|
+
"nbformat_minor": 5
|
|
222
|
+
}
|