geoai-py 0.2.3__tar.gz → 0.3.1__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.
Files changed (78) hide show
  1. {geoai_py-0.2.3 → geoai_py-0.3.1}/.gitignore +1 -0
  2. {geoai_py-0.2.3 → geoai_py-0.3.1}/PKG-INFO +1 -1
  3. geoai_py-0.3.1/docs/examples/building_footprints_usa.ipynb +278 -0
  4. geoai_py-0.3.1/docs/examples/building_regularization.ipynb +257 -0
  5. {geoai_py-0.2.3 → geoai_py-0.3.1}/docs/examples/data_visualization.ipynb +2 -2
  6. {geoai_py-0.2.3 → geoai_py-0.3.1}/docs/installation.md +8 -0
  7. geoai_py-0.3.1/docs/utils.md +3 -0
  8. {geoai_py-0.2.3 → geoai_py-0.3.1}/geoai/__init__.py +1 -1
  9. geoai_py-0.3.1/geoai/extract.py +1771 -0
  10. {geoai_py-0.2.3 → geoai_py-0.3.1}/geoai/geoai.py +1 -1
  11. {geoai_py-0.2.3 → geoai_py-0.3.1}/geoai/preprocess.py +245 -2
  12. geoai_py-0.2.3/geoai/common.py → geoai_py-0.3.1/geoai/utils.py +463 -4
  13. {geoai_py-0.2.3 → geoai_py-0.3.1}/geoai_py.egg-info/PKG-INFO +1 -1
  14. {geoai_py-0.2.3 → geoai_py-0.3.1}/geoai_py.egg-info/SOURCES.txt +3 -2
  15. {geoai_py-0.2.3 → geoai_py-0.3.1}/mkdocs.yml +2 -1
  16. {geoai_py-0.2.3 → geoai_py-0.3.1}/pyproject.toml +2 -2
  17. geoai_py-0.2.3/docs/common.md +0 -3
  18. geoai_py-0.2.3/docs/examples/building_footprints_usa.ipynb +0 -157
  19. geoai_py-0.2.3/geoai/extract.py +0 -832
  20. {geoai_py-0.2.3 → geoai_py-0.3.1}/.editorconfig +0 -0
  21. {geoai_py-0.2.3 → geoai_py-0.3.1}/.github/ISSUE_TEMPLATE/bug_report.md +0 -0
  22. {geoai_py-0.2.3 → geoai_py-0.3.1}/.github/ISSUE_TEMPLATE/config.yml +0 -0
  23. {geoai_py-0.2.3 → geoai_py-0.3.1}/.github/ISSUE_TEMPLATE/feature_request.md +0 -0
  24. {geoai_py-0.2.3 → geoai_py-0.3.1}/.github/dependabot.yml +0 -0
  25. {geoai_py-0.2.3 → geoai_py-0.3.1}/.github/workflows/docs-build.yml +0 -0
  26. {geoai_py-0.2.3 → geoai_py-0.3.1}/.github/workflows/docs.yml +0 -0
  27. {geoai_py-0.2.3 → geoai_py-0.3.1}/.github/workflows/macos.yml +0 -0
  28. {geoai_py-0.2.3 → geoai_py-0.3.1}/.github/workflows/pypi.yml +0 -0
  29. {geoai_py-0.2.3 → geoai_py-0.3.1}/.github/workflows/ubuntu.yml +0 -0
  30. {geoai_py-0.2.3 → geoai_py-0.3.1}/.github/workflows/windows.yml +0 -0
  31. {geoai_py-0.2.3 → geoai_py-0.3.1}/.pre-commit-config.yaml +0 -0
  32. {geoai_py-0.2.3 → geoai_py-0.3.1}/LICENSE +0 -0
  33. {geoai_py-0.2.3 → geoai_py-0.3.1}/MANIFEST.in +0 -0
  34. {geoai_py-0.2.3 → geoai_py-0.3.1}/README.md +0 -0
  35. {geoai_py-0.2.3 → geoai_py-0.3.1}/docs/CNAME +0 -0
  36. {geoai_py-0.2.3 → geoai_py-0.3.1}/docs/changelog.md +0 -0
  37. {geoai_py-0.2.3 → geoai_py-0.3.1}/docs/contributing.md +0 -0
  38. {geoai_py-0.2.3 → geoai_py-0.3.1}/docs/download.md +0 -0
  39. {geoai_py-0.2.3 → geoai_py-0.3.1}/docs/examples/dataviz/lidar_viz.ipynb +0 -0
  40. {geoai_py-0.2.3 → geoai_py-0.3.1}/docs/examples/dataviz/raster_viz.ipynb +0 -0
  41. {geoai_py-0.2.3 → geoai_py-0.3.1}/docs/examples/dataviz/vector_viz.ipynb +0 -0
  42. {geoai_py-0.2.3 → geoai_py-0.3.1}/docs/examples/download_data.ipynb +0 -0
  43. {geoai_py-0.2.3 → geoai_py-0.3.1}/docs/examples/image_chips.ipynb +0 -0
  44. {geoai_py-0.2.3 → geoai_py-0.3.1}/docs/examples/jupytext.toml +0 -0
  45. {geoai_py-0.2.3 → geoai_py-0.3.1}/docs/examples/rastervision/semantic_segmentation.ipynb +0 -0
  46. {geoai_py-0.2.3 → geoai_py-0.3.1}/docs/examples/samgeo/arcgis.ipynb +0 -0
  47. {geoai_py-0.2.3 → geoai_py-0.3.1}/docs/examples/samgeo/automatic_mask_generator.ipynb +0 -0
  48. {geoai_py-0.2.3 → geoai_py-0.3.1}/docs/examples/samgeo/automatic_mask_generator_hq.ipynb +0 -0
  49. {geoai_py-0.2.3 → geoai_py-0.3.1}/docs/examples/samgeo/box_prompts.ipynb +0 -0
  50. {geoai_py-0.2.3 → geoai_py-0.3.1}/docs/examples/samgeo/fast_sam.ipynb +0 -0
  51. {geoai_py-0.2.3 → geoai_py-0.3.1}/docs/examples/samgeo/input_prompts.ipynb +0 -0
  52. {geoai_py-0.2.3 → geoai_py-0.3.1}/docs/examples/samgeo/input_prompts_hq.ipynb +0 -0
  53. {geoai_py-0.2.3 → geoai_py-0.3.1}/docs/examples/samgeo/maxar_open_data.ipynb +0 -0
  54. {geoai_py-0.2.3 → geoai_py-0.3.1}/docs/examples/samgeo/satellite-predictor.ipynb +0 -0
  55. {geoai_py-0.2.3 → geoai_py-0.3.1}/docs/examples/samgeo/satellite.ipynb +0 -0
  56. {geoai_py-0.2.3 → geoai_py-0.3.1}/docs/examples/samgeo/swimming_pools.ipynb +0 -0
  57. {geoai_py-0.2.3 → geoai_py-0.3.1}/docs/examples/samgeo/text_prompts.ipynb +0 -0
  58. {geoai_py-0.2.3 → geoai_py-0.3.1}/docs/examples/samgeo/text_prompts_batch.ipynb +0 -0
  59. {geoai_py-0.2.3 → geoai_py-0.3.1}/docs/examples/view_metadata.ipynb +0 -0
  60. {geoai_py-0.2.3 → geoai_py-0.3.1}/docs/extract.md +0 -0
  61. {geoai_py-0.2.3 → geoai_py-0.3.1}/docs/faq.md +0 -0
  62. {geoai_py-0.2.3 → geoai_py-0.3.1}/docs/geoai.md +0 -0
  63. {geoai_py-0.2.3 → geoai_py-0.3.1}/docs/index.md +0 -0
  64. {geoai_py-0.2.3 → geoai_py-0.3.1}/docs/overrides/main.html +0 -0
  65. {geoai_py-0.2.3 → geoai_py-0.3.1}/docs/preprocess.md +0 -0
  66. {geoai_py-0.2.3 → geoai_py-0.3.1}/docs/segmentation.md +0 -0
  67. {geoai_py-0.2.3 → geoai_py-0.3.1}/docs/usage.md +0 -0
  68. {geoai_py-0.2.3 → geoai_py-0.3.1}/geoai/download.py +0 -0
  69. {geoai_py-0.2.3 → geoai_py-0.3.1}/geoai/segmentation.py +0 -0
  70. {geoai_py-0.2.3 → geoai_py-0.3.1}/geoai_py.egg-info/dependency_links.txt +0 -0
  71. {geoai_py-0.2.3 → geoai_py-0.3.1}/geoai_py.egg-info/entry_points.txt +0 -0
  72. {geoai_py-0.2.3 → geoai_py-0.3.1}/geoai_py.egg-info/requires.txt +0 -0
  73. {geoai_py-0.2.3 → geoai_py-0.3.1}/geoai_py.egg-info/top_level.txt +0 -0
  74. {geoai_py-0.2.3 → geoai_py-0.3.1}/requirements.txt +0 -0
  75. {geoai_py-0.2.3 → geoai_py-0.3.1}/requirements_docs.txt +0 -0
  76. {geoai_py-0.2.3 → geoai_py-0.3.1}/setup.cfg +0 -0
  77. {geoai_py-0.2.3 → geoai_py-0.3.1}/tests/__init__.py +0 -0
  78. {geoai_py-0.2.3 → geoai_py-0.3.1}/tests/test_geoai.py +0 -0
@@ -13,6 +13,7 @@ private/
13
13
  docs/examples/*.md
14
14
  *.xml
15
15
  docs/examples/output/
16
+ docs/examples/*.png
16
17
 
17
18
  # Distribution / packaging
18
19
  .Python
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: geoai-py
3
- Version: 0.2.3
3
+ Version: 0.3.1
4
4
  Summary: A Python package for using Artificial Intelligence (AI) with geospatial data
5
5
  Author-email: Qiusheng Wu <giswqs@gmail.com>
6
6
  License: MIT License
@@ -0,0 +1,278 @@
1
+ {
2
+ "cells": [
3
+ {
4
+ "cell_type": "markdown",
5
+ "metadata": {},
6
+ "source": [
7
+ "# Building Footprint Extraction for the USA\n",
8
+ "\n",
9
+ "[![image](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/opengeos/geoai/blob/main/docs/examples/building_footprints_usa.ipynb)\n",
10
+ "\n",
11
+ "## Install package\n",
12
+ "To use the `geoai-py` package, ensure it is installed in your environment. Uncomment the command below if needed."
13
+ ]
14
+ },
15
+ {
16
+ "cell_type": "code",
17
+ "execution_count": null,
18
+ "metadata": {},
19
+ "outputs": [],
20
+ "source": [
21
+ "# %pip install geoai-py"
22
+ ]
23
+ },
24
+ {
25
+ "cell_type": "markdown",
26
+ "metadata": {},
27
+ "source": [
28
+ "## Import libraries"
29
+ ]
30
+ },
31
+ {
32
+ "cell_type": "code",
33
+ "execution_count": null,
34
+ "metadata": {},
35
+ "outputs": [],
36
+ "source": [
37
+ "import geoai"
38
+ ]
39
+ },
40
+ {
41
+ "cell_type": "markdown",
42
+ "metadata": {},
43
+ "source": [
44
+ "## Download sample data"
45
+ ]
46
+ },
47
+ {
48
+ "cell_type": "code",
49
+ "execution_count": null,
50
+ "metadata": {},
51
+ "outputs": [],
52
+ "source": [
53
+ "raster_url = (\n",
54
+ " \"https://huggingface.co/datasets/giswqs/geospatial/resolve/main/naip_train.tif\"\n",
55
+ ")\n",
56
+ "vector_url = \"https://huggingface.co/datasets/giswqs/geospatial/resolve/main/naip_train_buildings.geojson\""
57
+ ]
58
+ },
59
+ {
60
+ "cell_type": "code",
61
+ "execution_count": null,
62
+ "metadata": {},
63
+ "outputs": [],
64
+ "source": [
65
+ "raster_path = geoai.download_file(raster_url)"
66
+ ]
67
+ },
68
+ {
69
+ "cell_type": "code",
70
+ "execution_count": null,
71
+ "metadata": {},
72
+ "outputs": [],
73
+ "source": [
74
+ "vector_path = geoai.download_file(vector_url)"
75
+ ]
76
+ },
77
+ {
78
+ "cell_type": "markdown",
79
+ "metadata": {},
80
+ "source": [
81
+ "## Initialize building footprint extraction pretrained model\n",
82
+ "\n",
83
+ "The pretained model is adapted from the Esri [building footprint extraction](https://www.arcgis.com/home/item.html?id=a6857359a1cd44839781a4f113cd5934) model for the USA. Credits to Esri for the model."
84
+ ]
85
+ },
86
+ {
87
+ "cell_type": "code",
88
+ "execution_count": null,
89
+ "metadata": {},
90
+ "outputs": [],
91
+ "source": [
92
+ "extractor = geoai.BuildingFootprintExtractor()"
93
+ ]
94
+ },
95
+ {
96
+ "cell_type": "markdown",
97
+ "metadata": {},
98
+ "source": [
99
+ "## Extract building footprints\n",
100
+ "\n",
101
+ "### Option 1: Extract building footprints as raster"
102
+ ]
103
+ },
104
+ {
105
+ "cell_type": "code",
106
+ "execution_count": null,
107
+ "metadata": {},
108
+ "outputs": [],
109
+ "source": [
110
+ "mask_path = extractor.save_masks_as_geotiff(\n",
111
+ " raster_path=raster_path,\n",
112
+ " output_path=\"building_masks.tif\",\n",
113
+ " confidence_threshold=0.5,\n",
114
+ " mask_threshold=0.5,\n",
115
+ ")"
116
+ ]
117
+ },
118
+ {
119
+ "cell_type": "markdown",
120
+ "metadata": {},
121
+ "source": [
122
+ "Convert raster to vector"
123
+ ]
124
+ },
125
+ {
126
+ "cell_type": "code",
127
+ "execution_count": null,
128
+ "metadata": {},
129
+ "outputs": [],
130
+ "source": [
131
+ "gdf = extractor.masks_to_vector(\n",
132
+ " mask_path=mask_path,\n",
133
+ " output_path=\"building_masks.geojson\",\n",
134
+ " simplify_tolerance=1.0,\n",
135
+ ")"
136
+ ]
137
+ },
138
+ {
139
+ "cell_type": "markdown",
140
+ "metadata": {},
141
+ "source": [
142
+ "### Option 2: Extract building footprints as vector"
143
+ ]
144
+ },
145
+ {
146
+ "cell_type": "code",
147
+ "execution_count": null,
148
+ "metadata": {},
149
+ "outputs": [],
150
+ "source": [
151
+ "output_path = \"naip_buildings.geojson\"\n",
152
+ "gdf = extractor.process_raster(\n",
153
+ " raster_path,\n",
154
+ " output_path=\"buildings.geojson\",\n",
155
+ " batch_size=4,\n",
156
+ " confidence_threshold=0.5,\n",
157
+ " overlap=0.25,\n",
158
+ " nms_iou_threshold=0.5,\n",
159
+ " small_building_area=100,\n",
160
+ " mask_threshold=0.5,\n",
161
+ " simplify_tolerance=1.0,\n",
162
+ ")"
163
+ ]
164
+ },
165
+ {
166
+ "cell_type": "markdown",
167
+ "metadata": {},
168
+ "source": [
169
+ "## Regularize building footprints"
170
+ ]
171
+ },
172
+ {
173
+ "cell_type": "code",
174
+ "execution_count": null,
175
+ "metadata": {},
176
+ "outputs": [],
177
+ "source": [
178
+ "gdf_regularized = extractor.regularize_buildings(\n",
179
+ " gdf=gdf,\n",
180
+ " min_area=100,\n",
181
+ " angle_threshold=15,\n",
182
+ " orthogonality_threshold=0.3,\n",
183
+ " rectangularity_threshold=0.7,\n",
184
+ ")"
185
+ ]
186
+ },
187
+ {
188
+ "cell_type": "markdown",
189
+ "metadata": {},
190
+ "source": [
191
+ "## Visualize building footprints"
192
+ ]
193
+ },
194
+ {
195
+ "cell_type": "code",
196
+ "execution_count": null,
197
+ "metadata": {},
198
+ "outputs": [],
199
+ "source": [
200
+ "gdf.head()"
201
+ ]
202
+ },
203
+ {
204
+ "cell_type": "code",
205
+ "execution_count": null,
206
+ "metadata": {},
207
+ "outputs": [],
208
+ "source": [
209
+ "geoai.view_vector_interactive(\n",
210
+ " gdf, column=\"confidence\", layer_name=\"Building\", tiles=\"Satellite\"\n",
211
+ ")"
212
+ ]
213
+ },
214
+ {
215
+ "cell_type": "code",
216
+ "execution_count": null,
217
+ "metadata": {},
218
+ "outputs": [],
219
+ "source": [
220
+ "geoai.view_vector_interactive(\n",
221
+ " gdf, column=\"confidence\", layer_name=\"Building\", tiles=raster_url\n",
222
+ ")"
223
+ ]
224
+ },
225
+ {
226
+ "cell_type": "code",
227
+ "execution_count": null,
228
+ "metadata": {},
229
+ "outputs": [],
230
+ "source": [
231
+ "geoai.view_vector_interactive(\n",
232
+ " gdf_regularized, column=\"confidence\", layer_name=\"Building\", tiles=raster_url\n",
233
+ ")"
234
+ ]
235
+ },
236
+ {
237
+ "cell_type": "code",
238
+ "execution_count": null,
239
+ "metadata": {},
240
+ "outputs": [],
241
+ "source": [
242
+ "extractor.visualize_results(raster_path, gdf, output_path=\"naip_buildings.png\")"
243
+ ]
244
+ },
245
+ {
246
+ "cell_type": "code",
247
+ "execution_count": null,
248
+ "metadata": {},
249
+ "outputs": [],
250
+ "source": [
251
+ "extractor.visualize_results(\n",
252
+ " raster_path, gdf_regularized, output_path=\"naip_buildings_regularized.png\"\n",
253
+ ")"
254
+ ]
255
+ }
256
+ ],
257
+ "metadata": {
258
+ "kernelspec": {
259
+ "display_name": "torch",
260
+ "language": "python",
261
+ "name": "python3"
262
+ },
263
+ "language_info": {
264
+ "codemirror_mode": {
265
+ "name": "ipython",
266
+ "version": 3
267
+ },
268
+ "file_extension": ".py",
269
+ "mimetype": "text/x-python",
270
+ "name": "python",
271
+ "nbconvert_exporter": "python",
272
+ "pygments_lexer": "ipython3",
273
+ "version": "3.11.8"
274
+ }
275
+ },
276
+ "nbformat": 4,
277
+ "nbformat_minor": 2
278
+ }
@@ -0,0 +1,257 @@
1
+ {
2
+ "cells": [
3
+ {
4
+ "cell_type": "markdown",
5
+ "metadata": {},
6
+ "source": [
7
+ "# Building Regularization\n",
8
+ "\n",
9
+ "[![image](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/opengeos/geoai/blob/main/docs/examples/building_regularization.ipynb)\n",
10
+ "\n",
11
+ "## Install package\n",
12
+ "To use the `geoai-py` package, ensure it is installed in your environment. Uncomment the command below if needed."
13
+ ]
14
+ },
15
+ {
16
+ "cell_type": "code",
17
+ "execution_count": null,
18
+ "metadata": {},
19
+ "outputs": [],
20
+ "source": [
21
+ "# %pip install geoai-py"
22
+ ]
23
+ },
24
+ {
25
+ "cell_type": "markdown",
26
+ "metadata": {},
27
+ "source": [
28
+ "## Import package"
29
+ ]
30
+ },
31
+ {
32
+ "cell_type": "code",
33
+ "execution_count": null,
34
+ "metadata": {},
35
+ "outputs": [],
36
+ "source": [
37
+ "import geoai"
38
+ ]
39
+ },
40
+ {
41
+ "cell_type": "markdown",
42
+ "metadata": {},
43
+ "source": [
44
+ "## Download sample data"
45
+ ]
46
+ },
47
+ {
48
+ "cell_type": "code",
49
+ "execution_count": null,
50
+ "metadata": {},
51
+ "outputs": [],
52
+ "source": [
53
+ "raster_url = \"https://huggingface.co/datasets/giswqs/geospatial/resolve/main/naip_building_masks.tif\""
54
+ ]
55
+ },
56
+ {
57
+ "cell_type": "code",
58
+ "execution_count": null,
59
+ "metadata": {},
60
+ "outputs": [],
61
+ "source": [
62
+ "raster_path = geoai.download_file(raster_url)"
63
+ ]
64
+ },
65
+ {
66
+ "cell_type": "code",
67
+ "execution_count": null,
68
+ "metadata": {},
69
+ "outputs": [],
70
+ "source": [
71
+ "geoai.view_image(raster_path, figsize=(18, 10))"
72
+ ]
73
+ },
74
+ {
75
+ "cell_type": "markdown",
76
+ "metadata": {},
77
+ "source": [
78
+ "## Convert raster to vector"
79
+ ]
80
+ },
81
+ {
82
+ "cell_type": "code",
83
+ "execution_count": null,
84
+ "metadata": {},
85
+ "outputs": [],
86
+ "source": [
87
+ "gdf = geoai.raster_to_vector(raster_path, output_path=\"naip_building_masks.geojson\")"
88
+ ]
89
+ },
90
+ {
91
+ "cell_type": "code",
92
+ "execution_count": null,
93
+ "metadata": {},
94
+ "outputs": [],
95
+ "source": [
96
+ "geoai.view_vector_interactive(\n",
97
+ " gdf, style_kwds={\"color\": \"blue\", \"fillOpacity\": 0}, tiles=\"Satellite\"\n",
98
+ ")"
99
+ ]
100
+ },
101
+ {
102
+ "cell_type": "markdown",
103
+ "metadata": {},
104
+ "source": [
105
+ "## Building regularization"
106
+ ]
107
+ },
108
+ {
109
+ "cell_type": "code",
110
+ "execution_count": null,
111
+ "metadata": {},
112
+ "outputs": [],
113
+ "source": [
114
+ "gdf_regularized = geoai.regularization(\n",
115
+ " building_polygons=gdf,\n",
116
+ " angle_tolerance=10,\n",
117
+ " simplify_tolerance=0.5,\n",
118
+ " orthogonalize=True,\n",
119
+ " preserve_topology=True,\n",
120
+ ")"
121
+ ]
122
+ },
123
+ {
124
+ "cell_type": "code",
125
+ "execution_count": null,
126
+ "metadata": {},
127
+ "outputs": [],
128
+ "source": [
129
+ "geoai.view_vector_interactive(\n",
130
+ " gdf_regularized, style_kwds={\"color\": \"red\", \"fillOpacity\": 0}, tiles=\"Satellite\"\n",
131
+ ")"
132
+ ]
133
+ },
134
+ {
135
+ "cell_type": "markdown",
136
+ "metadata": {},
137
+ "source": [
138
+ "## Hybrid regularization"
139
+ ]
140
+ },
141
+ {
142
+ "cell_type": "code",
143
+ "execution_count": null,
144
+ "metadata": {},
145
+ "outputs": [],
146
+ "source": [
147
+ "gdf_hybrid = geoai.hybrid_regularization(gdf)"
148
+ ]
149
+ },
150
+ {
151
+ "cell_type": "code",
152
+ "execution_count": null,
153
+ "metadata": {},
154
+ "outputs": [],
155
+ "source": [
156
+ "geoai.view_vector_interactive(\n",
157
+ " gdf_hybrid, style_kwds={\"color\": \"green\", \"fillOpacity\": 0}, tiles=\"Satellite\"\n",
158
+ ")"
159
+ ]
160
+ },
161
+ {
162
+ "cell_type": "markdown",
163
+ "metadata": {},
164
+ "source": [
165
+ "## Adaptive regularization"
166
+ ]
167
+ },
168
+ {
169
+ "cell_type": "code",
170
+ "execution_count": null,
171
+ "metadata": {},
172
+ "outputs": [],
173
+ "source": [
174
+ "gdf_adaptive = geoai.adaptive_regularization(\n",
175
+ " building_polygons=gdf,\n",
176
+ " simplify_tolerance=0.5,\n",
177
+ " area_threshold=0.9,\n",
178
+ " preserve_shape=True,\n",
179
+ ")"
180
+ ]
181
+ },
182
+ {
183
+ "cell_type": "code",
184
+ "execution_count": null,
185
+ "metadata": {},
186
+ "outputs": [],
187
+ "source": [
188
+ "geoai.view_vector_interactive(\n",
189
+ " gdf_adaptive, style_kwds={\"color\": \"yellow\", \"fillOpacity\": 0}, tiles=\"Satellite\"\n",
190
+ ")"
191
+ ]
192
+ },
193
+ {
194
+ "cell_type": "markdown",
195
+ "metadata": {},
196
+ "source": [
197
+ "## Compare regularization methods"
198
+ ]
199
+ },
200
+ {
201
+ "cell_type": "code",
202
+ "execution_count": null,
203
+ "metadata": {},
204
+ "outputs": [],
205
+ "source": [
206
+ "import leafmap.foliumap as leafmap"
207
+ ]
208
+ },
209
+ {
210
+ "cell_type": "code",
211
+ "execution_count": null,
212
+ "metadata": {},
213
+ "outputs": [],
214
+ "source": [
215
+ "m = leafmap.Map()\n",
216
+ "m.add_basemap(\"SATELLITE\")\n",
217
+ "m.add_gdf(gdf, layer_name=\"Original\")\n",
218
+ "m.add_gdf(\n",
219
+ " gdf_regularized, style={\"color\": \"red\", \"fillOpacity\": 0}, layer_name=\"Regularized\"\n",
220
+ ")\n",
221
+ "m.add_gdf(gdf_hybrid, style={\"color\": \"green\", \"fillOpacity\": 0}, layer_name=\"Hybrid\")\n",
222
+ "m.add_gdf(\n",
223
+ " gdf_adaptive, style={\"color\": \"yellow\", \"fillOpacity\": 0}, layer_name=\"Adaptive\"\n",
224
+ ")\n",
225
+ "legend = {\n",
226
+ " \"Original\": \"blue\",\n",
227
+ " \"Regularized\": \"red\",\n",
228
+ " \"Hybrid\": \"green\",\n",
229
+ " \"Adaptive\": \"yellow\",\n",
230
+ "}\n",
231
+ "m.add_legend(title=\"Building Footprints\", legend_dict=legend)\n",
232
+ "m"
233
+ ]
234
+ }
235
+ ],
236
+ "metadata": {
237
+ "kernelspec": {
238
+ "display_name": "torch",
239
+ "language": "python",
240
+ "name": "python3"
241
+ },
242
+ "language_info": {
243
+ "codemirror_mode": {
244
+ "name": "ipython",
245
+ "version": 3
246
+ },
247
+ "file_extension": ".py",
248
+ "mimetype": "text/x-python",
249
+ "name": "python",
250
+ "nbconvert_exporter": "python",
251
+ "pygments_lexer": "ipython3",
252
+ "version": "3.11.8"
253
+ }
254
+ },
255
+ "nbformat": 4,
256
+ "nbformat_minor": 2
257
+ }
@@ -40,7 +40,7 @@
40
40
  "source": [
41
41
  "from torchgeo.datasets import NAIP\n",
42
42
  "from torchgeo.samplers import RandomGeoSampler, GridGeoSampler\n",
43
- "from geoai.common import view_image, view_raster, dict_to_image\n",
43
+ "from geoai.utils import view_image, view_raster, dict_to_image\n",
44
44
  "from geoai.download import download_naip"
45
45
  ]
46
46
  },
@@ -82,7 +82,7 @@
82
82
  "- **torchgeo.samplers**: Contains sampling strategies for geospatial data:\n",
83
83
  " - **RandomGeoSampler**: Samples random patches from the dataset\n",
84
84
  " - **GridGeoSampler**: Samples patches in a grid pattern with specified stride\n",
85
- "- **geoai.common**: Custom utility functions for visualization:\n",
85
+ "- **geoai.utils**: Custom utility functions for visualization:\n",
86
86
  " - **view_image**: Visualizes tensor images\n",
87
87
  " - **view_raster**: Displays georeferenced data on an interactive map\n",
88
88
  " - **dict_to_image**: Converts dictionary representation to image format\n",
@@ -76,6 +76,14 @@ If you encounter issues with the sqlite package, you can update it using the fol
76
76
  mamba update -c conda-forge sqlite
77
77
  ```
78
78
 
79
+ ### Notes for Windows Users
80
+
81
+ If you use mamba to install geoai, you may not have the latest version of torchgeo, which may cause issues when importing geoai. To fix this, you can install the latest version of torchgeo using the following command:
82
+
83
+ ```bash
84
+ pip install -U torchgeo
85
+ ```
86
+
79
87
  ### 👩‍💻 Development Installation
80
88
 
81
89
  For contributing to GeoAI development, install directly from the source repository:
@@ -0,0 +1,3 @@
1
+ # utils module
2
+
3
+ ::: geoai.utils
@@ -2,7 +2,7 @@
2
2
 
3
3
  __author__ = """Qiusheng Wu"""
4
4
  __email__ = "giswqs@gmail.com"
5
- __version__ = "0.2.3"
5
+ __version__ = "0.3.1"
6
6
 
7
7
 
8
8
  import os