geoai-py 0.3.2__tar.gz → 0.3.4__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.3.2 → geoai_py-0.3.4}/PKG-INFO +11 -4
- {geoai_py-0.3.2 → geoai_py-0.3.4}/README.md +9 -3
- geoai_py-0.3.4/docs/examples/_template.ipynb +62 -0
- {geoai_py-0.3.2 → geoai_py-0.3.4}/docs/examples/building_footprints_usa.ipynb +4 -3
- geoai_py-0.3.4/docs/examples/car_detection.ipynb +254 -0
- geoai_py-0.3.4/docs/examples/geometric_properties.ipynb +199 -0
- {geoai_py-0.3.2 → geoai_py-0.3.4}/docs/index.md +9 -3
- {geoai_py-0.3.2 → geoai_py-0.3.4}/geoai/__init__.py +1 -1
- {geoai_py-0.3.2 → geoai_py-0.3.4}/geoai/extract.py +420 -45
- {geoai_py-0.3.2 → geoai_py-0.3.4}/geoai/geoai.py +0 -1
- {geoai_py-0.3.2 → geoai_py-0.3.4}/geoai/preprocess.py +20 -6
- geoai_py-0.3.4/geoai/utils.py +4976 -0
- {geoai_py-0.3.2 → geoai_py-0.3.4}/geoai_py.egg-info/PKG-INFO +11 -4
- {geoai_py-0.3.2 → geoai_py-0.3.4}/geoai_py.egg-info/SOURCES.txt +3 -1
- {geoai_py-0.3.2 → geoai_py-0.3.4}/geoai_py.egg-info/requires.txt +1 -0
- {geoai_py-0.3.2 → geoai_py-0.3.4}/mkdocs.yml +2 -1
- {geoai_py-0.3.2 → geoai_py-0.3.4}/pyproject.toml +2 -2
- {geoai_py-0.3.2 → geoai_py-0.3.4}/requirements.txt +1 -0
- geoai_py-0.3.2/docs/preprocess.md +0 -3
- geoai_py-0.3.2/geoai/utils.py +0 -1176
- {geoai_py-0.3.2 → geoai_py-0.3.4}/.editorconfig +0 -0
- {geoai_py-0.3.2 → geoai_py-0.3.4}/.github/ISSUE_TEMPLATE/bug_report.md +0 -0
- {geoai_py-0.3.2 → geoai_py-0.3.4}/.github/ISSUE_TEMPLATE/config.yml +0 -0
- {geoai_py-0.3.2 → geoai_py-0.3.4}/.github/ISSUE_TEMPLATE/feature_request.md +0 -0
- {geoai_py-0.3.2 → geoai_py-0.3.4}/.github/dependabot.yml +0 -0
- {geoai_py-0.3.2 → geoai_py-0.3.4}/.github/workflows/docs-build.yml +0 -0
- {geoai_py-0.3.2 → geoai_py-0.3.4}/.github/workflows/docs.yml +0 -0
- {geoai_py-0.3.2 → geoai_py-0.3.4}/.github/workflows/macos.yml +0 -0
- {geoai_py-0.3.2 → geoai_py-0.3.4}/.github/workflows/pypi.yml +0 -0
- {geoai_py-0.3.2 → geoai_py-0.3.4}/.github/workflows/ubuntu.yml +0 -0
- {geoai_py-0.3.2 → geoai_py-0.3.4}/.github/workflows/windows.yml +0 -0
- {geoai_py-0.3.2 → geoai_py-0.3.4}/.gitignore +0 -0
- {geoai_py-0.3.2 → geoai_py-0.3.4}/.pre-commit-config.yaml +0 -0
- {geoai_py-0.3.2 → geoai_py-0.3.4}/LICENSE +0 -0
- {geoai_py-0.3.2 → geoai_py-0.3.4}/MANIFEST.in +0 -0
- {geoai_py-0.3.2 → geoai_py-0.3.4}/docs/CNAME +0 -0
- {geoai_py-0.3.2 → geoai_py-0.3.4}/docs/changelog.md +0 -0
- {geoai_py-0.3.2 → geoai_py-0.3.4}/docs/contributing.md +0 -0
- {geoai_py-0.3.2 → geoai_py-0.3.4}/docs/download.md +0 -0
- {geoai_py-0.3.2 → geoai_py-0.3.4}/docs/examples/building_regularization.ipynb +0 -0
- {geoai_py-0.3.2 → geoai_py-0.3.4}/docs/examples/data_visualization.ipynb +0 -0
- {geoai_py-0.3.2 → geoai_py-0.3.4}/docs/examples/dataviz/lidar_viz.ipynb +0 -0
- {geoai_py-0.3.2 → geoai_py-0.3.4}/docs/examples/dataviz/raster_viz.ipynb +0 -0
- {geoai_py-0.3.2 → geoai_py-0.3.4}/docs/examples/dataviz/vector_viz.ipynb +0 -0
- {geoai_py-0.3.2 → geoai_py-0.3.4}/docs/examples/download_data.ipynb +0 -0
- {geoai_py-0.3.2 → geoai_py-0.3.4}/docs/examples/image_chips.ipynb +0 -0
- {geoai_py-0.3.2 → geoai_py-0.3.4}/docs/examples/jupytext.toml +0 -0
- {geoai_py-0.3.2 → geoai_py-0.3.4}/docs/examples/rastervision/semantic_segmentation.ipynb +0 -0
- {geoai_py-0.3.2 → geoai_py-0.3.4}/docs/examples/samgeo/arcgis.ipynb +0 -0
- {geoai_py-0.3.2 → geoai_py-0.3.4}/docs/examples/samgeo/automatic_mask_generator.ipynb +0 -0
- {geoai_py-0.3.2 → geoai_py-0.3.4}/docs/examples/samgeo/automatic_mask_generator_hq.ipynb +0 -0
- {geoai_py-0.3.2 → geoai_py-0.3.4}/docs/examples/samgeo/box_prompts.ipynb +0 -0
- {geoai_py-0.3.2 → geoai_py-0.3.4}/docs/examples/samgeo/fast_sam.ipynb +0 -0
- {geoai_py-0.3.2 → geoai_py-0.3.4}/docs/examples/samgeo/input_prompts.ipynb +0 -0
- {geoai_py-0.3.2 → geoai_py-0.3.4}/docs/examples/samgeo/input_prompts_hq.ipynb +0 -0
- {geoai_py-0.3.2 → geoai_py-0.3.4}/docs/examples/samgeo/maxar_open_data.ipynb +0 -0
- {geoai_py-0.3.2 → geoai_py-0.3.4}/docs/examples/samgeo/satellite-predictor.ipynb +0 -0
- {geoai_py-0.3.2 → geoai_py-0.3.4}/docs/examples/samgeo/satellite.ipynb +0 -0
- {geoai_py-0.3.2 → geoai_py-0.3.4}/docs/examples/samgeo/swimming_pools.ipynb +0 -0
- {geoai_py-0.3.2 → geoai_py-0.3.4}/docs/examples/samgeo/text_prompts.ipynb +0 -0
- {geoai_py-0.3.2 → geoai_py-0.3.4}/docs/examples/samgeo/text_prompts_batch.ipynb +0 -0
- {geoai_py-0.3.2 → geoai_py-0.3.4}/docs/examples/view_metadata.ipynb +0 -0
- {geoai_py-0.3.2 → geoai_py-0.3.4}/docs/extract.md +0 -0
- {geoai_py-0.3.2 → geoai_py-0.3.4}/docs/faq.md +0 -0
- {geoai_py-0.3.2 → geoai_py-0.3.4}/docs/geoai.md +0 -0
- {geoai_py-0.3.2 → geoai_py-0.3.4}/docs/installation.md +0 -0
- {geoai_py-0.3.2 → geoai_py-0.3.4}/docs/overrides/main.html +0 -0
- {geoai_py-0.3.2 → geoai_py-0.3.4}/docs/segmentation.md +0 -0
- {geoai_py-0.3.2 → geoai_py-0.3.4}/docs/usage.md +0 -0
- {geoai_py-0.3.2 → geoai_py-0.3.4}/docs/utils.md +0 -0
- {geoai_py-0.3.2 → geoai_py-0.3.4}/geoai/download.py +0 -0
- {geoai_py-0.3.2 → geoai_py-0.3.4}/geoai/segmentation.py +0 -0
- {geoai_py-0.3.2 → geoai_py-0.3.4}/geoai_py.egg-info/dependency_links.txt +0 -0
- {geoai_py-0.3.2 → geoai_py-0.3.4}/geoai_py.egg-info/entry_points.txt +0 -0
- {geoai_py-0.3.2 → geoai_py-0.3.4}/geoai_py.egg-info/top_level.txt +0 -0
- {geoai_py-0.3.2 → geoai_py-0.3.4}/requirements_docs.txt +0 -0
- {geoai_py-0.3.2 → geoai_py-0.3.4}/setup.cfg +0 -0
- {geoai_py-0.3.2 → geoai_py-0.3.4}/tests/__init__.py +0 -0
- {geoai_py-0.3.2 → geoai_py-0.3.4}/tests/test_geoai.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.2
|
|
2
2
|
Name: geoai-py
|
|
3
|
-
Version: 0.3.
|
|
3
|
+
Version: 0.3.4
|
|
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
|
|
@@ -30,6 +30,7 @@ Requires-Dist: planetary-computer
|
|
|
30
30
|
Requires-Dist: pystac-client
|
|
31
31
|
Requires-Dist: rasterio
|
|
32
32
|
Requires-Dist: rioxarray
|
|
33
|
+
Requires-Dist: scikit-image
|
|
33
34
|
Requires-Dist: scikit-learn
|
|
34
35
|
Requires-Dist: torch
|
|
35
36
|
Requires-Dist: torchgeo
|
|
@@ -49,9 +50,9 @@ Requires-Dist: geoai[download]; extra == "all"
|
|
|
49
50
|
[](https://pepy.tech/project/geoai-py)
|
|
50
51
|
[](https://anaconda.org/conda-forge/geoai)
|
|
51
52
|
[](https://anaconda.org/conda-forge/geoai)
|
|
52
|
-
[](https://github.com/
|
|
53
|
+
[](https://github.com/giswqs/geoai-py-feedstock)
|
|
53
54
|
[](https://opensource.org/licenses/MIT)
|
|
54
|
-
[](https://bit.ly/GeoAI-Tutorials)
|
|
55
56
|
|
|
56
57
|
**A powerful Python package for integrating Artificial Intelligence with geospatial data analysis and visualization**
|
|
57
58
|
|
|
@@ -85,7 +86,7 @@ GeoAI bridges the gap between AI and geospatial analysis, providing tools for pr
|
|
|
85
86
|
- Integration with Meta's Segment Anything Model (SAM) for automatic feature extraction
|
|
86
87
|
- Specialized segmentation algorithms optimized for satellite and aerial imagery
|
|
87
88
|
- Streamlined workflows for segmenting buildings, roads, vegetation, and water bodies
|
|
88
|
-
- Export capabilities to standard geospatial formats (GeoJSON, Shapefile, GeoPackage)
|
|
89
|
+
- Export capabilities to standard geospatial formats (GeoJSON, Shapefile, GeoPackage, GeoParquet)
|
|
89
90
|
|
|
90
91
|
### 🔍 Image Classification
|
|
91
92
|
|
|
@@ -130,6 +131,12 @@ Comprehensive documentation is available at [https://geoai.gishub.org](https://g
|
|
|
130
131
|
- Explanation of algorithms and models
|
|
131
132
|
- Best practices for geospatial AI
|
|
132
133
|
|
|
134
|
+
## 📺 Video Tutorials
|
|
135
|
+
|
|
136
|
+
Check out our [YouTube channel](https://bit.ly/GeoAI-Tutorials) for video tutorials on using GeoAI for geospatial data analysis and visualization.
|
|
137
|
+
|
|
138
|
+
[](https://bit.ly/GeoAI-Tutorials)
|
|
139
|
+
|
|
133
140
|
## 🤝 Contributing
|
|
134
141
|
|
|
135
142
|
We welcome contributions of all kinds! See our [contributing guide](https://geoai.gishub.org/contributing) for ways to get started.
|
|
@@ -4,9 +4,9 @@
|
|
|
4
4
|
[](https://pepy.tech/project/geoai-py)
|
|
5
5
|
[](https://anaconda.org/conda-forge/geoai)
|
|
6
6
|
[](https://anaconda.org/conda-forge/geoai)
|
|
7
|
-
[](https://github.com/
|
|
7
|
+
[](https://github.com/giswqs/geoai-py-feedstock)
|
|
8
8
|
[](https://opensource.org/licenses/MIT)
|
|
9
|
-
[](https://bit.ly/GeoAI-Tutorials)
|
|
10
10
|
|
|
11
11
|
**A powerful Python package for integrating Artificial Intelligence with geospatial data analysis and visualization**
|
|
12
12
|
|
|
@@ -40,7 +40,7 @@ GeoAI bridges the gap between AI and geospatial analysis, providing tools for pr
|
|
|
40
40
|
- Integration with Meta's Segment Anything Model (SAM) for automatic feature extraction
|
|
41
41
|
- Specialized segmentation algorithms optimized for satellite and aerial imagery
|
|
42
42
|
- Streamlined workflows for segmenting buildings, roads, vegetation, and water bodies
|
|
43
|
-
- Export capabilities to standard geospatial formats (GeoJSON, Shapefile, GeoPackage)
|
|
43
|
+
- Export capabilities to standard geospatial formats (GeoJSON, Shapefile, GeoPackage, GeoParquet)
|
|
44
44
|
|
|
45
45
|
### 🔍 Image Classification
|
|
46
46
|
|
|
@@ -85,6 +85,12 @@ Comprehensive documentation is available at [https://geoai.gishub.org](https://g
|
|
|
85
85
|
- Explanation of algorithms and models
|
|
86
86
|
- Best practices for geospatial AI
|
|
87
87
|
|
|
88
|
+
## 📺 Video Tutorials
|
|
89
|
+
|
|
90
|
+
Check out our [YouTube channel](https://bit.ly/GeoAI-Tutorials) for video tutorials on using GeoAI for geospatial data analysis and visualization.
|
|
91
|
+
|
|
92
|
+
[](https://bit.ly/GeoAI-Tutorials)
|
|
93
|
+
|
|
88
94
|
## 🤝 Contributing
|
|
89
95
|
|
|
90
96
|
We welcome contributions of all kinds! See our [contributing guide](https://geoai.gishub.org/contributing) for ways to get started.
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
{
|
|
2
|
+
"cells": [
|
|
3
|
+
{
|
|
4
|
+
"cell_type": "markdown",
|
|
5
|
+
"metadata": {},
|
|
6
|
+
"source": [
|
|
7
|
+
"# Template\n",
|
|
8
|
+
"\n",
|
|
9
|
+
"[](https://colab.research.google.com/github/opengeos/geoai/blob/main/docs/examples/template.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
|
+
"metadata": {
|
|
42
|
+
"kernelspec": {
|
|
43
|
+
"display_name": "torch",
|
|
44
|
+
"language": "python",
|
|
45
|
+
"name": "python3"
|
|
46
|
+
},
|
|
47
|
+
"language_info": {
|
|
48
|
+
"codemirror_mode": {
|
|
49
|
+
"name": "ipython",
|
|
50
|
+
"version": 3
|
|
51
|
+
},
|
|
52
|
+
"file_extension": ".py",
|
|
53
|
+
"mimetype": "text/x-python",
|
|
54
|
+
"name": "python",
|
|
55
|
+
"nbconvert_exporter": "python",
|
|
56
|
+
"pygments_lexer": "ipython3",
|
|
57
|
+
"version": "3.11.8"
|
|
58
|
+
}
|
|
59
|
+
},
|
|
60
|
+
"nbformat": 4,
|
|
61
|
+
"nbformat_minor": 2
|
|
62
|
+
}
|
|
@@ -156,7 +156,8 @@
|
|
|
156
156
|
" confidence_threshold=0.5,\n",
|
|
157
157
|
" overlap=0.25,\n",
|
|
158
158
|
" nms_iou_threshold=0.5,\n",
|
|
159
|
-
"
|
|
159
|
+
" min_object_area=100,\n",
|
|
160
|
+
" max_object_area=None,\n",
|
|
160
161
|
" mask_threshold=0.5,\n",
|
|
161
162
|
" simplify_tolerance=1.0,\n",
|
|
162
163
|
")"
|
|
@@ -256,7 +257,7 @@
|
|
|
256
257
|
],
|
|
257
258
|
"metadata": {
|
|
258
259
|
"kernelspec": {
|
|
259
|
-
"display_name": "
|
|
260
|
+
"display_name": "geo",
|
|
260
261
|
"language": "python",
|
|
261
262
|
"name": "python3"
|
|
262
263
|
},
|
|
@@ -270,7 +271,7 @@
|
|
|
270
271
|
"name": "python",
|
|
271
272
|
"nbconvert_exporter": "python",
|
|
272
273
|
"pygments_lexer": "ipython3",
|
|
273
|
-
"version": "3.
|
|
274
|
+
"version": "3.12.2"
|
|
274
275
|
}
|
|
275
276
|
},
|
|
276
277
|
"nbformat": 4,
|
|
@@ -0,0 +1,254 @@
|
|
|
1
|
+
{
|
|
2
|
+
"cells": [
|
|
3
|
+
{
|
|
4
|
+
"cell_type": "markdown",
|
|
5
|
+
"metadata": {},
|
|
6
|
+
"source": [
|
|
7
|
+
"# Car Detection\n",
|
|
8
|
+
"\n",
|
|
9
|
+
"[](https://colab.research.google.com/github/opengeos/geoai/blob/main/docs/examples/car_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\n",
|
|
45
|
+
"\n",
|
|
46
|
+
"We will download a sample image from Hugging Face Hub to use for car detection. You can find more high-resolution images from [OpenAerialMap](https://openaerialmap.org)."
|
|
47
|
+
]
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
"cell_type": "code",
|
|
51
|
+
"execution_count": null,
|
|
52
|
+
"metadata": {},
|
|
53
|
+
"outputs": [],
|
|
54
|
+
"source": [
|
|
55
|
+
"raster_url = (\n",
|
|
56
|
+
" \"https://huggingface.co/datasets/giswqs/geospatial/resolve/main/cars_7cm.tif\"\n",
|
|
57
|
+
")"
|
|
58
|
+
]
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
"cell_type": "code",
|
|
62
|
+
"execution_count": null,
|
|
63
|
+
"metadata": {},
|
|
64
|
+
"outputs": [],
|
|
65
|
+
"source": [
|
|
66
|
+
"raster_path = geoai.download_file(raster_url)"
|
|
67
|
+
]
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
"cell_type": "markdown",
|
|
71
|
+
"metadata": {},
|
|
72
|
+
"source": [
|
|
73
|
+
"## Visualize the image"
|
|
74
|
+
]
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
"cell_type": "code",
|
|
78
|
+
"execution_count": null,
|
|
79
|
+
"metadata": {},
|
|
80
|
+
"outputs": [],
|
|
81
|
+
"source": [
|
|
82
|
+
"# geoai.view_raster(raster_url)"
|
|
83
|
+
]
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
"cell_type": "markdown",
|
|
87
|
+
"metadata": {},
|
|
88
|
+
"source": [
|
|
89
|
+
"## Initialize the model"
|
|
90
|
+
]
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
"cell_type": "code",
|
|
94
|
+
"execution_count": null,
|
|
95
|
+
"metadata": {},
|
|
96
|
+
"outputs": [],
|
|
97
|
+
"source": [
|
|
98
|
+
"detector = geoai.CarDetector()"
|
|
99
|
+
]
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
"cell_type": "markdown",
|
|
103
|
+
"metadata": {},
|
|
104
|
+
"source": [
|
|
105
|
+
"## Extract cars\n",
|
|
106
|
+
"\n",
|
|
107
|
+
"Extract cars from the image using the model and save the output image."
|
|
108
|
+
]
|
|
109
|
+
},
|
|
110
|
+
{
|
|
111
|
+
"cell_type": "code",
|
|
112
|
+
"execution_count": null,
|
|
113
|
+
"metadata": {},
|
|
114
|
+
"outputs": [],
|
|
115
|
+
"source": [
|
|
116
|
+
"mask_path = detector.generate_masks(\n",
|
|
117
|
+
" raster_path=raster_path,\n",
|
|
118
|
+
" output_path=\"cars_masks.tif\",\n",
|
|
119
|
+
" confidence_threshold=0.5,\n",
|
|
120
|
+
" mask_threshold=0.7,\n",
|
|
121
|
+
" overlap=0.25,\n",
|
|
122
|
+
")"
|
|
123
|
+
]
|
|
124
|
+
},
|
|
125
|
+
{
|
|
126
|
+
"cell_type": "markdown",
|
|
127
|
+
"metadata": {},
|
|
128
|
+
"source": [
|
|
129
|
+
"Convert the image masks to polygons and save the output GeoJSON file."
|
|
130
|
+
]
|
|
131
|
+
},
|
|
132
|
+
{
|
|
133
|
+
"cell_type": "code",
|
|
134
|
+
"execution_count": null,
|
|
135
|
+
"metadata": {},
|
|
136
|
+
"outputs": [],
|
|
137
|
+
"source": [
|
|
138
|
+
"gdf = detector.vectorize_masks(\n",
|
|
139
|
+
" masks_path=\"cars_masks.tif\",\n",
|
|
140
|
+
" output_path=\"cars.geojson\",\n",
|
|
141
|
+
" mask_threshold=127,\n",
|
|
142
|
+
" min_object_area=100,\n",
|
|
143
|
+
" max_object_area=2000,\n",
|
|
144
|
+
" erode_kernel_size=3,\n",
|
|
145
|
+
" erode_iterations=1,\n",
|
|
146
|
+
" use_watershed=True,\n",
|
|
147
|
+
")"
|
|
148
|
+
]
|
|
149
|
+
},
|
|
150
|
+
{
|
|
151
|
+
"cell_type": "markdown",
|
|
152
|
+
"metadata": {},
|
|
153
|
+
"source": [
|
|
154
|
+
"## Add geometric properties"
|
|
155
|
+
]
|
|
156
|
+
},
|
|
157
|
+
{
|
|
158
|
+
"cell_type": "code",
|
|
159
|
+
"execution_count": null,
|
|
160
|
+
"metadata": {},
|
|
161
|
+
"outputs": [],
|
|
162
|
+
"source": [
|
|
163
|
+
"gdf = geoai.add_geometric_properties(gdf)"
|
|
164
|
+
]
|
|
165
|
+
},
|
|
166
|
+
{
|
|
167
|
+
"cell_type": "markdown",
|
|
168
|
+
"metadata": {},
|
|
169
|
+
"source": [
|
|
170
|
+
"## Visualize initial results"
|
|
171
|
+
]
|
|
172
|
+
},
|
|
173
|
+
{
|
|
174
|
+
"cell_type": "code",
|
|
175
|
+
"execution_count": null,
|
|
176
|
+
"metadata": {},
|
|
177
|
+
"outputs": [],
|
|
178
|
+
"source": [
|
|
179
|
+
"geoai.view_vector_interactive(gdf, column=\"confidence\", tiles=raster_url)"
|
|
180
|
+
]
|
|
181
|
+
},
|
|
182
|
+
{
|
|
183
|
+
"cell_type": "markdown",
|
|
184
|
+
"metadata": {},
|
|
185
|
+
"source": [
|
|
186
|
+
"## Filter cars by area"
|
|
187
|
+
]
|
|
188
|
+
},
|
|
189
|
+
{
|
|
190
|
+
"cell_type": "code",
|
|
191
|
+
"execution_count": null,
|
|
192
|
+
"metadata": {},
|
|
193
|
+
"outputs": [],
|
|
194
|
+
"source": [
|
|
195
|
+
"gdf_filter = gdf[gdf[\"area_m2\"] > 8]"
|
|
196
|
+
]
|
|
197
|
+
},
|
|
198
|
+
{
|
|
199
|
+
"cell_type": "code",
|
|
200
|
+
"execution_count": null,
|
|
201
|
+
"metadata": {},
|
|
202
|
+
"outputs": [],
|
|
203
|
+
"source": [
|
|
204
|
+
"len(gdf_filter)"
|
|
205
|
+
]
|
|
206
|
+
},
|
|
207
|
+
{
|
|
208
|
+
"cell_type": "markdown",
|
|
209
|
+
"metadata": {},
|
|
210
|
+
"source": [
|
|
211
|
+
"## Visualiza final results"
|
|
212
|
+
]
|
|
213
|
+
},
|
|
214
|
+
{
|
|
215
|
+
"cell_type": "code",
|
|
216
|
+
"execution_count": null,
|
|
217
|
+
"metadata": {},
|
|
218
|
+
"outputs": [],
|
|
219
|
+
"source": [
|
|
220
|
+
"geoai.view_vector_interactive(gdf_filter, column=\"confidence\", tiles=raster_url)"
|
|
221
|
+
]
|
|
222
|
+
},
|
|
223
|
+
{
|
|
224
|
+
"cell_type": "code",
|
|
225
|
+
"execution_count": null,
|
|
226
|
+
"metadata": {},
|
|
227
|
+
"outputs": [],
|
|
228
|
+
"source": [
|
|
229
|
+
"geoai.view_vector_interactive(gdf_filter, tiles=raster_url)"
|
|
230
|
+
]
|
|
231
|
+
}
|
|
232
|
+
],
|
|
233
|
+
"metadata": {
|
|
234
|
+
"kernelspec": {
|
|
235
|
+
"display_name": "geo",
|
|
236
|
+
"language": "python",
|
|
237
|
+
"name": "python3"
|
|
238
|
+
},
|
|
239
|
+
"language_info": {
|
|
240
|
+
"codemirror_mode": {
|
|
241
|
+
"name": "ipython",
|
|
242
|
+
"version": 3
|
|
243
|
+
},
|
|
244
|
+
"file_extension": ".py",
|
|
245
|
+
"mimetype": "text/x-python",
|
|
246
|
+
"name": "python",
|
|
247
|
+
"nbconvert_exporter": "python",
|
|
248
|
+
"pygments_lexer": "ipython3",
|
|
249
|
+
"version": "3.12.2"
|
|
250
|
+
}
|
|
251
|
+
},
|
|
252
|
+
"nbformat": 4,
|
|
253
|
+
"nbformat_minor": 2
|
|
254
|
+
}
|
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
{
|
|
2
|
+
"cells": [
|
|
3
|
+
{
|
|
4
|
+
"cell_type": "markdown",
|
|
5
|
+
"metadata": {},
|
|
6
|
+
"source": [
|
|
7
|
+
"# Geometric Properties\n",
|
|
8
|
+
"\n",
|
|
9
|
+
"[](https://colab.research.google.com/github/opengeos/geoai/blob/main/docs/examples/geometric_properties.ipynb)\n",
|
|
10
|
+
"\n",
|
|
11
|
+
"This notebook demonstrates how to calculate geometric properties of objects in a vector dataset and filter out unwanted objects based on these properties.\n",
|
|
12
|
+
"\n",
|
|
13
|
+
"## Install package\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
|
+
"metadata": {},
|
|
21
|
+
"outputs": [],
|
|
22
|
+
"source": [
|
|
23
|
+
"# %pip install geoai-py"
|
|
24
|
+
]
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
"cell_type": "markdown",
|
|
28
|
+
"metadata": {},
|
|
29
|
+
"source": [
|
|
30
|
+
"## Import package"
|
|
31
|
+
]
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
"cell_type": "code",
|
|
35
|
+
"execution_count": null,
|
|
36
|
+
"metadata": {},
|
|
37
|
+
"outputs": [],
|
|
38
|
+
"source": [
|
|
39
|
+
"import geoai"
|
|
40
|
+
]
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
"cell_type": "markdown",
|
|
44
|
+
"metadata": {},
|
|
45
|
+
"source": [
|
|
46
|
+
"## Load data"
|
|
47
|
+
]
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
"cell_type": "code",
|
|
51
|
+
"execution_count": null,
|
|
52
|
+
"metadata": {},
|
|
53
|
+
"outputs": [],
|
|
54
|
+
"source": [
|
|
55
|
+
"vector_url = \"https://huggingface.co/datasets/giswqs/geospatial/resolve/main/naip_buildings_masks.geojson\"\n",
|
|
56
|
+
"raster_url = (\n",
|
|
57
|
+
" \"https://huggingface.co/datasets/giswqs/geospatial/resolve/main/naip_train.tif\"\n",
|
|
58
|
+
")"
|
|
59
|
+
]
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
"cell_type": "code",
|
|
63
|
+
"execution_count": null,
|
|
64
|
+
"metadata": {},
|
|
65
|
+
"outputs": [],
|
|
66
|
+
"source": [
|
|
67
|
+
"gdf = geoai.read_vector(vector_url)"
|
|
68
|
+
]
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
"cell_type": "code",
|
|
72
|
+
"execution_count": null,
|
|
73
|
+
"metadata": {},
|
|
74
|
+
"outputs": [],
|
|
75
|
+
"source": [
|
|
76
|
+
"gdf.head()"
|
|
77
|
+
]
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
"cell_type": "markdown",
|
|
81
|
+
"metadata": {},
|
|
82
|
+
"source": [
|
|
83
|
+
"## Visualize data"
|
|
84
|
+
]
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
"cell_type": "code",
|
|
88
|
+
"execution_count": null,
|
|
89
|
+
"metadata": {},
|
|
90
|
+
"outputs": [],
|
|
91
|
+
"source": [
|
|
92
|
+
"geoai.view_vector_interactive(gdf, column=\"confidence\", tiles=raster_url)"
|
|
93
|
+
]
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
"cell_type": "markdown",
|
|
97
|
+
"metadata": {},
|
|
98
|
+
"source": [
|
|
99
|
+
"## Add geometric properties"
|
|
100
|
+
]
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
"cell_type": "code",
|
|
104
|
+
"execution_count": null,
|
|
105
|
+
"metadata": {},
|
|
106
|
+
"outputs": [],
|
|
107
|
+
"source": [
|
|
108
|
+
"gdf_props = geoai.add_geometric_properties(gdf, area_unit=\"m2\", length_unit=\"m\")"
|
|
109
|
+
]
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
"cell_type": "code",
|
|
113
|
+
"execution_count": null,
|
|
114
|
+
"metadata": {},
|
|
115
|
+
"outputs": [],
|
|
116
|
+
"source": [
|
|
117
|
+
"gdf_props.head()"
|
|
118
|
+
]
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
"cell_type": "markdown",
|
|
122
|
+
"metadata": {},
|
|
123
|
+
"source": [
|
|
124
|
+
"## Visualize geometric properties"
|
|
125
|
+
]
|
|
126
|
+
},
|
|
127
|
+
{
|
|
128
|
+
"cell_type": "code",
|
|
129
|
+
"execution_count": null,
|
|
130
|
+
"metadata": {},
|
|
131
|
+
"outputs": [],
|
|
132
|
+
"source": [
|
|
133
|
+
"geoai.view_vector_interactive(gdf_props, column=\"area_m2\", tiles=raster_url)"
|
|
134
|
+
]
|
|
135
|
+
},
|
|
136
|
+
{
|
|
137
|
+
"cell_type": "code",
|
|
138
|
+
"execution_count": null,
|
|
139
|
+
"metadata": {},
|
|
140
|
+
"outputs": [],
|
|
141
|
+
"source": [
|
|
142
|
+
"geoai.view_vector_interactive(gdf_props, column=\"elongation\", tiles=raster_url)"
|
|
143
|
+
]
|
|
144
|
+
},
|
|
145
|
+
{
|
|
146
|
+
"cell_type": "markdown",
|
|
147
|
+
"metadata": {},
|
|
148
|
+
"source": [
|
|
149
|
+
"## Filter objects based on geometric properties"
|
|
150
|
+
]
|
|
151
|
+
},
|
|
152
|
+
{
|
|
153
|
+
"cell_type": "code",
|
|
154
|
+
"execution_count": null,
|
|
155
|
+
"metadata": {},
|
|
156
|
+
"outputs": [],
|
|
157
|
+
"source": [
|
|
158
|
+
"gdf_filtered = gdf_props[(gdf_props[\"area_m2\"] < 2000) & (gdf_props[\"elongation\"] < 5)]"
|
|
159
|
+
]
|
|
160
|
+
},
|
|
161
|
+
{
|
|
162
|
+
"cell_type": "markdown",
|
|
163
|
+
"metadata": {},
|
|
164
|
+
"source": [
|
|
165
|
+
"## Visualize filtered objects"
|
|
166
|
+
]
|
|
167
|
+
},
|
|
168
|
+
{
|
|
169
|
+
"cell_type": "code",
|
|
170
|
+
"execution_count": null,
|
|
171
|
+
"metadata": {},
|
|
172
|
+
"outputs": [],
|
|
173
|
+
"source": [
|
|
174
|
+
"geoai.view_vector_interactive(gdf_filtered, column=\"elongation\", tiles=raster_url)"
|
|
175
|
+
]
|
|
176
|
+
}
|
|
177
|
+
],
|
|
178
|
+
"metadata": {
|
|
179
|
+
"kernelspec": {
|
|
180
|
+
"display_name": "geo",
|
|
181
|
+
"language": "python",
|
|
182
|
+
"name": "python3"
|
|
183
|
+
},
|
|
184
|
+
"language_info": {
|
|
185
|
+
"codemirror_mode": {
|
|
186
|
+
"name": "ipython",
|
|
187
|
+
"version": 3
|
|
188
|
+
},
|
|
189
|
+
"file_extension": ".py",
|
|
190
|
+
"mimetype": "text/x-python",
|
|
191
|
+
"name": "python",
|
|
192
|
+
"nbconvert_exporter": "python",
|
|
193
|
+
"pygments_lexer": "ipython3",
|
|
194
|
+
"version": "3.12.2"
|
|
195
|
+
}
|
|
196
|
+
},
|
|
197
|
+
"nbformat": 4,
|
|
198
|
+
"nbformat_minor": 2
|
|
199
|
+
}
|
|
@@ -4,9 +4,9 @@
|
|
|
4
4
|
[](https://pepy.tech/project/geoai-py)
|
|
5
5
|
[](https://anaconda.org/conda-forge/geoai)
|
|
6
6
|
[](https://anaconda.org/conda-forge/geoai)
|
|
7
|
-
[](https://github.com/
|
|
7
|
+
[](https://github.com/giswqs/geoai-py-feedstock)
|
|
8
8
|
[](https://opensource.org/licenses/MIT)
|
|
9
|
-
[](https://bit.ly/GeoAI-Tutorials)
|
|
10
10
|
|
|
11
11
|
**A powerful Python package for integrating Artificial Intelligence with geospatial data analysis and visualization**
|
|
12
12
|
|
|
@@ -40,7 +40,7 @@ GeoAI bridges the gap between AI and geospatial analysis, providing tools for pr
|
|
|
40
40
|
- Integration with Meta's Segment Anything Model (SAM) for automatic feature extraction
|
|
41
41
|
- Specialized segmentation algorithms optimized for satellite and aerial imagery
|
|
42
42
|
- Streamlined workflows for segmenting buildings, roads, vegetation, and water bodies
|
|
43
|
-
- Export capabilities to standard geospatial formats (GeoJSON, Shapefile, GeoPackage)
|
|
43
|
+
- Export capabilities to standard geospatial formats (GeoJSON, Shapefile, GeoPackage, GeoParquet)
|
|
44
44
|
|
|
45
45
|
### 🔍 Image Classification
|
|
46
46
|
|
|
@@ -85,6 +85,12 @@ Comprehensive documentation is available at [https://geoai.gishub.org](https://g
|
|
|
85
85
|
- Explanation of algorithms and models
|
|
86
86
|
- Best practices for geospatial AI
|
|
87
87
|
|
|
88
|
+
## 📺 Video Tutorials
|
|
89
|
+
|
|
90
|
+
Check out our [YouTube channel](https://bit.ly/GeoAI-Tutorials) for video tutorials on using GeoAI for geospatial data analysis and visualization.
|
|
91
|
+
|
|
92
|
+
[](https://bit.ly/GeoAI-Tutorials)
|
|
93
|
+
|
|
88
94
|
## 🤝 Contributing
|
|
89
95
|
|
|
90
96
|
We welcome contributions of all kinds! See our [contributing guide](https://geoai.gishub.org/contributing) for ways to get started.
|