geoai-py 0.4.1__tar.gz → 0.4.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.
Files changed (102) hide show
  1. {geoai_py-0.4.1 → geoai_py-0.4.3}/.gitignore +1 -0
  2. {geoai_py-0.4.1 → geoai_py-0.4.3}/PKG-INFO +6 -6
  3. {geoai_py-0.4.1 → geoai_py-0.4.3}/README.md +2 -4
  4. geoai_py-0.4.3/docs/assets/logo.ico +0 -0
  5. geoai_py-0.4.3/docs/assets/logo.png +0 -0
  6. geoai_py-0.4.3/docs/assets/logo_rect.png +0 -0
  7. {geoai_py-0.4.1 → geoai_py-0.4.3}/docs/examples/building_footprints_usa.ipynb +1 -3
  8. {geoai_py-0.4.1 → geoai_py-0.4.3}/docs/examples/dataviz/lidar_viz.ipynb +1 -1
  9. {geoai_py-0.4.1 → geoai_py-0.4.3}/docs/examples/dataviz/raster_viz.ipynb +2 -2
  10. {geoai_py-0.4.1 → geoai_py-0.4.3}/docs/examples/dataviz/vector_viz.ipynb +3 -3
  11. geoai_py-0.4.3/docs/examples/download_sentinel2.ipynb +182 -0
  12. geoai_py-0.4.3/docs/examples/planetary_computer.ipynb +338 -0
  13. geoai_py-0.4.3/docs/examples/train_building_footprints_usa.ipynb +259 -0
  14. geoai_py-0.4.3/docs/examples/train_car_detection.ipynb +259 -0
  15. geoai_py-0.4.3/docs/examples/train_ship_detection.ipynb +257 -0
  16. geoai_py-0.4.3/docs/examples/train_solar_panel_detection.ipynb +255 -0
  17. geoai_py-0.4.3/docs/examples/wetland_mapping.ipynb +329 -0
  18. {geoai_py-0.4.1 → geoai_py-0.4.3}/docs/index.md +2 -4
  19. {geoai_py-0.4.1 → geoai_py-0.4.3}/geoai/__init__.py +1 -1
  20. geoai_py-0.4.3/geoai/download.py +1144 -0
  21. {geoai_py-0.4.1 → geoai_py-0.4.3}/geoai/extract.py +671 -46
  22. geoai_py-0.4.3/geoai/geoai.py +28 -0
  23. {geoai_py-0.4.1 → geoai_py-0.4.3}/geoai/train.py +98 -12
  24. {geoai_py-0.4.1 → geoai_py-0.4.3}/geoai/utils.py +240 -8
  25. {geoai_py-0.4.1 → geoai_py-0.4.3}/geoai_py.egg-info/PKG-INFO +6 -6
  26. {geoai_py-0.4.1 → geoai_py-0.4.3}/geoai_py.egg-info/SOURCES.txt +10 -0
  27. {geoai_py-0.4.1 → geoai_py-0.4.3}/geoai_py.egg-info/requires.txt +1 -0
  28. {geoai_py-0.4.1 → geoai_py-0.4.3}/mkdocs.yml +9 -2
  29. {geoai_py-0.4.1 → geoai_py-0.4.3}/pyproject.toml +2 -2
  30. {geoai_py-0.4.1 → geoai_py-0.4.3}/requirements.txt +1 -0
  31. geoai_py-0.4.1/geoai/download.py +0 -396
  32. geoai_py-0.4.1/geoai/geoai.py +0 -7
  33. {geoai_py-0.4.1 → geoai_py-0.4.3}/.editorconfig +0 -0
  34. {geoai_py-0.4.1 → geoai_py-0.4.3}/.github/FUNDING.yml +0 -0
  35. {geoai_py-0.4.1 → geoai_py-0.4.3}/.github/ISSUE_TEMPLATE/bug_report.md +0 -0
  36. {geoai_py-0.4.1 → geoai_py-0.4.3}/.github/ISSUE_TEMPLATE/config.yml +0 -0
  37. {geoai_py-0.4.1 → geoai_py-0.4.3}/.github/ISSUE_TEMPLATE/feature_request.md +0 -0
  38. {geoai_py-0.4.1 → geoai_py-0.4.3}/.github/dependabot.yml +0 -0
  39. {geoai_py-0.4.1 → geoai_py-0.4.3}/.github/workflows/docs-build.yml +0 -0
  40. {geoai_py-0.4.1 → geoai_py-0.4.3}/.github/workflows/docs.yml +0 -0
  41. {geoai_py-0.4.1 → geoai_py-0.4.3}/.github/workflows/macos.yml +0 -0
  42. {geoai_py-0.4.1 → geoai_py-0.4.3}/.github/workflows/pypi.yml +0 -0
  43. {geoai_py-0.4.1 → geoai_py-0.4.3}/.github/workflows/ubuntu.yml +0 -0
  44. {geoai_py-0.4.1 → geoai_py-0.4.3}/.github/workflows/windows.yml +0 -0
  45. {geoai_py-0.4.1 → geoai_py-0.4.3}/.pre-commit-config.yaml +0 -0
  46. {geoai_py-0.4.1 → geoai_py-0.4.3}/LICENSE +0 -0
  47. {geoai_py-0.4.1 → geoai_py-0.4.3}/MANIFEST.in +0 -0
  48. {geoai_py-0.4.1 → geoai_py-0.4.3}/docs/CNAME +0 -0
  49. {geoai_py-0.4.1 → geoai_py-0.4.3}/docs/changelog.md +0 -0
  50. {geoai_py-0.4.1 → geoai_py-0.4.3}/docs/contributing.md +0 -0
  51. {geoai_py-0.4.1 → geoai_py-0.4.3}/docs/download.md +0 -0
  52. {geoai_py-0.4.1 → geoai_py-0.4.3}/docs/examples/_template.ipynb +0 -0
  53. {geoai_py-0.4.1 → geoai_py-0.4.3}/docs/examples/building_footprints_africa.ipynb +0 -0
  54. {geoai_py-0.4.1 → geoai_py-0.4.3}/docs/examples/building_footprints_china.ipynb +0 -0
  55. {geoai_py-0.4.1 → geoai_py-0.4.3}/docs/examples/building_regularization.ipynb +0 -0
  56. {geoai_py-0.4.1 → geoai_py-0.4.3}/docs/examples/car_detection.ipynb +0 -0
  57. {geoai_py-0.4.1 → geoai_py-0.4.3}/docs/examples/data_visualization.ipynb +0 -0
  58. {geoai_py-0.4.1 → geoai_py-0.4.3}/docs/examples/download_data.ipynb +0 -0
  59. {geoai_py-0.4.1 → geoai_py-0.4.3}/docs/examples/geometric_properties.ipynb +0 -0
  60. {geoai_py-0.4.1 → geoai_py-0.4.3}/docs/examples/image_chips.ipynb +0 -0
  61. {geoai_py-0.4.1 → geoai_py-0.4.3}/docs/examples/jupytext.toml +0 -0
  62. {geoai_py-0.4.1 → geoai_py-0.4.3}/docs/examples/parking_spot_detection.ipynb +0 -0
  63. {geoai_py-0.4.1 → geoai_py-0.4.3}/docs/examples/rastervision/semantic_segmentation.ipynb +0 -0
  64. {geoai_py-0.4.1 → geoai_py-0.4.3}/docs/examples/samgeo/arcgis.ipynb +0 -0
  65. {geoai_py-0.4.1 → geoai_py-0.4.3}/docs/examples/samgeo/automatic_mask_generator.ipynb +0 -0
  66. {geoai_py-0.4.1 → geoai_py-0.4.3}/docs/examples/samgeo/automatic_mask_generator_hq.ipynb +0 -0
  67. {geoai_py-0.4.1 → geoai_py-0.4.3}/docs/examples/samgeo/box_prompts.ipynb +0 -0
  68. {geoai_py-0.4.1 → geoai_py-0.4.3}/docs/examples/samgeo/fast_sam.ipynb +0 -0
  69. {geoai_py-0.4.1 → geoai_py-0.4.3}/docs/examples/samgeo/input_prompts.ipynb +0 -0
  70. {geoai_py-0.4.1 → geoai_py-0.4.3}/docs/examples/samgeo/input_prompts_hq.ipynb +0 -0
  71. {geoai_py-0.4.1 → geoai_py-0.4.3}/docs/examples/samgeo/maxar_open_data.ipynb +0 -0
  72. {geoai_py-0.4.1 → geoai_py-0.4.3}/docs/examples/samgeo/satellite-predictor.ipynb +0 -0
  73. {geoai_py-0.4.1 → geoai_py-0.4.3}/docs/examples/samgeo/satellite.ipynb +0 -0
  74. {geoai_py-0.4.1 → geoai_py-0.4.3}/docs/examples/samgeo/swimming_pools.ipynb +0 -0
  75. {geoai_py-0.4.1 → geoai_py-0.4.3}/docs/examples/samgeo/text_prompts.ipynb +0 -0
  76. {geoai_py-0.4.1 → geoai_py-0.4.3}/docs/examples/samgeo/text_prompts_batch.ipynb +0 -0
  77. {geoai_py-0.4.1 → geoai_py-0.4.3}/docs/examples/ship_detection.ipynb +0 -0
  78. {geoai_py-0.4.1 → geoai_py-0.4.3}/docs/examples/solar_panel_detection.ipynb +0 -0
  79. {geoai_py-0.4.1 → geoai_py-0.4.3}/docs/examples/text_prompt_segmentation.ipynb +0 -0
  80. {geoai_py-0.4.1 → geoai_py-0.4.3}/docs/examples/train_object_detection_model.ipynb +0 -0
  81. {geoai_py-0.4.1 → geoai_py-0.4.3}/docs/examples/view_metadata.ipynb +0 -0
  82. {geoai_py-0.4.1 → geoai_py-0.4.3}/docs/extract.md +0 -0
  83. {geoai_py-0.4.1 → geoai_py-0.4.3}/docs/faq.md +0 -0
  84. {geoai_py-0.4.1 → geoai_py-0.4.3}/docs/geoai.md +0 -0
  85. {geoai_py-0.4.1 → geoai_py-0.4.3}/docs/hf.md +0 -0
  86. {geoai_py-0.4.1 → geoai_py-0.4.3}/docs/installation.md +0 -0
  87. {geoai_py-0.4.1 → geoai_py-0.4.3}/docs/overrides/main.html +0 -0
  88. {geoai_py-0.4.1 → geoai_py-0.4.3}/docs/segment.md +0 -0
  89. {geoai_py-0.4.1 → geoai_py-0.4.3}/docs/segmentation.md +0 -0
  90. {geoai_py-0.4.1 → geoai_py-0.4.3}/docs/train.md +0 -0
  91. {geoai_py-0.4.1 → geoai_py-0.4.3}/docs/usage.md +0 -0
  92. {geoai_py-0.4.1 → geoai_py-0.4.3}/docs/utils.md +0 -0
  93. {geoai_py-0.4.1 → geoai_py-0.4.3}/geoai/hf.py +0 -0
  94. {geoai_py-0.4.1 → geoai_py-0.4.3}/geoai/segment.py +0 -0
  95. {geoai_py-0.4.1 → geoai_py-0.4.3}/geoai/segmentation.py +0 -0
  96. {geoai_py-0.4.1 → geoai_py-0.4.3}/geoai_py.egg-info/dependency_links.txt +0 -0
  97. {geoai_py-0.4.1 → geoai_py-0.4.3}/geoai_py.egg-info/entry_points.txt +0 -0
  98. {geoai_py-0.4.1 → geoai_py-0.4.3}/geoai_py.egg-info/top_level.txt +0 -0
  99. {geoai_py-0.4.1 → geoai_py-0.4.3}/requirements_docs.txt +0 -0
  100. {geoai_py-0.4.1 → geoai_py-0.4.3}/setup.cfg +0 -0
  101. {geoai_py-0.4.1 → geoai_py-0.4.3}/tests/__init__.py +0 -0
  102. {geoai_py-0.4.1 → geoai_py-0.4.3}/tests/test_geoai.py +0 -0
@@ -14,6 +14,7 @@ docs/examples/*.md
14
14
  *.xml
15
15
  docs/examples/output/
16
16
  docs/examples/*.png
17
+ docs/examples/data/
17
18
  *.pth
18
19
 
19
20
  # Distribution / packaging
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.2
1
+ Metadata-Version: 2.4
2
2
  Name: geoai-py
3
- Version: 0.4.1
3
+ Version: 0.4.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
@@ -34,10 +34,12 @@ Requires-Dist: scikit-image
34
34
  Requires-Dist: scikit-learn
35
35
  Requires-Dist: torch
36
36
  Requires-Dist: torchgeo
37
+ Requires-Dist: torchinfo
37
38
  Requires-Dist: tqdm
38
39
  Requires-Dist: transformers
39
40
  Provides-Extra: extra
40
41
  Requires-Dist: overturemaps; extra == "extra"
42
+ Dynamic: license-file
41
43
 
42
44
  # GeoAI: Artificial Intelligence for Geospatial Data
43
45
 
@@ -49,6 +51,8 @@ Requires-Dist: overturemaps; extra == "extra"
49
51
  [![image](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
50
52
  [![image](https://img.shields.io/badge/YouTube-Tutorials-red)](https://bit.ly/GeoAI-Tutorials)
51
53
 
54
+ [![logo](https://raw.githubusercontent.com/opengeos/geoai/master/docs/assets/logo_rect.png)](https://github.com/opengeos/geoai/blob/master/docs/assets/logo.png)
55
+
52
56
  **A powerful Python package for integrating Artificial Intelligence with geospatial data analysis and visualization**
53
57
 
54
58
  GeoAI bridges the gap between AI and geospatial analysis, providing tools for processing, analyzing, and visualizing geospatial data using advanced machine learning techniques. Whether you're working with satellite imagery, LiDAR point clouds, or vector data, GeoAI offers intuitive interfaces to apply cutting-edge AI models.
@@ -139,7 +143,3 @@ We welcome contributions of all kinds! See our [contributing guide](https://geoa
139
143
  ## 📄 License
140
144
 
141
145
  GeoAI is free and open source software, licensed under the MIT License.
142
-
143
- ## 💖 Acknowledgment
144
-
145
- Some of the pre-trained models used in the geoai package are adapted from the [ArcGIS Living Atlas](https://livingatlas.arcgis.com/en/browse/?q=dlpk#d=2&q=dlpk). Credits to Esri for making these models available.
@@ -8,6 +8,8 @@
8
8
  [![image](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
9
9
  [![image](https://img.shields.io/badge/YouTube-Tutorials-red)](https://bit.ly/GeoAI-Tutorials)
10
10
 
11
+ [![logo](https://raw.githubusercontent.com/opengeos/geoai/master/docs/assets/logo_rect.png)](https://github.com/opengeos/geoai/blob/master/docs/assets/logo.png)
12
+
11
13
  **A powerful Python package for integrating Artificial Intelligence with geospatial data analysis and visualization**
12
14
 
13
15
  GeoAI bridges the gap between AI and geospatial analysis, providing tools for processing, analyzing, and visualizing geospatial data using advanced machine learning techniques. Whether you're working with satellite imagery, LiDAR point clouds, or vector data, GeoAI offers intuitive interfaces to apply cutting-edge AI models.
@@ -98,7 +100,3 @@ We welcome contributions of all kinds! See our [contributing guide](https://geoa
98
100
  ## 📄 License
99
101
 
100
102
  GeoAI is free and open source software, licensed under the MIT License.
101
-
102
- ## 💖 Acknowledgment
103
-
104
- Some of the pre-trained models used in the geoai package are adapted from the [ArcGIS Living Atlas](https://livingatlas.arcgis.com/en/browse/?q=dlpk#d=2&q=dlpk). Credits to Esri for making these models available.
Binary file
Binary file
Binary file
@@ -78,9 +78,7 @@
78
78
  "cell_type": "markdown",
79
79
  "metadata": {},
80
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."
81
+ "## Initialize building footprint extraction pretrained model"
84
82
  ]
85
83
  },
86
84
  {
@@ -69,7 +69,7 @@
69
69
  "metadata": {},
70
70
  "outputs": [],
71
71
  "source": [
72
- "url = \"https://open.gishub.org/data/lidar/madison.zip\"\n",
72
+ "url = \"https://opengeos.org/data/lidar/madison.zip\"\n",
73
73
  "filename = \"madison.las\""
74
74
  ]
75
75
  },
@@ -144,7 +144,7 @@
144
144
  "metadata": {},
145
145
  "outputs": [],
146
146
  "source": [
147
- "dem_url = \"https://open.gishub.org/data/raster/srtm90.tif\"\n",
147
+ "dem_url = \"https://opengeos.org/data/raster/srtm90.tif\"\n",
148
148
  "leafmap.download_file(dem_url, unzip=False)"
149
149
  ]
150
150
  },
@@ -183,7 +183,7 @@
183
183
  "metadata": {},
184
184
  "outputs": [],
185
185
  "source": [
186
- "landsat_url = \"https://open.gishub.org/data/raster/cog.tif\"\n",
186
+ "landsat_url = \"https://opengeos.org/data/raster/cog.tif\"\n",
187
187
  "leafmap.download_file(landsat_url)"
188
188
  ]
189
189
  },
@@ -62,7 +62,7 @@
62
62
  "outputs": [],
63
63
  "source": [
64
64
  "m = leafmap.Map(center=[0, 0], zoom=2)\n",
65
- "data = \"https://open.gishub.org/data/vector/cables.geojson\"\n",
65
+ "data = \"https://opengeos.org/data/vector/cables.geojson\"\n",
66
66
  "m.add_vector(data, layer_name=\"Cable lines\", info_mode=\"on_hover\")\n",
67
67
  "m"
68
68
  ]
@@ -92,7 +92,7 @@
92
92
  "source": [
93
93
  "m = leafmap.Map(center=[20, 0], zoom=2)\n",
94
94
  "m.add_basemap(\"CartoDB.DarkMatter\")\n",
95
- "data = \"https://open.gishub.org/data/vector/cables.geojson\"\n",
95
+ "data = \"https://opengeos.org/data/vector/cables.geojson\"\n",
96
96
  "callback = lambda feat: {\"color\": feat[\"properties\"][\"color\"], \"weight\": 1}\n",
97
97
  "m.add_vector(data, layer_name=\"Cable lines\", style_callback=callback)\n",
98
98
  "m"
@@ -182,7 +182,7 @@
182
182
  "metadata": {},
183
183
  "outputs": [],
184
184
  "source": [
185
- "url = \"https://open.gishub.org/data/duckdb/cities.parquet\"\n",
185
+ "url = \"https://opengeos.org/data/duckdb/cities.parquet\"\n",
186
186
  "gdf = leafmap.read_parquet(url, return_type=\"gdf\", src_crs=\"EPSG:4326\")\n",
187
187
  "gdf.head()"
188
188
  ]
@@ -0,0 +1,182 @@
1
+ {
2
+ "cells": [
3
+ {
4
+ "cell_type": "markdown",
5
+ "metadata": {},
6
+ "source": [
7
+ "# Download Sentinel-2 Data from Planetary Computer\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/download_sentinel2.ipynb)\n",
10
+ "\n",
11
+ "The notebook demonstrates how to download Sentinel-2 data from the [Planetary Computer](https://planetarycomputer.microsoft.com/explore) using the `geoai` package.\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 libraries"
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
+ "## Search data\n",
47
+ "\n",
48
+ "Go to the [Planetary Computer](https://planetarycomputer.microsoft.com/explore) and search for the data you are interested in. Copy the STAC item link and paste it to the code below."
49
+ ]
50
+ },
51
+ {
52
+ "cell_type": "code",
53
+ "execution_count": null,
54
+ "metadata": {},
55
+ "outputs": [],
56
+ "source": [
57
+ "# Example for Sentinel-2 item\n",
58
+ "item_url = \"https://planetarycomputer.microsoft.com/api/stac/v1/collections/sentinel-2-l2a/items/S2B_MSIL2A_20250228T173149_R055_T14SLH_20250228T212633\""
59
+ ]
60
+ },
61
+ {
62
+ "cell_type": "markdown",
63
+ "metadata": {},
64
+ "source": [
65
+ "## Download sample data"
66
+ ]
67
+ },
68
+ {
69
+ "cell_type": "code",
70
+ "execution_count": null,
71
+ "metadata": {},
72
+ "outputs": [],
73
+ "source": [
74
+ "# Specify which bands to download (Sentinel-2 bands)\n",
75
+ "bands_to_download = [\n",
76
+ " \"B01\",\n",
77
+ " \"B02\",\n",
78
+ " \"B03\",\n",
79
+ " \"B04\",\n",
80
+ " \"B05\",\n",
81
+ " \"B06\",\n",
82
+ " \"B07\",\n",
83
+ " \"B08\",\n",
84
+ " \"B8A\",\n",
85
+ " \"B09\",\n",
86
+ " \"B11\",\n",
87
+ " \"B12\",\n",
88
+ " \"AOT\",\n",
89
+ " \"WVP\",\n",
90
+ " \"SCL\",\n",
91
+ "]"
92
+ ]
93
+ },
94
+ {
95
+ "cell_type": "code",
96
+ "execution_count": null,
97
+ "metadata": {},
98
+ "outputs": [],
99
+ "source": [
100
+ "# Create a directory for the downloaded bands\n",
101
+ "output_directory = \"sentinel2_bands\""
102
+ ]
103
+ },
104
+ {
105
+ "cell_type": "code",
106
+ "execution_count": null,
107
+ "metadata": {},
108
+ "outputs": [],
109
+ "source": [
110
+ "# Download the bands, save them to the output directory, and create a merged GeoTIFF.\n",
111
+ "# The download process may take a while. Please be patient.\n",
112
+ "downloaded_bands = geoai.download_pc_stac_item(\n",
113
+ " item_url=item_url,\n",
114
+ " bands=bands_to_download,\n",
115
+ " output_dir=output_directory,\n",
116
+ " show_progress=True,\n",
117
+ " merge_bands=True,\n",
118
+ " merged_filename=\"sentinel2_all_bands.tif\",\n",
119
+ " overwrite=False, # Skip files that already exist\n",
120
+ " cell_size=10, # Resample all bands to 10m resolution\n",
121
+ ")"
122
+ ]
123
+ },
124
+ {
125
+ "cell_type": "code",
126
+ "execution_count": null,
127
+ "metadata": {},
128
+ "outputs": [],
129
+ "source": [
130
+ "# Print the paths to the downloaded files\n",
131
+ "for band, path in downloaded_bands.items():\n",
132
+ " print(f\"Downloaded {band}: {path}\")"
133
+ ]
134
+ },
135
+ {
136
+ "cell_type": "markdown",
137
+ "metadata": {},
138
+ "source": [
139
+ "## Visualize data"
140
+ ]
141
+ },
142
+ {
143
+ "cell_type": "code",
144
+ "execution_count": null,
145
+ "metadata": {},
146
+ "outputs": [],
147
+ "source": [
148
+ "raster_url = \"https://huggingface.co/datasets/giswqs/geospatial/resolve/main/sentinel2a_kansas.tif\""
149
+ ]
150
+ },
151
+ {
152
+ "cell_type": "code",
153
+ "execution_count": null,
154
+ "metadata": {},
155
+ "outputs": [],
156
+ "source": [
157
+ "geoai.view_raster(raster_url, bidx=[8, 4, 3], rescale=\"1000,4000\")"
158
+ ]
159
+ }
160
+ ],
161
+ "metadata": {
162
+ "kernelspec": {
163
+ "display_name": "geo",
164
+ "language": "python",
165
+ "name": "python3"
166
+ },
167
+ "language_info": {
168
+ "codemirror_mode": {
169
+ "name": "ipython",
170
+ "version": 3
171
+ },
172
+ "file_extension": ".py",
173
+ "mimetype": "text/x-python",
174
+ "name": "python",
175
+ "nbconvert_exporter": "python",
176
+ "pygments_lexer": "ipython3",
177
+ "version": "3.12.9"
178
+ }
179
+ },
180
+ "nbformat": 4,
181
+ "nbformat_minor": 2
182
+ }
@@ -0,0 +1,338 @@
1
+ {
2
+ "cells": [
3
+ {
4
+ "cell_type": "markdown",
5
+ "metadata": {},
6
+ "source": [
7
+ "# Download Data from Planetary Computer\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/planetary_computer.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
+ "## Retrieve collections"
45
+ ]
46
+ },
47
+ {
48
+ "cell_type": "code",
49
+ "execution_count": null,
50
+ "metadata": {},
51
+ "outputs": [],
52
+ "source": [
53
+ "collections = geoai.pc_collection_list()\n",
54
+ "collections"
55
+ ]
56
+ },
57
+ {
58
+ "cell_type": "markdown",
59
+ "metadata": {},
60
+ "source": [
61
+ "## Search NAIP imagery"
62
+ ]
63
+ },
64
+ {
65
+ "cell_type": "code",
66
+ "execution_count": null,
67
+ "metadata": {},
68
+ "outputs": [],
69
+ "source": [
70
+ "items = geoai.pc_stac_search(\n",
71
+ " collection=\"naip\",\n",
72
+ " bbox=[-76.6657, 39.2648, -76.6478, 39.2724], # Baltimore area\n",
73
+ " time_range=\"2013-01-01/2014-12-31\",\n",
74
+ ")"
75
+ ]
76
+ },
77
+ {
78
+ "cell_type": "code",
79
+ "execution_count": null,
80
+ "metadata": {},
81
+ "outputs": [],
82
+ "source": [
83
+ "items"
84
+ ]
85
+ },
86
+ {
87
+ "cell_type": "markdown",
88
+ "metadata": {},
89
+ "source": [
90
+ "## Visualize NAIP imagery"
91
+ ]
92
+ },
93
+ {
94
+ "cell_type": "code",
95
+ "execution_count": null,
96
+ "metadata": {},
97
+ "outputs": [],
98
+ "source": [
99
+ "geoai.pc_item_asset_list(items[0])"
100
+ ]
101
+ },
102
+ {
103
+ "cell_type": "code",
104
+ "execution_count": null,
105
+ "metadata": {},
106
+ "outputs": [],
107
+ "source": [
108
+ "geoai.view_pc_item(item=items[0])"
109
+ ]
110
+ },
111
+ {
112
+ "cell_type": "markdown",
113
+ "metadata": {},
114
+ "source": [
115
+ "## Download NAIP imagery"
116
+ ]
117
+ },
118
+ {
119
+ "cell_type": "code",
120
+ "execution_count": null,
121
+ "metadata": {},
122
+ "outputs": [],
123
+ "source": [
124
+ "downloaded = geoai.pc_stac_download(\n",
125
+ " items, output_dir=\"data\", assets=[\"image\", \"thumbnail\"]\n",
126
+ ")"
127
+ ]
128
+ },
129
+ {
130
+ "cell_type": "markdown",
131
+ "metadata": {},
132
+ "source": [
133
+ "## Search land cover data"
134
+ ]
135
+ },
136
+ {
137
+ "cell_type": "code",
138
+ "execution_count": null,
139
+ "metadata": {},
140
+ "outputs": [],
141
+ "source": [
142
+ "items = geoai.pc_stac_search(\n",
143
+ " collection=\"chesapeake-lc-13\",\n",
144
+ " bbox=[-76.6657, 39.2648, -76.6478, 39.2724], # Baltimore area\n",
145
+ " time_range=\"2013-01-01/2014-12-31\",\n",
146
+ " max_items=10,\n",
147
+ ")"
148
+ ]
149
+ },
150
+ {
151
+ "cell_type": "code",
152
+ "execution_count": null,
153
+ "metadata": {},
154
+ "outputs": [],
155
+ "source": [
156
+ "items"
157
+ ]
158
+ },
159
+ {
160
+ "cell_type": "markdown",
161
+ "metadata": {},
162
+ "source": [
163
+ "## Visualize land cover data"
164
+ ]
165
+ },
166
+ {
167
+ "cell_type": "code",
168
+ "execution_count": null,
169
+ "metadata": {},
170
+ "outputs": [],
171
+ "source": [
172
+ "geoai.pc_item_asset_list(items[0])"
173
+ ]
174
+ },
175
+ {
176
+ "cell_type": "code",
177
+ "execution_count": null,
178
+ "metadata": {},
179
+ "outputs": [],
180
+ "source": [
181
+ "geoai.view_pc_item(item=items[0], colormap_name=\"tab10\", basemap=\"SATELLITE\")"
182
+ ]
183
+ },
184
+ {
185
+ "cell_type": "markdown",
186
+ "metadata": {},
187
+ "source": [
188
+ "## Download land cover data"
189
+ ]
190
+ },
191
+ {
192
+ "cell_type": "code",
193
+ "execution_count": null,
194
+ "metadata": {},
195
+ "outputs": [],
196
+ "source": [
197
+ "geoai.pc_stac_download(items[0], output_dir=\"data\", assets=[\"data\", \"rendered_preview\"])"
198
+ ]
199
+ },
200
+ {
201
+ "cell_type": "code",
202
+ "execution_count": null,
203
+ "metadata": {},
204
+ "outputs": [],
205
+ "source": [
206
+ "ds = geoai.read_pc_item_asset(items[0], asset=\"data\")"
207
+ ]
208
+ },
209
+ {
210
+ "cell_type": "code",
211
+ "execution_count": null,
212
+ "metadata": {},
213
+ "outputs": [],
214
+ "source": [
215
+ "ds"
216
+ ]
217
+ },
218
+ {
219
+ "cell_type": "markdown",
220
+ "metadata": {},
221
+ "source": [
222
+ "## Search Landsat data"
223
+ ]
224
+ },
225
+ {
226
+ "cell_type": "code",
227
+ "execution_count": null,
228
+ "metadata": {},
229
+ "outputs": [],
230
+ "source": [
231
+ "items = geoai.pc_stac_search(\n",
232
+ " collection=\"landsat-c2-l2\",\n",
233
+ " bbox=[-76.6657, 39.2648, -76.6478, 39.2724], # Baltimore area\n",
234
+ " time_range=\"2024-10-27/2024-12-31\",\n",
235
+ " query={\"eo:cloud_cover\": {\"lt\": 1}},\n",
236
+ " max_items=10,\n",
237
+ ")"
238
+ ]
239
+ },
240
+ {
241
+ "cell_type": "code",
242
+ "execution_count": null,
243
+ "metadata": {},
244
+ "outputs": [],
245
+ "source": [
246
+ "items"
247
+ ]
248
+ },
249
+ {
250
+ "cell_type": "markdown",
251
+ "metadata": {},
252
+ "source": [
253
+ "## Visualize Landsat data"
254
+ ]
255
+ },
256
+ {
257
+ "cell_type": "code",
258
+ "execution_count": null,
259
+ "metadata": {},
260
+ "outputs": [],
261
+ "source": [
262
+ "geoai.pc_item_asset_list(items[0])"
263
+ ]
264
+ },
265
+ {
266
+ "cell_type": "code",
267
+ "execution_count": null,
268
+ "metadata": {},
269
+ "outputs": [],
270
+ "source": [
271
+ "geoai.view_pc_item(item=items[0], assets=[\"red\", \"green\", \"blue\"])"
272
+ ]
273
+ },
274
+ {
275
+ "cell_type": "code",
276
+ "execution_count": null,
277
+ "metadata": {},
278
+ "outputs": [],
279
+ "source": [
280
+ "geoai.view_pc_item(item=items[0], assets=[\"nir08\", \"red\", \"green\"])"
281
+ ]
282
+ },
283
+ {
284
+ "cell_type": "code",
285
+ "execution_count": null,
286
+ "metadata": {},
287
+ "outputs": [],
288
+ "source": [
289
+ "geoai.view_pc_item(\n",
290
+ " item=items[0],\n",
291
+ " expression=\"(nir08-red)/(nir08+red)\",\n",
292
+ " rescale=\"-1,1\",\n",
293
+ " colormap_name=\"greens\",\n",
294
+ " name=\"NDVI Green\",\n",
295
+ ")"
296
+ ]
297
+ },
298
+ {
299
+ "cell_type": "markdown",
300
+ "metadata": {},
301
+ "source": [
302
+ "## Download Landsat data"
303
+ ]
304
+ },
305
+ {
306
+ "cell_type": "code",
307
+ "execution_count": null,
308
+ "metadata": {},
309
+ "outputs": [],
310
+ "source": [
311
+ "geoai.pc_stac_download(\n",
312
+ " items[0], output_dir=\"data\", assets=[\"nir08\", \"red\", \"green\", \"blue\"]\n",
313
+ ")"
314
+ ]
315
+ }
316
+ ],
317
+ "metadata": {
318
+ "kernelspec": {
319
+ "display_name": "geo",
320
+ "language": "python",
321
+ "name": "python3"
322
+ },
323
+ "language_info": {
324
+ "codemirror_mode": {
325
+ "name": "ipython",
326
+ "version": 3
327
+ },
328
+ "file_extension": ".py",
329
+ "mimetype": "text/x-python",
330
+ "name": "python",
331
+ "nbconvert_exporter": "python",
332
+ "pygments_lexer": "ipython3",
333
+ "version": "3.12.9"
334
+ }
335
+ },
336
+ "nbformat": 4,
337
+ "nbformat_minor": 2
338
+ }