geoai-py 0.2.1__tar.gz → 0.2.3__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.2.1 → geoai_py-0.2.3}/.gitignore +2 -0
- {geoai_py-0.2.1 → geoai_py-0.2.3}/PKG-INFO +5 -1
- {geoai_py-0.2.1 → geoai_py-0.2.3}/README.md +2 -0
- geoai_py-0.2.3/docs/examples/building_footprints_usa.ipynb +157 -0
- {geoai_py-0.2.1 → geoai_py-0.2.3}/docs/examples/data_visualization.ipynb +7 -7
- geoai_py-0.2.3/docs/examples/image_chips.ipynb +235 -0
- geoai_py-0.2.3/docs/examples/view_metadata.ipynb +219 -0
- {geoai_py-0.2.1 → geoai_py-0.2.3}/docs/index.md +2 -0
- {geoai_py-0.2.1 → geoai_py-0.2.3}/docs/installation.md +12 -0
- {geoai_py-0.2.1 → geoai_py-0.2.3}/geoai/__init__.py +1 -1
- {geoai_py-0.2.1 → geoai_py-0.2.3}/geoai/common.py +190 -3
- {geoai_py-0.2.1 → geoai_py-0.2.3}/geoai/extract.py +2 -2
- geoai_py-0.2.3/geoai/geoai.py +5 -0
- {geoai_py-0.2.1 → geoai_py-0.2.3}/geoai/preprocess.py +872 -116
- {geoai_py-0.2.1 → geoai_py-0.2.3}/geoai_py.egg-info/PKG-INFO +5 -1
- {geoai_py-0.2.1 → geoai_py-0.2.3}/geoai_py.egg-info/SOURCES.txt +3 -0
- {geoai_py-0.2.1 → geoai_py-0.2.3}/geoai_py.egg-info/requires.txt +2 -0
- {geoai_py-0.2.1 → geoai_py-0.2.3}/mkdocs.yml +12 -2
- {geoai_py-0.2.1 → geoai_py-0.2.3}/pyproject.toml +2 -2
- {geoai_py-0.2.1 → geoai_py-0.2.3}/requirements.txt +2 -0
- {geoai_py-0.2.1 → geoai_py-0.2.3}/requirements_docs.txt +2 -0
- geoai_py-0.2.1/geoai/geoai.py +0 -3
- {geoai_py-0.2.1 → geoai_py-0.2.3}/.editorconfig +0 -0
- {geoai_py-0.2.1 → geoai_py-0.2.3}/.github/ISSUE_TEMPLATE/bug_report.md +0 -0
- {geoai_py-0.2.1 → geoai_py-0.2.3}/.github/ISSUE_TEMPLATE/config.yml +0 -0
- {geoai_py-0.2.1 → geoai_py-0.2.3}/.github/ISSUE_TEMPLATE/feature_request.md +0 -0
- {geoai_py-0.2.1 → geoai_py-0.2.3}/.github/dependabot.yml +0 -0
- {geoai_py-0.2.1 → geoai_py-0.2.3}/.github/workflows/docs-build.yml +0 -0
- {geoai_py-0.2.1 → geoai_py-0.2.3}/.github/workflows/docs.yml +0 -0
- {geoai_py-0.2.1 → geoai_py-0.2.3}/.github/workflows/macos.yml +0 -0
- {geoai_py-0.2.1 → geoai_py-0.2.3}/.github/workflows/pypi.yml +0 -0
- {geoai_py-0.2.1 → geoai_py-0.2.3}/.github/workflows/ubuntu.yml +0 -0
- {geoai_py-0.2.1 → geoai_py-0.2.3}/.github/workflows/windows.yml +0 -0
- {geoai_py-0.2.1 → geoai_py-0.2.3}/.pre-commit-config.yaml +0 -0
- {geoai_py-0.2.1 → geoai_py-0.2.3}/LICENSE +0 -0
- {geoai_py-0.2.1 → geoai_py-0.2.3}/MANIFEST.in +0 -0
- {geoai_py-0.2.1 → geoai_py-0.2.3}/docs/CNAME +0 -0
- {geoai_py-0.2.1 → geoai_py-0.2.3}/docs/changelog.md +0 -0
- {geoai_py-0.2.1 → geoai_py-0.2.3}/docs/common.md +0 -0
- {geoai_py-0.2.1 → geoai_py-0.2.3}/docs/contributing.md +0 -0
- {geoai_py-0.2.1 → geoai_py-0.2.3}/docs/download.md +0 -0
- {geoai_py-0.2.1 → geoai_py-0.2.3}/docs/examples/dataviz/lidar_viz.ipynb +0 -0
- {geoai_py-0.2.1 → geoai_py-0.2.3}/docs/examples/dataviz/raster_viz.ipynb +0 -0
- {geoai_py-0.2.1 → geoai_py-0.2.3}/docs/examples/dataviz/vector_viz.ipynb +0 -0
- {geoai_py-0.2.1 → geoai_py-0.2.3}/docs/examples/download_data.ipynb +0 -0
- {geoai_py-0.2.1 → geoai_py-0.2.3}/docs/examples/jupytext.toml +0 -0
- {geoai_py-0.2.1 → geoai_py-0.2.3}/docs/examples/rastervision/semantic_segmentation.ipynb +0 -0
- {geoai_py-0.2.1 → geoai_py-0.2.3}/docs/examples/samgeo/arcgis.ipynb +0 -0
- {geoai_py-0.2.1 → geoai_py-0.2.3}/docs/examples/samgeo/automatic_mask_generator.ipynb +0 -0
- {geoai_py-0.2.1 → geoai_py-0.2.3}/docs/examples/samgeo/automatic_mask_generator_hq.ipynb +0 -0
- {geoai_py-0.2.1 → geoai_py-0.2.3}/docs/examples/samgeo/box_prompts.ipynb +0 -0
- {geoai_py-0.2.1 → geoai_py-0.2.3}/docs/examples/samgeo/fast_sam.ipynb +0 -0
- {geoai_py-0.2.1 → geoai_py-0.2.3}/docs/examples/samgeo/input_prompts.ipynb +0 -0
- {geoai_py-0.2.1 → geoai_py-0.2.3}/docs/examples/samgeo/input_prompts_hq.ipynb +0 -0
- {geoai_py-0.2.1 → geoai_py-0.2.3}/docs/examples/samgeo/maxar_open_data.ipynb +0 -0
- {geoai_py-0.2.1 → geoai_py-0.2.3}/docs/examples/samgeo/satellite-predictor.ipynb +0 -0
- {geoai_py-0.2.1 → geoai_py-0.2.3}/docs/examples/samgeo/satellite.ipynb +0 -0
- {geoai_py-0.2.1 → geoai_py-0.2.3}/docs/examples/samgeo/swimming_pools.ipynb +0 -0
- {geoai_py-0.2.1 → geoai_py-0.2.3}/docs/examples/samgeo/text_prompts.ipynb +0 -0
- {geoai_py-0.2.1 → geoai_py-0.2.3}/docs/examples/samgeo/text_prompts_batch.ipynb +0 -0
- {geoai_py-0.2.1 → geoai_py-0.2.3}/docs/extract.md +0 -0
- {geoai_py-0.2.1 → geoai_py-0.2.3}/docs/faq.md +0 -0
- {geoai_py-0.2.1 → geoai_py-0.2.3}/docs/geoai.md +0 -0
- {geoai_py-0.2.1 → geoai_py-0.2.3}/docs/overrides/main.html +0 -0
- {geoai_py-0.2.1 → geoai_py-0.2.3}/docs/preprocess.md +0 -0
- {geoai_py-0.2.1 → geoai_py-0.2.3}/docs/segmentation.md +0 -0
- {geoai_py-0.2.1 → geoai_py-0.2.3}/docs/usage.md +0 -0
- {geoai_py-0.2.1 → geoai_py-0.2.3}/geoai/download.py +0 -0
- {geoai_py-0.2.1 → geoai_py-0.2.3}/geoai/segmentation.py +0 -0
- {geoai_py-0.2.1 → geoai_py-0.2.3}/geoai_py.egg-info/dependency_links.txt +0 -0
- {geoai_py-0.2.1 → geoai_py-0.2.3}/geoai_py.egg-info/entry_points.txt +0 -0
- {geoai_py-0.2.1 → geoai_py-0.2.3}/geoai_py.egg-info/top_level.txt +0 -0
- {geoai_py-0.2.1 → geoai_py-0.2.3}/setup.cfg +0 -0
- {geoai_py-0.2.1 → geoai_py-0.2.3}/tests/__init__.py +0 -0
- {geoai_py-0.2.1 → geoai_py-0.2.3}/tests/test_geoai.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.2
|
|
2
2
|
Name: geoai-py
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.3
|
|
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
|
|
@@ -18,11 +18,13 @@ Requires-Python: >=3.9
|
|
|
18
18
|
Description-Content-Type: text/markdown
|
|
19
19
|
License-File: LICENSE
|
|
20
20
|
Requires-Dist: albumentations
|
|
21
|
+
Requires-Dist: contextily
|
|
21
22
|
Requires-Dist: geopandas
|
|
22
23
|
Requires-Dist: huggingface_hub
|
|
23
24
|
Requires-Dist: jupyter-server-proxy
|
|
24
25
|
Requires-Dist: leafmap
|
|
25
26
|
Requires-Dist: localtileserver
|
|
27
|
+
Requires-Dist: mapclassify
|
|
26
28
|
Requires-Dist: overturemaps
|
|
27
29
|
Requires-Dist: planetary-computer
|
|
28
30
|
Requires-Dist: pystac-client
|
|
@@ -62,6 +64,8 @@ GeoAI bridges the gap between AI and geospatial analysis, providing tools for pr
|
|
|
62
64
|
|
|
63
65
|
## 🚀 Key Features
|
|
64
66
|
|
|
67
|
+
❗ **Important notes:** The GeoAI package is under active development and new features are being added regularly. Not all features listed below are available in the current release. If you have a feature request or would like to contribute, please let us know!
|
|
68
|
+
|
|
65
69
|
### 📊 Advanced Geospatial Data Visualization
|
|
66
70
|
|
|
67
71
|
- Interactive multi-layer visualization of vector, raster, and point cloud data
|
|
@@ -18,6 +18,8 @@ GeoAI bridges the gap between AI and geospatial analysis, providing tools for pr
|
|
|
18
18
|
|
|
19
19
|
## 🚀 Key Features
|
|
20
20
|
|
|
21
|
+
❗ **Important notes:** The GeoAI package is under active development and new features are being added regularly. Not all features listed below are available in the current release. If you have a feature request or would like to contribute, please let us know!
|
|
22
|
+
|
|
21
23
|
### 📊 Advanced Geospatial Data Visualization
|
|
22
24
|
|
|
23
25
|
- Interactive multi-layer visualization of vector, raster, and point cloud data
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
{
|
|
2
|
+
"cells": [
|
|
3
|
+
{
|
|
4
|
+
"cell_type": "markdown",
|
|
5
|
+
"metadata": {},
|
|
6
|
+
"source": [
|
|
7
|
+
"# Building Footprint Extraction for the USA\n",
|
|
8
|
+
"\n",
|
|
9
|
+
"[](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"
|
|
82
|
+
]
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
"cell_type": "code",
|
|
86
|
+
"execution_count": null,
|
|
87
|
+
"metadata": {},
|
|
88
|
+
"outputs": [],
|
|
89
|
+
"source": [
|
|
90
|
+
"extractor = geoai.BuildingFootprintExtractor()"
|
|
91
|
+
]
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
"cell_type": "markdown",
|
|
95
|
+
"metadata": {},
|
|
96
|
+
"source": [
|
|
97
|
+
"## Extract building footprints"
|
|
98
|
+
]
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
"cell_type": "code",
|
|
102
|
+
"execution_count": null,
|
|
103
|
+
"metadata": {},
|
|
104
|
+
"outputs": [],
|
|
105
|
+
"source": [
|
|
106
|
+
"output_path = \"naip_buildings.geojson\"\n",
|
|
107
|
+
"gdf = extractor.process_raster(raster_path, output_path, batch_size=4)"
|
|
108
|
+
]
|
|
109
|
+
},
|
|
110
|
+
{
|
|
111
|
+
"cell_type": "markdown",
|
|
112
|
+
"metadata": {},
|
|
113
|
+
"source": [
|
|
114
|
+
"## Visualize building footprints"
|
|
115
|
+
]
|
|
116
|
+
},
|
|
117
|
+
{
|
|
118
|
+
"cell_type": "code",
|
|
119
|
+
"execution_count": null,
|
|
120
|
+
"metadata": {},
|
|
121
|
+
"outputs": [],
|
|
122
|
+
"source": [
|
|
123
|
+
"gdf.head()"
|
|
124
|
+
]
|
|
125
|
+
},
|
|
126
|
+
{
|
|
127
|
+
"cell_type": "code",
|
|
128
|
+
"execution_count": null,
|
|
129
|
+
"metadata": {},
|
|
130
|
+
"outputs": [],
|
|
131
|
+
"source": [
|
|
132
|
+
"gdf.explore()"
|
|
133
|
+
]
|
|
134
|
+
}
|
|
135
|
+
],
|
|
136
|
+
"metadata": {
|
|
137
|
+
"kernelspec": {
|
|
138
|
+
"display_name": "torch",
|
|
139
|
+
"language": "python",
|
|
140
|
+
"name": "python3"
|
|
141
|
+
},
|
|
142
|
+
"language_info": {
|
|
143
|
+
"codemirror_mode": {
|
|
144
|
+
"name": "ipython",
|
|
145
|
+
"version": 3
|
|
146
|
+
},
|
|
147
|
+
"file_extension": ".py",
|
|
148
|
+
"mimetype": "text/x-python",
|
|
149
|
+
"name": "python",
|
|
150
|
+
"nbconvert_exporter": "python",
|
|
151
|
+
"pygments_lexer": "ipython3",
|
|
152
|
+
"version": "3.11.8"
|
|
153
|
+
}
|
|
154
|
+
},
|
|
155
|
+
"nbformat": 4,
|
|
156
|
+
"nbformat_minor": 2
|
|
157
|
+
}
|
|
@@ -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
|
|
43
|
+
"from geoai.common import view_image, view_raster, dict_to_image\n",
|
|
44
44
|
"from geoai.download import download_naip"
|
|
45
45
|
]
|
|
46
46
|
},
|
|
@@ -83,8 +83,8 @@
|
|
|
83
83
|
" - **RandomGeoSampler**: Samples random patches from the dataset\n",
|
|
84
84
|
" - **GridGeoSampler**: Samples patches in a grid pattern with specified stride\n",
|
|
85
85
|
"- **geoai.common**: Custom utility functions for visualization:\n",
|
|
86
|
-
" - **
|
|
87
|
-
" - **
|
|
86
|
+
" - **view_image**: Visualizes tensor images\n",
|
|
87
|
+
" - **view_raster**: Displays georeferenced data on an interactive map\n",
|
|
88
88
|
" - **dict_to_image**: Converts dictionary representation to image format\n",
|
|
89
89
|
"\n",
|
|
90
90
|
"## Setting Up the Dataset"
|
|
@@ -230,7 +230,7 @@
|
|
|
230
230
|
"metadata": {},
|
|
231
231
|
"outputs": [],
|
|
232
232
|
"source": [
|
|
233
|
-
"
|
|
233
|
+
"view_image(\n",
|
|
234
234
|
" train_image, transpose=True, scale_factor=(1 / 250), title=\"Random GeoSampler\"\n",
|
|
235
235
|
")"
|
|
236
236
|
]
|
|
@@ -307,7 +307,7 @@
|
|
|
307
307
|
"metadata": {},
|
|
308
308
|
"outputs": [],
|
|
309
309
|
"source": [
|
|
310
|
-
"
|
|
310
|
+
"view_image(test_image, transpose=True, scale_factor=(1 / 250), title=\"Grid GeoSampler\")"
|
|
311
311
|
]
|
|
312
312
|
},
|
|
313
313
|
{
|
|
@@ -343,7 +343,7 @@
|
|
|
343
343
|
"metadata": {},
|
|
344
344
|
"outputs": [],
|
|
345
345
|
"source": [
|
|
346
|
-
"
|
|
346
|
+
"view_raster(data, basemap=\"Google Satellite\")"
|
|
347
347
|
]
|
|
348
348
|
},
|
|
349
349
|
{
|
|
@@ -356,7 +356,7 @@
|
|
|
356
356
|
"\n",
|
|
357
357
|
"1. **TorchGeo** provides a flexible framework for working with geospatial datasets like NAIP.\n",
|
|
358
358
|
"2. Different sampling strategies (random vs. grid) serve different purposes in geospatial machine learning workflows.\n",
|
|
359
|
-
"3. Visualization tools help understand the data in both pixel space (
|
|
359
|
+
"3. Visualization tools help understand the data in both pixel space (view_image) and geographic space (view_raster).\n",
|
|
360
360
|
"4. Working with geospatial data requires attention to coordinate reference systems (CRS) and proper handling of georeferenced data."
|
|
361
361
|
]
|
|
362
362
|
}
|
|
@@ -0,0 +1,235 @@
|
|
|
1
|
+
{
|
|
2
|
+
"cells": [
|
|
3
|
+
{
|
|
4
|
+
"cell_type": "markdown",
|
|
5
|
+
"metadata": {},
|
|
6
|
+
"source": [
|
|
7
|
+
"# Generate Image Chips\n",
|
|
8
|
+
"\n",
|
|
9
|
+
"[](https://colab.research.google.com/github/opengeos/geoai/blob/main/docs/examples/image_chips.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 Packages"
|
|
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
|
+
"## Preview data"
|
|
82
|
+
]
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
"cell_type": "code",
|
|
86
|
+
"execution_count": null,
|
|
87
|
+
"metadata": {},
|
|
88
|
+
"outputs": [],
|
|
89
|
+
"source": [
|
|
90
|
+
"geoai.view_image(raster_path, figsize=(18, 10))"
|
|
91
|
+
]
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
"cell_type": "code",
|
|
95
|
+
"execution_count": null,
|
|
96
|
+
"metadata": {},
|
|
97
|
+
"outputs": [],
|
|
98
|
+
"source": [
|
|
99
|
+
"geoai.view_vector(vector_path, basemap=True, alpha=0.5, figsize=(18, 10))"
|
|
100
|
+
]
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
"cell_type": "code",
|
|
104
|
+
"execution_count": null,
|
|
105
|
+
"metadata": {},
|
|
106
|
+
"outputs": [],
|
|
107
|
+
"source": [
|
|
108
|
+
"geoai.view_vector_interactive(vector_path)"
|
|
109
|
+
]
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
"cell_type": "markdown",
|
|
113
|
+
"metadata": {},
|
|
114
|
+
"source": [
|
|
115
|
+
"## Convert vector to raster"
|
|
116
|
+
]
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
"cell_type": "code",
|
|
120
|
+
"execution_count": null,
|
|
121
|
+
"metadata": {},
|
|
122
|
+
"outputs": [],
|
|
123
|
+
"source": [
|
|
124
|
+
"output_path = vector_path.replace(\".geojson\", \".tif\")\n",
|
|
125
|
+
"geoai.vector_to_raster(vector_path, output_path, reference_raster=raster_path)"
|
|
126
|
+
]
|
|
127
|
+
},
|
|
128
|
+
{
|
|
129
|
+
"cell_type": "code",
|
|
130
|
+
"execution_count": null,
|
|
131
|
+
"metadata": {},
|
|
132
|
+
"outputs": [],
|
|
133
|
+
"source": [
|
|
134
|
+
"geoai.view_image(output_path, figsize=(18, 10))"
|
|
135
|
+
]
|
|
136
|
+
},
|
|
137
|
+
{
|
|
138
|
+
"cell_type": "markdown",
|
|
139
|
+
"metadata": {},
|
|
140
|
+
"source": [
|
|
141
|
+
"## Generate image chips"
|
|
142
|
+
]
|
|
143
|
+
},
|
|
144
|
+
{
|
|
145
|
+
"cell_type": "code",
|
|
146
|
+
"execution_count": null,
|
|
147
|
+
"metadata": {},
|
|
148
|
+
"outputs": [],
|
|
149
|
+
"source": [
|
|
150
|
+
"tiles = geoai.export_geotiff_tiles(\n",
|
|
151
|
+
" in_raster=raster_path,\n",
|
|
152
|
+
" out_folder=\"output\",\n",
|
|
153
|
+
" in_class_data=vector_path,\n",
|
|
154
|
+
" tile_size=512,\n",
|
|
155
|
+
" stride=256,\n",
|
|
156
|
+
" buffer_radius=0,\n",
|
|
157
|
+
" create_overview=True,\n",
|
|
158
|
+
")"
|
|
159
|
+
]
|
|
160
|
+
},
|
|
161
|
+
{
|
|
162
|
+
"cell_type": "markdown",
|
|
163
|
+
"metadata": {},
|
|
164
|
+
"source": [
|
|
165
|
+
"## Preview image chips"
|
|
166
|
+
]
|
|
167
|
+
},
|
|
168
|
+
{
|
|
169
|
+
"cell_type": "code",
|
|
170
|
+
"execution_count": null,
|
|
171
|
+
"metadata": {},
|
|
172
|
+
"outputs": [],
|
|
173
|
+
"source": [
|
|
174
|
+
"geoai.view_image(\"output/overview.png\", figsize=(18, 10))"
|
|
175
|
+
]
|
|
176
|
+
},
|
|
177
|
+
{
|
|
178
|
+
"cell_type": "code",
|
|
179
|
+
"execution_count": null,
|
|
180
|
+
"metadata": {},
|
|
181
|
+
"outputs": [],
|
|
182
|
+
"source": [
|
|
183
|
+
"geoai.view_image(\"output/images/tile_000000.tif\")"
|
|
184
|
+
]
|
|
185
|
+
},
|
|
186
|
+
{
|
|
187
|
+
"cell_type": "code",
|
|
188
|
+
"execution_count": null,
|
|
189
|
+
"metadata": {},
|
|
190
|
+
"outputs": [],
|
|
191
|
+
"source": [
|
|
192
|
+
"geoai.view_image(\"output/labels/tile_000000.tif\")"
|
|
193
|
+
]
|
|
194
|
+
},
|
|
195
|
+
{
|
|
196
|
+
"cell_type": "code",
|
|
197
|
+
"execution_count": null,
|
|
198
|
+
"metadata": {},
|
|
199
|
+
"outputs": [],
|
|
200
|
+
"source": [
|
|
201
|
+
"geoai.view_image(\"output/images/tile_000001.tif\")"
|
|
202
|
+
]
|
|
203
|
+
},
|
|
204
|
+
{
|
|
205
|
+
"cell_type": "code",
|
|
206
|
+
"execution_count": null,
|
|
207
|
+
"metadata": {},
|
|
208
|
+
"outputs": [],
|
|
209
|
+
"source": [
|
|
210
|
+
"geoai.view_image(\"output/labels/tile_000001.tif\")"
|
|
211
|
+
]
|
|
212
|
+
}
|
|
213
|
+
],
|
|
214
|
+
"metadata": {
|
|
215
|
+
"kernelspec": {
|
|
216
|
+
"display_name": "torch",
|
|
217
|
+
"language": "python",
|
|
218
|
+
"name": "python3"
|
|
219
|
+
},
|
|
220
|
+
"language_info": {
|
|
221
|
+
"codemirror_mode": {
|
|
222
|
+
"name": "ipython",
|
|
223
|
+
"version": 3
|
|
224
|
+
},
|
|
225
|
+
"file_extension": ".py",
|
|
226
|
+
"mimetype": "text/x-python",
|
|
227
|
+
"name": "python",
|
|
228
|
+
"nbconvert_exporter": "python",
|
|
229
|
+
"pygments_lexer": "ipython3",
|
|
230
|
+
"version": "3.11.8"
|
|
231
|
+
}
|
|
232
|
+
},
|
|
233
|
+
"nbformat": 4,
|
|
234
|
+
"nbformat_minor": 2
|
|
235
|
+
}
|