geoai-py 0.4.3__tar.gz → 0.5.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 (105) hide show
  1. {geoai_py-0.4.3 → geoai_py-0.5.1}/PKG-INFO +9 -1
  2. {geoai_py-0.4.3 → geoai_py-0.5.1}/README.md +7 -0
  3. geoai_py-0.5.1/docs/classify.md +3 -0
  4. {geoai_py-0.4.3 → geoai_py-0.5.1}/docs/examples/building_footprints_africa.ipynb +1 -3
  5. {geoai_py-0.4.3 → geoai_py-0.5.1}/docs/examples/building_footprints_china.ipynb +1 -1
  6. geoai_py-0.5.1/docs/examples/create_vector.ipynb +131 -0
  7. {geoai_py-0.4.3 → geoai_py-0.5.1}/docs/examples/download_data.ipynb +5 -9
  8. geoai_py-0.5.1/docs/examples/train_water_detection.ipynb +328 -0
  9. {geoai_py-0.4.3 → geoai_py-0.5.1}/docs/index.md +7 -0
  10. {geoai_py-0.4.3 → geoai_py-0.5.1}/geoai/__init__.py +6 -1
  11. geoai_py-0.5.1/geoai/classify.py +933 -0
  12. {geoai_py-0.4.3 → geoai_py-0.5.1}/geoai/download.py +119 -80
  13. geoai_py-0.5.1/geoai/geoai.py +120 -0
  14. {geoai_py-0.4.3 → geoai_py-0.5.1}/geoai/train.py +115 -6
  15. {geoai_py-0.4.3 → geoai_py-0.5.1}/geoai/utils.py +196 -0
  16. {geoai_py-0.4.3 → geoai_py-0.5.1}/geoai_py.egg-info/PKG-INFO +9 -1
  17. {geoai_py-0.4.3 → geoai_py-0.5.1}/geoai_py.egg-info/SOURCES.txt +4 -0
  18. {geoai_py-0.4.3 → geoai_py-0.5.1}/geoai_py.egg-info/requires.txt +1 -0
  19. {geoai_py-0.4.3 → geoai_py-0.5.1}/mkdocs.yml +3 -0
  20. {geoai_py-0.4.3 → geoai_py-0.5.1}/pyproject.toml +2 -2
  21. {geoai_py-0.4.3 → geoai_py-0.5.1}/requirements.txt +1 -0
  22. geoai_py-0.4.3/geoai/geoai.py +0 -28
  23. {geoai_py-0.4.3 → geoai_py-0.5.1}/.editorconfig +0 -0
  24. {geoai_py-0.4.3 → geoai_py-0.5.1}/.github/FUNDING.yml +0 -0
  25. {geoai_py-0.4.3 → geoai_py-0.5.1}/.github/ISSUE_TEMPLATE/bug_report.md +0 -0
  26. {geoai_py-0.4.3 → geoai_py-0.5.1}/.github/ISSUE_TEMPLATE/config.yml +0 -0
  27. {geoai_py-0.4.3 → geoai_py-0.5.1}/.github/ISSUE_TEMPLATE/feature_request.md +0 -0
  28. {geoai_py-0.4.3 → geoai_py-0.5.1}/.github/dependabot.yml +0 -0
  29. {geoai_py-0.4.3 → geoai_py-0.5.1}/.github/workflows/docs-build.yml +0 -0
  30. {geoai_py-0.4.3 → geoai_py-0.5.1}/.github/workflows/docs.yml +0 -0
  31. {geoai_py-0.4.3 → geoai_py-0.5.1}/.github/workflows/macos.yml +0 -0
  32. {geoai_py-0.4.3 → geoai_py-0.5.1}/.github/workflows/pypi.yml +0 -0
  33. {geoai_py-0.4.3 → geoai_py-0.5.1}/.github/workflows/ubuntu.yml +0 -0
  34. {geoai_py-0.4.3 → geoai_py-0.5.1}/.github/workflows/windows.yml +0 -0
  35. {geoai_py-0.4.3 → geoai_py-0.5.1}/.gitignore +0 -0
  36. {geoai_py-0.4.3 → geoai_py-0.5.1}/.pre-commit-config.yaml +0 -0
  37. {geoai_py-0.4.3 → geoai_py-0.5.1}/LICENSE +0 -0
  38. {geoai_py-0.4.3 → geoai_py-0.5.1}/MANIFEST.in +0 -0
  39. {geoai_py-0.4.3 → geoai_py-0.5.1}/docs/CNAME +0 -0
  40. {geoai_py-0.4.3 → geoai_py-0.5.1}/docs/assets/logo.ico +0 -0
  41. {geoai_py-0.4.3 → geoai_py-0.5.1}/docs/assets/logo.png +0 -0
  42. {geoai_py-0.4.3 → geoai_py-0.5.1}/docs/assets/logo_rect.png +0 -0
  43. {geoai_py-0.4.3 → geoai_py-0.5.1}/docs/changelog.md +0 -0
  44. {geoai_py-0.4.3 → geoai_py-0.5.1}/docs/contributing.md +0 -0
  45. {geoai_py-0.4.3 → geoai_py-0.5.1}/docs/download.md +0 -0
  46. {geoai_py-0.4.3 → geoai_py-0.5.1}/docs/examples/_template.ipynb +0 -0
  47. {geoai_py-0.4.3 → geoai_py-0.5.1}/docs/examples/building_footprints_usa.ipynb +0 -0
  48. {geoai_py-0.4.3 → geoai_py-0.5.1}/docs/examples/building_regularization.ipynb +0 -0
  49. {geoai_py-0.4.3 → geoai_py-0.5.1}/docs/examples/car_detection.ipynb +0 -0
  50. {geoai_py-0.4.3 → geoai_py-0.5.1}/docs/examples/data_visualization.ipynb +0 -0
  51. {geoai_py-0.4.3 → geoai_py-0.5.1}/docs/examples/dataviz/lidar_viz.ipynb +0 -0
  52. {geoai_py-0.4.3 → geoai_py-0.5.1}/docs/examples/dataviz/raster_viz.ipynb +0 -0
  53. {geoai_py-0.4.3 → geoai_py-0.5.1}/docs/examples/dataviz/vector_viz.ipynb +0 -0
  54. {geoai_py-0.4.3 → geoai_py-0.5.1}/docs/examples/download_sentinel2.ipynb +0 -0
  55. {geoai_py-0.4.3 → geoai_py-0.5.1}/docs/examples/geometric_properties.ipynb +0 -0
  56. {geoai_py-0.4.3 → geoai_py-0.5.1}/docs/examples/image_chips.ipynb +0 -0
  57. {geoai_py-0.4.3 → geoai_py-0.5.1}/docs/examples/jupytext.toml +0 -0
  58. {geoai_py-0.4.3 → geoai_py-0.5.1}/docs/examples/parking_spot_detection.ipynb +0 -0
  59. {geoai_py-0.4.3 → geoai_py-0.5.1}/docs/examples/planetary_computer.ipynb +0 -0
  60. {geoai_py-0.4.3 → geoai_py-0.5.1}/docs/examples/rastervision/semantic_segmentation.ipynb +0 -0
  61. {geoai_py-0.4.3 → geoai_py-0.5.1}/docs/examples/samgeo/arcgis.ipynb +0 -0
  62. {geoai_py-0.4.3 → geoai_py-0.5.1}/docs/examples/samgeo/automatic_mask_generator.ipynb +0 -0
  63. {geoai_py-0.4.3 → geoai_py-0.5.1}/docs/examples/samgeo/automatic_mask_generator_hq.ipynb +0 -0
  64. {geoai_py-0.4.3 → geoai_py-0.5.1}/docs/examples/samgeo/box_prompts.ipynb +0 -0
  65. {geoai_py-0.4.3 → geoai_py-0.5.1}/docs/examples/samgeo/fast_sam.ipynb +0 -0
  66. {geoai_py-0.4.3 → geoai_py-0.5.1}/docs/examples/samgeo/input_prompts.ipynb +0 -0
  67. {geoai_py-0.4.3 → geoai_py-0.5.1}/docs/examples/samgeo/input_prompts_hq.ipynb +0 -0
  68. {geoai_py-0.4.3 → geoai_py-0.5.1}/docs/examples/samgeo/maxar_open_data.ipynb +0 -0
  69. {geoai_py-0.4.3 → geoai_py-0.5.1}/docs/examples/samgeo/satellite-predictor.ipynb +0 -0
  70. {geoai_py-0.4.3 → geoai_py-0.5.1}/docs/examples/samgeo/satellite.ipynb +0 -0
  71. {geoai_py-0.4.3 → geoai_py-0.5.1}/docs/examples/samgeo/swimming_pools.ipynb +0 -0
  72. {geoai_py-0.4.3 → geoai_py-0.5.1}/docs/examples/samgeo/text_prompts.ipynb +0 -0
  73. {geoai_py-0.4.3 → geoai_py-0.5.1}/docs/examples/samgeo/text_prompts_batch.ipynb +0 -0
  74. {geoai_py-0.4.3 → geoai_py-0.5.1}/docs/examples/ship_detection.ipynb +0 -0
  75. {geoai_py-0.4.3 → geoai_py-0.5.1}/docs/examples/solar_panel_detection.ipynb +0 -0
  76. {geoai_py-0.4.3 → geoai_py-0.5.1}/docs/examples/text_prompt_segmentation.ipynb +0 -0
  77. {geoai_py-0.4.3 → geoai_py-0.5.1}/docs/examples/train_building_footprints_usa.ipynb +0 -0
  78. {geoai_py-0.4.3 → geoai_py-0.5.1}/docs/examples/train_car_detection.ipynb +0 -0
  79. {geoai_py-0.4.3 → geoai_py-0.5.1}/docs/examples/train_object_detection_model.ipynb +0 -0
  80. {geoai_py-0.4.3 → geoai_py-0.5.1}/docs/examples/train_ship_detection.ipynb +0 -0
  81. {geoai_py-0.4.3 → geoai_py-0.5.1}/docs/examples/train_solar_panel_detection.ipynb +0 -0
  82. {geoai_py-0.4.3 → geoai_py-0.5.1}/docs/examples/view_metadata.ipynb +0 -0
  83. {geoai_py-0.4.3 → geoai_py-0.5.1}/docs/examples/wetland_mapping.ipynb +0 -0
  84. {geoai_py-0.4.3 → geoai_py-0.5.1}/docs/extract.md +0 -0
  85. {geoai_py-0.4.3 → geoai_py-0.5.1}/docs/faq.md +0 -0
  86. {geoai_py-0.4.3 → geoai_py-0.5.1}/docs/geoai.md +0 -0
  87. {geoai_py-0.4.3 → geoai_py-0.5.1}/docs/hf.md +0 -0
  88. {geoai_py-0.4.3 → geoai_py-0.5.1}/docs/installation.md +0 -0
  89. {geoai_py-0.4.3 → geoai_py-0.5.1}/docs/overrides/main.html +0 -0
  90. {geoai_py-0.4.3 → geoai_py-0.5.1}/docs/segment.md +0 -0
  91. {geoai_py-0.4.3 → geoai_py-0.5.1}/docs/segmentation.md +0 -0
  92. {geoai_py-0.4.3 → geoai_py-0.5.1}/docs/train.md +0 -0
  93. {geoai_py-0.4.3 → geoai_py-0.5.1}/docs/usage.md +0 -0
  94. {geoai_py-0.4.3 → geoai_py-0.5.1}/docs/utils.md +0 -0
  95. {geoai_py-0.4.3 → geoai_py-0.5.1}/geoai/extract.py +0 -0
  96. {geoai_py-0.4.3 → geoai_py-0.5.1}/geoai/hf.py +0 -0
  97. {geoai_py-0.4.3 → geoai_py-0.5.1}/geoai/segment.py +0 -0
  98. {geoai_py-0.4.3 → geoai_py-0.5.1}/geoai/segmentation.py +0 -0
  99. {geoai_py-0.4.3 → geoai_py-0.5.1}/geoai_py.egg-info/dependency_links.txt +0 -0
  100. {geoai_py-0.4.3 → geoai_py-0.5.1}/geoai_py.egg-info/entry_points.txt +0 -0
  101. {geoai_py-0.4.3 → geoai_py-0.5.1}/geoai_py.egg-info/top_level.txt +0 -0
  102. {geoai_py-0.4.3 → geoai_py-0.5.1}/requirements_docs.txt +0 -0
  103. {geoai_py-0.4.3 → geoai_py-0.5.1}/setup.cfg +0 -0
  104. {geoai_py-0.4.3 → geoai_py-0.5.1}/tests/__init__.py +0 -0
  105. {geoai_py-0.4.3 → geoai_py-0.5.1}/tests/test_geoai.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: geoai-py
3
- Version: 0.4.3
3
+ Version: 0.5.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
@@ -25,6 +25,7 @@ Requires-Dist: jupyter-server-proxy
25
25
  Requires-Dist: leafmap
26
26
  Requires-Dist: localtileserver
27
27
  Requires-Dist: mapclassify
28
+ Requires-Dist: maplibre
28
29
  Requires-Dist: overturemaps
29
30
  Requires-Dist: planetary-computer
30
31
  Requires-Dist: pystac-client
@@ -143,3 +144,10 @@ We welcome contributions of all kinds! See our [contributing guide](https://geoa
143
144
  ## 📄 License
144
145
 
145
146
  GeoAI is free and open source software, licensed under the MIT License.
147
+
148
+ ## Acknowledgments
149
+
150
+ We gratefully acknowledge the support of the following organizations:
151
+
152
+ - [NASA](https://www.nasa.gov): This research is partially supported by the National Aeronautics and Space Administration (NASA) through Grant No. 80NSSC22K1742, awarded under the [Open Source Tools, Frameworks, and Libraries Program](https://bit.ly/3RVBRcQ).
153
+ - [AmericaView](https://americaview.org): This work is also partially supported by the U.S. Geological Survey through Grant/Cooperative Agreement No. G23AP00683 (GY23-GY27) in collaboration with AmericaView.
@@ -100,3 +100,10 @@ We welcome contributions of all kinds! See our [contributing guide](https://geoa
100
100
  ## 📄 License
101
101
 
102
102
  GeoAI is free and open source software, licensed under the MIT License.
103
+
104
+ ## Acknowledgments
105
+
106
+ We gratefully acknowledge the support of the following organizations:
107
+
108
+ - [NASA](https://www.nasa.gov): This research is partially supported by the National Aeronautics and Space Administration (NASA) through Grant No. 80NSSC22K1742, awarded under the [Open Source Tools, Frameworks, and Libraries Program](https://bit.ly/3RVBRcQ).
109
+ - [AmericaView](https://americaview.org): This work is also partially supported by the U.S. Geological Survey through Grant/Cooperative Agreement No. G23AP00683 (GY23-GY27) in collaboration with AmericaView.
@@ -0,0 +1,3 @@
1
+ # classify module
2
+
3
+ ::: geoai.classify
@@ -76,9 +76,7 @@
76
76
  "metadata": {},
77
77
  "outputs": [],
78
78
  "source": [
79
- "extractor = geoai.BuildingFootprintExtractor(\n",
80
- " model_path=\"building_footprints_africa.pth\"\n",
81
- ")"
79
+ "extractor = geoai.BuildingFootprintExtractor(model_path=\"building_footprints_usa.pth\")"
82
80
  ]
83
81
  },
84
82
  {
@@ -77,7 +77,7 @@
77
77
  "metadata": {},
78
78
  "outputs": [],
79
79
  "source": [
80
- "extractor = geoai.BuildingFootprintExtractor(model_path=\"building_footprints_china.pth\")"
80
+ "extractor = geoai.BuildingFootprintExtractor(model_path=\"building_footprints_usa.pth\")"
81
81
  ]
82
82
  },
83
83
  {
@@ -0,0 +1,131 @@
1
+ {
2
+ "cells": [
3
+ {
4
+ "cell_type": "markdown",
5
+ "metadata": {},
6
+ "source": [
7
+ "# Create vector labels for training deep learning models\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/create_vector.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
+ "## Add sample datasets"
45
+ ]
46
+ },
47
+ {
48
+ "cell_type": "code",
49
+ "execution_count": null,
50
+ "metadata": {},
51
+ "outputs": [],
52
+ "source": [
53
+ "m = geoai.MapLibre(style=\"liberty\")\n",
54
+ "raster_url = (\n",
55
+ " \"https://huggingface.co/datasets/giswqs/geospatial/resolve/main/naip_train.tif\"\n",
56
+ ")\n",
57
+ "m.add_cog_layer(raster_url, name=\"NAIP\")\n",
58
+ "m.add_layer_control()\n",
59
+ "m.add_draw_control(\n",
60
+ " controls=[\"point\", \"polygon\", \"line_string\", \"trash\"], position=\"top-right\"\n",
61
+ ")"
62
+ ]
63
+ },
64
+ {
65
+ "cell_type": "markdown",
66
+ "metadata": {},
67
+ "source": [
68
+ "## Set default properties"
69
+ ]
70
+ },
71
+ {
72
+ "cell_type": "code",
73
+ "execution_count": null,
74
+ "metadata": {},
75
+ "outputs": [],
76
+ "source": [
77
+ "properties = {\n",
78
+ " \"Type\": [\"Residential\", \"Commercial\", \"Industrial\"],\n",
79
+ " \"Area\": 3000,\n",
80
+ " \"Name\": \"Building\",\n",
81
+ " \"City\": \"Seattle\",\n",
82
+ "}"
83
+ ]
84
+ },
85
+ {
86
+ "cell_type": "markdown",
87
+ "metadata": {},
88
+ "source": [
89
+ "## Display the interactive widget"
90
+ ]
91
+ },
92
+ {
93
+ "cell_type": "code",
94
+ "execution_count": null,
95
+ "metadata": {},
96
+ "outputs": [],
97
+ "source": [
98
+ "widget = geoai.create_vector_data(m, properties, file_ext=\"gpkg\")\n",
99
+ "widget"
100
+ ]
101
+ },
102
+ {
103
+ "cell_type": "markdown",
104
+ "metadata": {},
105
+ "source": [
106
+ "![image](https://github.com/user-attachments/assets/822fced3-5ba9-407c-9a17-e9332e2d84ad)"
107
+ ]
108
+ }
109
+ ],
110
+ "metadata": {
111
+ "kernelspec": {
112
+ "display_name": "Python 3 (ipykernel)",
113
+ "language": "python",
114
+ "name": "python3"
115
+ },
116
+ "language_info": {
117
+ "codemirror_mode": {
118
+ "name": "ipython",
119
+ "version": 3
120
+ },
121
+ "file_extension": ".py",
122
+ "mimetype": "text/x-python",
123
+ "name": "python",
124
+ "nbconvert_exporter": "python",
125
+ "pygments_lexer": "ipython3",
126
+ "version": "3.12.2"
127
+ }
128
+ },
129
+ "nbformat": 4,
130
+ "nbformat_minor": 4
131
+ }
@@ -122,10 +122,7 @@
122
122
  "# Download buildings\n",
123
123
  "data_file = download_overture_buildings(\n",
124
124
  " bbox=bbox,\n",
125
- " output_file=\"buildings.geojson\",\n",
126
- " output_format=\"geojson\",\n",
127
- " data_type=\"building\",\n",
128
- " verbose=True,\n",
125
+ " output=\"buildings.geojson\",\n",
129
126
  ")"
130
127
  ]
131
128
  },
@@ -143,9 +140,8 @@
143
140
  "metadata": {},
144
141
  "outputs": [],
145
142
  "source": [
146
- "if data_file:\n",
147
- " stats = extract_building_stats(data_file)\n",
148
- " print(stats)"
143
+ "stats = extract_building_stats(data_file)\n",
144
+ "print(stats)"
149
145
  ]
150
146
  },
151
147
  {
@@ -177,7 +173,7 @@
177
173
  ],
178
174
  "metadata": {
179
175
  "kernelspec": {
180
- "display_name": "Python 3 (ipykernel)",
176
+ "display_name": "geo",
181
177
  "language": "python",
182
178
  "name": "python3"
183
179
  },
@@ -191,7 +187,7 @@
191
187
  "name": "python",
192
188
  "nbconvert_exporter": "python",
193
189
  "pygments_lexer": "ipython3",
194
- "version": "3.11.8"
190
+ "version": "3.12.9"
195
191
  }
196
192
  },
197
193
  "nbformat": 4,
@@ -0,0 +1,328 @@
1
+ {
2
+ "cells": [
3
+ {
4
+ "cell_type": "markdown",
5
+ "metadata": {},
6
+ "source": [
7
+ "# Train a Model for Detecting Surface Water\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/train_water_detection.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
+ "train_raster_url = \"https://huggingface.co/datasets/giswqs/geospatial/resolve/main/naip/naip_water_train.tif\"\n",
54
+ "train_masks_url = \"https://huggingface.co/datasets/giswqs/geospatial/resolve/main/naip/naip_water_masks.tif\"\n",
55
+ "test_raster_url = \"https://huggingface.co/datasets/giswqs/geospatial/resolve/main/naip/naip_water_test.tif\""
56
+ ]
57
+ },
58
+ {
59
+ "cell_type": "code",
60
+ "execution_count": null,
61
+ "metadata": {},
62
+ "outputs": [],
63
+ "source": [
64
+ "train_raster_path = geoai.download_file(train_raster_url)\n",
65
+ "train_masks_path = geoai.download_file(train_masks_url)\n",
66
+ "test_raster_path = geoai.download_file(test_raster_url)"
67
+ ]
68
+ },
69
+ {
70
+ "cell_type": "code",
71
+ "execution_count": null,
72
+ "metadata": {},
73
+ "outputs": [],
74
+ "source": [
75
+ "geoai.print_raster_info(train_raster_path, show_preview=False)"
76
+ ]
77
+ },
78
+ {
79
+ "cell_type": "markdown",
80
+ "metadata": {},
81
+ "source": [
82
+ "## Visualize sample data"
83
+ ]
84
+ },
85
+ {
86
+ "cell_type": "code",
87
+ "execution_count": null,
88
+ "metadata": {},
89
+ "outputs": [],
90
+ "source": [
91
+ "geoai.view_raster(train_masks_url, nodata=0, basemap=train_raster_url)"
92
+ ]
93
+ },
94
+ {
95
+ "cell_type": "code",
96
+ "execution_count": null,
97
+ "metadata": {},
98
+ "outputs": [],
99
+ "source": [
100
+ "geoai.view_raster(test_raster_url)"
101
+ ]
102
+ },
103
+ {
104
+ "cell_type": "markdown",
105
+ "metadata": {},
106
+ "source": [
107
+ "## Create training data"
108
+ ]
109
+ },
110
+ {
111
+ "cell_type": "code",
112
+ "execution_count": null,
113
+ "metadata": {},
114
+ "outputs": [],
115
+ "source": [
116
+ "out_folder = \"output\""
117
+ ]
118
+ },
119
+ {
120
+ "cell_type": "code",
121
+ "execution_count": null,
122
+ "metadata": {},
123
+ "outputs": [],
124
+ "source": [
125
+ "tiles = geoai.export_geotiff_tiles(\n",
126
+ " in_raster=train_raster_path,\n",
127
+ " out_folder=out_folder,\n",
128
+ " in_class_data=train_masks_path,\n",
129
+ " tile_size=512,\n",
130
+ " stride=128,\n",
131
+ " buffer_radius=0,\n",
132
+ ")"
133
+ ]
134
+ },
135
+ {
136
+ "cell_type": "markdown",
137
+ "metadata": {},
138
+ "source": [
139
+ "## Train object detection model"
140
+ ]
141
+ },
142
+ {
143
+ "cell_type": "code",
144
+ "execution_count": null,
145
+ "metadata": {},
146
+ "outputs": [],
147
+ "source": [
148
+ "geoai.train_MaskRCNN_model(\n",
149
+ " images_dir=f\"{out_folder}/images\",\n",
150
+ " labels_dir=f\"{out_folder}/labels\",\n",
151
+ " output_dir=f\"{out_folder}/models\",\n",
152
+ " num_channels=4,\n",
153
+ " pretrained=True,\n",
154
+ " batch_size=4,\n",
155
+ " num_epochs=10,\n",
156
+ " learning_rate=0.005,\n",
157
+ " val_split=0.2,\n",
158
+ ")"
159
+ ]
160
+ },
161
+ {
162
+ "cell_type": "markdown",
163
+ "metadata": {},
164
+ "source": [
165
+ "## Run inference"
166
+ ]
167
+ },
168
+ {
169
+ "cell_type": "code",
170
+ "execution_count": null,
171
+ "metadata": {},
172
+ "outputs": [],
173
+ "source": [
174
+ "masks_path = \"naip_water_prediction.tif\"\n",
175
+ "model_path = f\"{out_folder}/models/best_model.pth\""
176
+ ]
177
+ },
178
+ {
179
+ "cell_type": "code",
180
+ "execution_count": null,
181
+ "metadata": {},
182
+ "outputs": [],
183
+ "source": [
184
+ "geoai.object_detection(\n",
185
+ " test_raster_path,\n",
186
+ " masks_path,\n",
187
+ " model_path,\n",
188
+ " window_size=512,\n",
189
+ " overlap=128,\n",
190
+ " confidence_threshold=0.3,\n",
191
+ " batch_size=4,\n",
192
+ " num_channels=4,\n",
193
+ ")"
194
+ ]
195
+ },
196
+ {
197
+ "cell_type": "markdown",
198
+ "metadata": {},
199
+ "source": [
200
+ "## Vectorize masks"
201
+ ]
202
+ },
203
+ {
204
+ "cell_type": "code",
205
+ "execution_count": null,
206
+ "metadata": {},
207
+ "outputs": [],
208
+ "source": [
209
+ "output_path = \"naip_water_prediction.geojson\"\n",
210
+ "gdf = geoai.raster_to_vector(\n",
211
+ " masks_path, output_path, min_area=1000, simplify_tolerance=1\n",
212
+ ")"
213
+ ]
214
+ },
215
+ {
216
+ "cell_type": "code",
217
+ "execution_count": null,
218
+ "metadata": {},
219
+ "outputs": [],
220
+ "source": [
221
+ "gdf = geoai.add_geometric_properties(gdf)"
222
+ ]
223
+ },
224
+ {
225
+ "cell_type": "code",
226
+ "execution_count": null,
227
+ "metadata": {},
228
+ "outputs": [],
229
+ "source": [
230
+ "len(gdf)"
231
+ ]
232
+ },
233
+ {
234
+ "cell_type": "code",
235
+ "execution_count": null,
236
+ "metadata": {},
237
+ "outputs": [],
238
+ "source": [
239
+ "geoai.view_vector_interactive(gdf, tiles=test_raster_url)"
240
+ ]
241
+ },
242
+ {
243
+ "cell_type": "code",
244
+ "execution_count": null,
245
+ "metadata": {},
246
+ "outputs": [],
247
+ "source": [
248
+ "gdf[\"elongation\"].hist()"
249
+ ]
250
+ },
251
+ {
252
+ "cell_type": "code",
253
+ "execution_count": null,
254
+ "metadata": {},
255
+ "outputs": [],
256
+ "source": [
257
+ "gdf_filtered = gdf[gdf[\"elongation\"] < 10]"
258
+ ]
259
+ },
260
+ {
261
+ "cell_type": "code",
262
+ "execution_count": null,
263
+ "metadata": {},
264
+ "outputs": [],
265
+ "source": [
266
+ "len(gdf_filtered)"
267
+ ]
268
+ },
269
+ {
270
+ "cell_type": "markdown",
271
+ "metadata": {},
272
+ "source": [
273
+ "## Visualize results"
274
+ ]
275
+ },
276
+ {
277
+ "cell_type": "code",
278
+ "execution_count": null,
279
+ "metadata": {},
280
+ "outputs": [],
281
+ "source": [
282
+ "geoai.view_vector_interactive(gdf_filtered, tiles=test_raster_url)"
283
+ ]
284
+ },
285
+ {
286
+ "cell_type": "code",
287
+ "execution_count": null,
288
+ "metadata": {},
289
+ "outputs": [],
290
+ "source": [
291
+ "geoai.create_split_map(\n",
292
+ " left_layer=gdf_filtered,\n",
293
+ " right_layer=test_raster_url,\n",
294
+ " left_args={\"style\": {\"color\": \"red\", \"fillOpacity\": 0.2}},\n",
295
+ " basemap=test_raster_url,\n",
296
+ ")"
297
+ ]
298
+ },
299
+ {
300
+ "cell_type": "markdown",
301
+ "metadata": {},
302
+ "source": [
303
+ "![image](https://github.com/user-attachments/assets/a269b5a0-9f72-4ed8-8b2d-a175bbc45a23)"
304
+ ]
305
+ }
306
+ ],
307
+ "metadata": {
308
+ "kernelspec": {
309
+ "display_name": "Python 3 (ipykernel)",
310
+ "language": "python",
311
+ "name": "python3"
312
+ },
313
+ "language_info": {
314
+ "codemirror_mode": {
315
+ "name": "ipython",
316
+ "version": 3
317
+ },
318
+ "file_extension": ".py",
319
+ "mimetype": "text/x-python",
320
+ "name": "python",
321
+ "nbconvert_exporter": "python",
322
+ "pygments_lexer": "ipython3",
323
+ "version": "3.12.9"
324
+ }
325
+ },
326
+ "nbformat": 4,
327
+ "nbformat_minor": 4
328
+ }
@@ -100,3 +100,10 @@ We welcome contributions of all kinds! See our [contributing guide](https://geoa
100
100
  ## 📄 License
101
101
 
102
102
  GeoAI is free and open source software, licensed under the MIT License.
103
+
104
+ ## Acknowledgments
105
+
106
+ We gratefully acknowledge the support of the following organizations:
107
+
108
+ - [NASA](https://www.nasa.gov): This research is partially supported by the National Aeronautics and Space Administration (NASA) through Grant No. 80NSSC22K1742, awarded under the [Open Source Tools, Frameworks, and Libraries Program](https://bit.ly/3RVBRcQ).
109
+ - [AmericaView](https://americaview.org): This work is also partially supported by the U.S. Geological Survey through Grant/Cooperative Agreement No. G23AP00683 (GY23-GY27) in collaboration with AmericaView.
@@ -2,7 +2,7 @@
2
2
 
3
3
  __author__ = """Qiusheng Wu"""
4
4
  __email__ = "giswqs@gmail.com"
5
- __version__ = "0.4.3"
5
+ __version__ = "0.5.1"
6
6
 
7
7
 
8
8
  import os
@@ -23,6 +23,8 @@ def set_proj_lib_path(verbose=False):
23
23
  bool: True if both paths were set successfully, False otherwise.
24
24
  """
25
25
  try:
26
+ from rasterio.env import set_gdal_config
27
+
26
28
  # Get conda environment path
27
29
  conda_env_path = os.environ.get("CONDA_PREFIX") or sys.prefix
28
30
 
@@ -86,6 +88,9 @@ def set_proj_lib_path(verbose=False):
86
88
  if proj_set and gdal_set:
87
89
  break
88
90
 
91
+ set_gdal_config("PROJ_LIB", os.environ["PROJ_LIB"])
92
+ set_gdal_config("GDAL_DATA", os.environ["GDAL_DATA"])
93
+
89
94
  except Exception as e:
90
95
  print(f"Error setting projection library paths: {e}")
91
96
  return