geoai-py 0.5.5__tar.gz → 0.6.0__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.6.0/.github/workflows/docker-image.yml +16 -0
- geoai_py-0.6.0/.github/workflows/docker-publish.yml +45 -0
- {geoai_py-0.5.5 → geoai_py-0.6.0}/.github/workflows/docs-build.yml +1 -1
- {geoai_py-0.5.5 → geoai_py-0.6.0}/.github/workflows/docs.yml +1 -1
- {geoai_py-0.5.5 → geoai_py-0.6.0}/.github/workflows/macos.yml +1 -1
- {geoai_py-0.5.5 → geoai_py-0.6.0}/.github/workflows/ubuntu.yml +1 -1
- {geoai_py-0.5.5 → geoai_py-0.6.0}/.github/workflows/windows.yml +1 -1
- geoai_py-0.6.0/Dockerfile +54 -0
- {geoai_py-0.5.5 → geoai_py-0.6.0}/PKG-INFO +2 -1
- geoai_py-0.6.0/docs/examples/download_naip.ipynb +175 -0
- geoai_py-0.6.0/docs/examples/globe_projection.ipynb +300 -0
- geoai_py-0.6.0/docs/examples/samgeo.ipynb +190 -0
- geoai_py-0.6.0/docs/examples/water_dynamics.ipynb +222 -0
- geoai_py-0.6.0/docs/sam.md +3 -0
- {geoai_py-0.5.5 → geoai_py-0.6.0}/docs/workshops/GeoAI_Workshop_2025.ipynb +89 -114
- {geoai_py-0.5.5 → geoai_py-0.6.0}/geoai/__init__.py +1 -1
- {geoai_py-0.5.5 → geoai_py-0.6.0}/geoai/classify.py +23 -24
- {geoai_py-0.5.5 → geoai_py-0.6.0}/geoai/download.py +130 -0
- {geoai_py-0.5.5 → geoai_py-0.6.0}/geoai/geoai.py +4 -3
- geoai_py-0.6.0/geoai/sam.py +832 -0
- {geoai_py-0.5.5 → geoai_py-0.6.0}/geoai/utils.py +330 -1
- {geoai_py-0.5.5 → geoai_py-0.6.0}/geoai_py.egg-info/PKG-INFO +2 -1
- {geoai_py-0.5.5 → geoai_py-0.6.0}/geoai_py.egg-info/SOURCES.txt +9 -0
- {geoai_py-0.5.5 → geoai_py-0.6.0}/geoai_py.egg-info/requires.txt +1 -0
- {geoai_py-0.5.5 → geoai_py-0.6.0}/mkdocs.yml +8 -0
- {geoai_py-0.5.5 → geoai_py-0.6.0}/pyproject.toml +2 -2
- {geoai_py-0.5.5 → geoai_py-0.6.0}/requirements.txt +1 -0
- {geoai_py-0.5.5 → geoai_py-0.6.0}/.editorconfig +0 -0
- {geoai_py-0.5.5 → geoai_py-0.6.0}/.github/FUNDING.yml +0 -0
- {geoai_py-0.5.5 → geoai_py-0.6.0}/.github/ISSUE_TEMPLATE/bug_report.md +0 -0
- {geoai_py-0.5.5 → geoai_py-0.6.0}/.github/ISSUE_TEMPLATE/config.yml +0 -0
- {geoai_py-0.5.5 → geoai_py-0.6.0}/.github/ISSUE_TEMPLATE/feature_request.md +0 -0
- {geoai_py-0.5.5 → geoai_py-0.6.0}/.github/dependabot.yml +0 -0
- {geoai_py-0.5.5 → geoai_py-0.6.0}/.github/workflows/pypi.yml +0 -0
- {geoai_py-0.5.5 → geoai_py-0.6.0}/.gitignore +0 -0
- {geoai_py-0.5.5 → geoai_py-0.6.0}/.pre-commit-config.yaml +0 -0
- {geoai_py-0.5.5 → geoai_py-0.6.0}/LICENSE +0 -0
- {geoai_py-0.5.5 → geoai_py-0.6.0}/MANIFEST.in +0 -0
- {geoai_py-0.5.5 → geoai_py-0.6.0}/README.md +0 -0
- {geoai_py-0.5.5 → geoai_py-0.6.0}/docs/CNAME +0 -0
- {geoai_py-0.5.5 → geoai_py-0.6.0}/docs/assets/logo.ico +0 -0
- {geoai_py-0.5.5 → geoai_py-0.6.0}/docs/assets/logo.png +0 -0
- {geoai_py-0.5.5 → geoai_py-0.6.0}/docs/assets/logo_rect.png +0 -0
- {geoai_py-0.5.5 → geoai_py-0.6.0}/docs/changelog.md +0 -0
- {geoai_py-0.5.5 → geoai_py-0.6.0}/docs/classify.md +0 -0
- {geoai_py-0.5.5 → geoai_py-0.6.0}/docs/contributing.md +0 -0
- {geoai_py-0.5.5 → geoai_py-0.6.0}/docs/download.md +0 -0
- {geoai_py-0.5.5 → geoai_py-0.6.0}/docs/examples/_template.ipynb +0 -0
- {geoai_py-0.5.5 → geoai_py-0.6.0}/docs/examples/building_footprints_africa.ipynb +0 -0
- {geoai_py-0.5.5 → geoai_py-0.6.0}/docs/examples/building_footprints_china.ipynb +0 -0
- {geoai_py-0.5.5 → geoai_py-0.6.0}/docs/examples/building_footprints_usa.ipynb +0 -0
- {geoai_py-0.5.5 → geoai_py-0.6.0}/docs/examples/building_regularization.ipynb +0 -0
- {geoai_py-0.5.5 → geoai_py-0.6.0}/docs/examples/car_detection.ipynb +0 -0
- {geoai_py-0.5.5 → geoai_py-0.6.0}/docs/examples/create_vector.ipynb +0 -0
- {geoai_py-0.5.5 → geoai_py-0.6.0}/docs/examples/data_visualization.ipynb +0 -0
- {geoai_py-0.5.5 → geoai_py-0.6.0}/docs/examples/dataviz/lidar_viz.ipynb +0 -0
- {geoai_py-0.5.5 → geoai_py-0.6.0}/docs/examples/dataviz/raster_viz.ipynb +0 -0
- {geoai_py-0.5.5 → geoai_py-0.6.0}/docs/examples/dataviz/vector_viz.ipynb +0 -0
- {geoai_py-0.5.5 → geoai_py-0.6.0}/docs/examples/download_data.ipynb +0 -0
- {geoai_py-0.5.5 → geoai_py-0.6.0}/docs/examples/download_sentinel2.ipynb +0 -0
- {geoai_py-0.5.5 → geoai_py-0.6.0}/docs/examples/edit_vector.ipynb +0 -0
- {geoai_py-0.5.5 → geoai_py-0.6.0}/docs/examples/geometric_properties.ipynb +0 -0
- {geoai_py-0.5.5 → geoai_py-0.6.0}/docs/examples/image_chips.ipynb +0 -0
- {geoai_py-0.5.5 → geoai_py-0.6.0}/docs/examples/jupytext.toml +0 -0
- {geoai_py-0.5.5 → geoai_py-0.6.0}/docs/examples/parking_spot_detection.ipynb +0 -0
- {geoai_py-0.5.5 → geoai_py-0.6.0}/docs/examples/planetary_computer.ipynb +0 -0
- {geoai_py-0.5.5 → geoai_py-0.6.0}/docs/examples/rastervision/semantic_segmentation.ipynb +0 -0
- {geoai_py-0.5.5 → geoai_py-0.6.0}/docs/examples/regularization.ipynb +0 -0
- {geoai_py-0.5.5 → geoai_py-0.6.0}/docs/examples/samgeo/arcgis.ipynb +0 -0
- {geoai_py-0.5.5 → geoai_py-0.6.0}/docs/examples/samgeo/automatic_mask_generator.ipynb +0 -0
- {geoai_py-0.5.5 → geoai_py-0.6.0}/docs/examples/samgeo/automatic_mask_generator_hq.ipynb +0 -0
- {geoai_py-0.5.5 → geoai_py-0.6.0}/docs/examples/samgeo/box_prompts.ipynb +0 -0
- {geoai_py-0.5.5 → geoai_py-0.6.0}/docs/examples/samgeo/fast_sam.ipynb +0 -0
- {geoai_py-0.5.5 → geoai_py-0.6.0}/docs/examples/samgeo/input_prompts.ipynb +0 -0
- {geoai_py-0.5.5 → geoai_py-0.6.0}/docs/examples/samgeo/input_prompts_hq.ipynb +0 -0
- {geoai_py-0.5.5 → geoai_py-0.6.0}/docs/examples/samgeo/maxar_open_data.ipynb +0 -0
- {geoai_py-0.5.5 → geoai_py-0.6.0}/docs/examples/samgeo/satellite-predictor.ipynb +0 -0
- {geoai_py-0.5.5 → geoai_py-0.6.0}/docs/examples/samgeo/satellite.ipynb +0 -0
- {geoai_py-0.5.5 → geoai_py-0.6.0}/docs/examples/samgeo/swimming_pools.ipynb +0 -0
- {geoai_py-0.5.5 → geoai_py-0.6.0}/docs/examples/samgeo/text_prompts.ipynb +0 -0
- {geoai_py-0.5.5 → geoai_py-0.6.0}/docs/examples/samgeo/text_prompts_batch.ipynb +0 -0
- {geoai_py-0.5.5 → geoai_py-0.6.0}/docs/examples/ship_detection.ipynb +0 -0
- {geoai_py-0.5.5 → geoai_py-0.6.0}/docs/examples/solar_panel_detection.ipynb +0 -0
- {geoai_py-0.5.5 → geoai_py-0.6.0}/docs/examples/text_prompt_segmentation.ipynb +0 -0
- {geoai_py-0.5.5 → geoai_py-0.6.0}/docs/examples/train_building_footprints_usa.ipynb +0 -0
- {geoai_py-0.5.5 → geoai_py-0.6.0}/docs/examples/train_car_detection.ipynb +0 -0
- {geoai_py-0.5.5 → geoai_py-0.6.0}/docs/examples/train_object_detection_model.ipynb +0 -0
- {geoai_py-0.5.5 → geoai_py-0.6.0}/docs/examples/train_ship_detection.ipynb +0 -0
- {geoai_py-0.5.5 → geoai_py-0.6.0}/docs/examples/train_solar_panel_detection.ipynb +0 -0
- {geoai_py-0.5.5 → geoai_py-0.6.0}/docs/examples/train_water_detection.ipynb +0 -0
- {geoai_py-0.5.5 → geoai_py-0.6.0}/docs/examples/view_metadata.ipynb +0 -0
- {geoai_py-0.5.5 → geoai_py-0.6.0}/docs/examples/wetland_mapping.ipynb +0 -0
- {geoai_py-0.5.5 → geoai_py-0.6.0}/docs/extract.md +0 -0
- {geoai_py-0.5.5 → geoai_py-0.6.0}/docs/faq.md +0 -0
- {geoai_py-0.5.5 → geoai_py-0.6.0}/docs/geoai.md +0 -0
- {geoai_py-0.5.5 → geoai_py-0.6.0}/docs/hf.md +0 -0
- {geoai_py-0.5.5 → geoai_py-0.6.0}/docs/index.md +0 -0
- {geoai_py-0.5.5 → geoai_py-0.6.0}/docs/installation.md +0 -0
- {geoai_py-0.5.5 → geoai_py-0.6.0}/docs/overrides/main.html +0 -0
- {geoai_py-0.5.5 → geoai_py-0.6.0}/docs/segment.md +0 -0
- {geoai_py-0.5.5 → geoai_py-0.6.0}/docs/segmentation.md +0 -0
- {geoai_py-0.5.5 → geoai_py-0.6.0}/docs/train.md +0 -0
- {geoai_py-0.5.5 → geoai_py-0.6.0}/docs/usage.md +0 -0
- {geoai_py-0.5.5 → geoai_py-0.6.0}/docs/utils.md +0 -0
- {geoai_py-0.5.5 → geoai_py-0.6.0}/docs/workshops/jupytext.toml +0 -0
- {geoai_py-0.5.5 → geoai_py-0.6.0}/geoai/extract.py +1 -1
- {geoai_py-0.5.5 → geoai_py-0.6.0}/geoai/hf.py +0 -0
- {geoai_py-0.5.5 → geoai_py-0.6.0}/geoai/segment.py +0 -0
- {geoai_py-0.5.5 → geoai_py-0.6.0}/geoai/segmentation.py +0 -0
- {geoai_py-0.5.5 → geoai_py-0.6.0}/geoai/train.py +0 -0
- {geoai_py-0.5.5 → geoai_py-0.6.0}/geoai_py.egg-info/dependency_links.txt +0 -0
- {geoai_py-0.5.5 → geoai_py-0.6.0}/geoai_py.egg-info/entry_points.txt +0 -0
- {geoai_py-0.5.5 → geoai_py-0.6.0}/geoai_py.egg-info/top_level.txt +0 -0
- {geoai_py-0.5.5 → geoai_py-0.6.0}/requirements_docs.txt +0 -0
- {geoai_py-0.5.5 → geoai_py-0.6.0}/setup.cfg +0 -0
- {geoai_py-0.5.5 → geoai_py-0.6.0}/tests/__init__.py +0 -0
- {geoai_py-0.5.5 → geoai_py-0.6.0}/tests/test_geoai.py +0 -0
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
name: Docker Image CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: ["main"]
|
|
6
|
+
pull_request:
|
|
7
|
+
branches: ["main"]
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
build:
|
|
11
|
+
runs-on: ubuntu-latest
|
|
12
|
+
|
|
13
|
+
steps:
|
|
14
|
+
- uses: actions/checkout@v4
|
|
15
|
+
- name: Build the Docker image
|
|
16
|
+
run: docker build . --file Dockerfile --tag ${{ github.repository }}:$(date +%s)
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
name: Publish Docker image
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
release:
|
|
5
|
+
types: [published]
|
|
6
|
+
|
|
7
|
+
jobs:
|
|
8
|
+
push_to_registries:
|
|
9
|
+
name: Push Docker image to multiple registries
|
|
10
|
+
runs-on: ubuntu-latest
|
|
11
|
+
permissions:
|
|
12
|
+
packages: write
|
|
13
|
+
contents: read
|
|
14
|
+
steps:
|
|
15
|
+
- name: Check out the repo
|
|
16
|
+
uses: actions/checkout@v4
|
|
17
|
+
|
|
18
|
+
- name: Log in to Docker Hub
|
|
19
|
+
uses: docker/login-action@v3
|
|
20
|
+
with:
|
|
21
|
+
username: ${{ secrets.DOCKER_USERNAME }}
|
|
22
|
+
password: ${{ secrets.DOCKER_PASSWORD }}
|
|
23
|
+
|
|
24
|
+
- name: Log in to the Container registry
|
|
25
|
+
uses: docker/login-action@v3
|
|
26
|
+
with:
|
|
27
|
+
registry: ghcr.io
|
|
28
|
+
username: ${{ github.actor }}
|
|
29
|
+
password: ${{ secrets.GITHUB_TOKEN }}
|
|
30
|
+
|
|
31
|
+
- name: Extract metadata (tags, labels) for Docker
|
|
32
|
+
id: meta
|
|
33
|
+
uses: docker/metadata-action@v5
|
|
34
|
+
with:
|
|
35
|
+
images: |
|
|
36
|
+
giswqs/geoai
|
|
37
|
+
ghcr.io/${{ github.repository }}
|
|
38
|
+
|
|
39
|
+
- name: Build and push Docker images
|
|
40
|
+
uses: docker/build-push-action@v6
|
|
41
|
+
with:
|
|
42
|
+
context: .
|
|
43
|
+
push: true
|
|
44
|
+
tags: ${{ steps.meta.outputs.tags }}
|
|
45
|
+
labels: ${{ steps.meta.outputs.labels }}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
FROM quay.io/jupyter/base-notebook:latest
|
|
2
|
+
|
|
3
|
+
# -------------------------------------------------------
|
|
4
|
+
# 1. Install system-level packages (minimal, just git)
|
|
5
|
+
# -------------------------------------------------------
|
|
6
|
+
USER root
|
|
7
|
+
RUN apt-get update && \
|
|
8
|
+
apt-get install -y git && \
|
|
9
|
+
rm -rf /var/lib/apt/lists/*
|
|
10
|
+
|
|
11
|
+
# -------------------------------------------------------
|
|
12
|
+
# 2. Install geospatial Python packages via conda (base env)
|
|
13
|
+
# -------------------------------------------------------
|
|
14
|
+
RUN mamba install -n base -c conda-forge \
|
|
15
|
+
geoai \
|
|
16
|
+
overturemaps -y && \
|
|
17
|
+
fix-permissions "${CONDA_DIR}"
|
|
18
|
+
|
|
19
|
+
# -------------------------------------------------------
|
|
20
|
+
# 3. Environment variables
|
|
21
|
+
# -------------------------------------------------------
|
|
22
|
+
ENV PROJ_LIB=/opt/conda/share/proj
|
|
23
|
+
ENV GDAL_DATA=/opt/conda/share/gdal
|
|
24
|
+
ENV LOCALTILESERVER_CLIENT_PREFIX='proxy/{port}'
|
|
25
|
+
|
|
26
|
+
# -------------------------------------------------------
|
|
27
|
+
# 4. Copy source code (do this *after* package installs to improve caching)
|
|
28
|
+
# -------------------------------------------------------
|
|
29
|
+
COPY . /home/jovyan/geoai
|
|
30
|
+
WORKDIR /home/jovyan/geoai
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
# -------------------------------------------------------
|
|
34
|
+
# 5. Build and install geoai from source
|
|
35
|
+
# -------------------------------------------------------
|
|
36
|
+
# Prevent setuptools_scm issues if .git is missing
|
|
37
|
+
ENV SETUPTOOLS_SCM_PRETEND_VERSION_FOR_GEOAI=0.0.0
|
|
38
|
+
|
|
39
|
+
RUN rm -rf /home/jovyan/geoai/geoai.egg-info && \
|
|
40
|
+
pip install . && \
|
|
41
|
+
mkdir -p /home/jovyan/work && \
|
|
42
|
+
fix-permissions /home/jovyan
|
|
43
|
+
|
|
44
|
+
# -------------------------------------------------------
|
|
45
|
+
# 6. Set back to default user
|
|
46
|
+
# -------------------------------------------------------
|
|
47
|
+
WORKDIR /home/jovyan
|
|
48
|
+
USER jovyan
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
# -------------------------------------------------------
|
|
52
|
+
# 7. Run the docker container
|
|
53
|
+
# -------------------------------------------------------
|
|
54
|
+
# docker run -it -p 8888:8888 -v $(pwd):/home/jovyan/work giswqs/geoai:latest
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: geoai-py
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.6.0
|
|
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
|
|
@@ -26,6 +26,7 @@ Requires-Dist: leafmap
|
|
|
26
26
|
Requires-Dist: localtileserver
|
|
27
27
|
Requires-Dist: mapclassify
|
|
28
28
|
Requires-Dist: maplibre
|
|
29
|
+
Requires-Dist: opencv-python-headless
|
|
29
30
|
Requires-Dist: overturemaps
|
|
30
31
|
Requires-Dist: planetary-computer
|
|
31
32
|
Requires-Dist: pystac-client
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
{
|
|
2
|
+
"cells": [
|
|
3
|
+
{
|
|
4
|
+
"cell_type": "markdown",
|
|
5
|
+
"id": "0",
|
|
6
|
+
"metadata": {},
|
|
7
|
+
"source": [
|
|
8
|
+
"# Download NAIP Imagery\n",
|
|
9
|
+
"\n",
|
|
10
|
+
"[](https://colab.research.google.com/github/opengeos/geoai/blob/main/docs/examples/download_naip.ipynb)\n",
|
|
11
|
+
"\n",
|
|
12
|
+
"## Install package\n",
|
|
13
|
+
"\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
|
+
"id": "1",
|
|
21
|
+
"metadata": {},
|
|
22
|
+
"outputs": [],
|
|
23
|
+
"source": [
|
|
24
|
+
"# %pip install geoai-py"
|
|
25
|
+
]
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
"cell_type": "markdown",
|
|
29
|
+
"id": "2",
|
|
30
|
+
"metadata": {},
|
|
31
|
+
"source": [
|
|
32
|
+
"## Import library"
|
|
33
|
+
]
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
"cell_type": "code",
|
|
37
|
+
"execution_count": null,
|
|
38
|
+
"id": "3",
|
|
39
|
+
"metadata": {},
|
|
40
|
+
"outputs": [],
|
|
41
|
+
"source": [
|
|
42
|
+
"import geoai"
|
|
43
|
+
]
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
"cell_type": "markdown",
|
|
47
|
+
"id": "4",
|
|
48
|
+
"metadata": {},
|
|
49
|
+
"source": [
|
|
50
|
+
"## Create an interactive map"
|
|
51
|
+
]
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
"cell_type": "code",
|
|
55
|
+
"execution_count": null,
|
|
56
|
+
"id": "5",
|
|
57
|
+
"metadata": {},
|
|
58
|
+
"outputs": [],
|
|
59
|
+
"source": [
|
|
60
|
+
"m = geoai.Map(center=[47.031260, -99.156360], zoom=14)\n",
|
|
61
|
+
"m.add_basemap(\"Esri.WorldImagery\")\n",
|
|
62
|
+
"m"
|
|
63
|
+
]
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
"cell_type": "markdown",
|
|
67
|
+
"id": "6",
|
|
68
|
+
"metadata": {},
|
|
69
|
+
"source": [
|
|
70
|
+
"Use the drawing tool to select an area of interest (AOI) on the map. The selected area will be used to search for NAIP imagery."
|
|
71
|
+
]
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
"cell_type": "code",
|
|
75
|
+
"execution_count": null,
|
|
76
|
+
"id": "7",
|
|
77
|
+
"metadata": {},
|
|
78
|
+
"outputs": [],
|
|
79
|
+
"source": [
|
|
80
|
+
"if m.user_roi is not None:\n",
|
|
81
|
+
" bbox = m.user_roi_bounds()\n",
|
|
82
|
+
"else:\n",
|
|
83
|
+
" bbox = [-99.1705, 47.0149, -99.1296, 47.0365]"
|
|
84
|
+
]
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
"cell_type": "markdown",
|
|
88
|
+
"id": "8",
|
|
89
|
+
"metadata": {},
|
|
90
|
+
"source": [
|
|
91
|
+
"## Search for NAIP imagery"
|
|
92
|
+
]
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
"cell_type": "code",
|
|
96
|
+
"execution_count": null,
|
|
97
|
+
"id": "9",
|
|
98
|
+
"metadata": {},
|
|
99
|
+
"outputs": [],
|
|
100
|
+
"source": [
|
|
101
|
+
"items = geoai.pc_stac_search(\n",
|
|
102
|
+
" collection=\"naip\",\n",
|
|
103
|
+
" bbox=bbox,\n",
|
|
104
|
+
")"
|
|
105
|
+
]
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
"cell_type": "code",
|
|
109
|
+
"execution_count": null,
|
|
110
|
+
"id": "10",
|
|
111
|
+
"metadata": {},
|
|
112
|
+
"outputs": [],
|
|
113
|
+
"source": [
|
|
114
|
+
"items"
|
|
115
|
+
]
|
|
116
|
+
},
|
|
117
|
+
{
|
|
118
|
+
"cell_type": "markdown",
|
|
119
|
+
"id": "11",
|
|
120
|
+
"metadata": {},
|
|
121
|
+
"source": [
|
|
122
|
+
"## Visualize the search results"
|
|
123
|
+
]
|
|
124
|
+
},
|
|
125
|
+
{
|
|
126
|
+
"cell_type": "code",
|
|
127
|
+
"execution_count": null,
|
|
128
|
+
"id": "12",
|
|
129
|
+
"metadata": {},
|
|
130
|
+
"outputs": [],
|
|
131
|
+
"source": [
|
|
132
|
+
"geoai.view_pc_items(items=items)"
|
|
133
|
+
]
|
|
134
|
+
},
|
|
135
|
+
{
|
|
136
|
+
"cell_type": "markdown",
|
|
137
|
+
"id": "13",
|
|
138
|
+
"metadata": {},
|
|
139
|
+
"source": [
|
|
140
|
+
"## Download NAIP imagery"
|
|
141
|
+
]
|
|
142
|
+
},
|
|
143
|
+
{
|
|
144
|
+
"cell_type": "code",
|
|
145
|
+
"execution_count": null,
|
|
146
|
+
"id": "14",
|
|
147
|
+
"metadata": {},
|
|
148
|
+
"outputs": [],
|
|
149
|
+
"source": [
|
|
150
|
+
"geoai.pc_stac_download(items, output_dir=\"naip\", assets=[\"image\"])"
|
|
151
|
+
]
|
|
152
|
+
}
|
|
153
|
+
],
|
|
154
|
+
"metadata": {
|
|
155
|
+
"kernelspec": {
|
|
156
|
+
"display_name": "geo",
|
|
157
|
+
"language": "python",
|
|
158
|
+
"name": "python3"
|
|
159
|
+
},
|
|
160
|
+
"language_info": {
|
|
161
|
+
"codemirror_mode": {
|
|
162
|
+
"name": "ipython",
|
|
163
|
+
"version": 3
|
|
164
|
+
},
|
|
165
|
+
"file_extension": ".py",
|
|
166
|
+
"mimetype": "text/x-python",
|
|
167
|
+
"name": "python",
|
|
168
|
+
"nbconvert_exporter": "python",
|
|
169
|
+
"pygments_lexer": "ipython3",
|
|
170
|
+
"version": "3.12.2"
|
|
171
|
+
}
|
|
172
|
+
},
|
|
173
|
+
"nbformat": 4,
|
|
174
|
+
"nbformat_minor": 5
|
|
175
|
+
}
|
|
@@ -0,0 +1,300 @@
|
|
|
1
|
+
{
|
|
2
|
+
"cells": [
|
|
3
|
+
{
|
|
4
|
+
"cell_type": "markdown",
|
|
5
|
+
"metadata": {},
|
|
6
|
+
"source": [
|
|
7
|
+
"[](https://colab.research.google.com/github/opengeos/geoai/blob/main/docs/maplibre/globe_projection.ipynb)\n",
|
|
8
|
+
"\n",
|
|
9
|
+
"**Visualize geospatial data on a 3D globe**\n",
|
|
10
|
+
"\n",
|
|
11
|
+
"Uncomment the following line to install geoai if needed."
|
|
12
|
+
]
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
"cell_type": "code",
|
|
16
|
+
"execution_count": null,
|
|
17
|
+
"metadata": {},
|
|
18
|
+
"outputs": [],
|
|
19
|
+
"source": [
|
|
20
|
+
"# %pip install geoai-py"
|
|
21
|
+
]
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
"cell_type": "markdown",
|
|
25
|
+
"metadata": {},
|
|
26
|
+
"source": [
|
|
27
|
+
"## Import library"
|
|
28
|
+
]
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
"cell_type": "code",
|
|
32
|
+
"execution_count": null,
|
|
33
|
+
"metadata": {},
|
|
34
|
+
"outputs": [],
|
|
35
|
+
"source": [
|
|
36
|
+
"import geoai"
|
|
37
|
+
]
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
"cell_type": "markdown",
|
|
41
|
+
"metadata": {},
|
|
42
|
+
"source": [
|
|
43
|
+
"## Add globe control"
|
|
44
|
+
]
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
"cell_type": "code",
|
|
48
|
+
"execution_count": null,
|
|
49
|
+
"metadata": {},
|
|
50
|
+
"outputs": [],
|
|
51
|
+
"source": [
|
|
52
|
+
"m = geoai.MapLibre(center=[-100, 40], zoom=3, style=\"liberty\")\n",
|
|
53
|
+
"m.add_globe_control()\n",
|
|
54
|
+
"m"
|
|
55
|
+
]
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
"cell_type": "markdown",
|
|
59
|
+
"metadata": {},
|
|
60
|
+
"source": [
|
|
61
|
+
""
|
|
62
|
+
]
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
"cell_type": "markdown",
|
|
66
|
+
"metadata": {},
|
|
67
|
+
"source": [
|
|
68
|
+
"## Use globe projection"
|
|
69
|
+
]
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
"cell_type": "code",
|
|
73
|
+
"execution_count": null,
|
|
74
|
+
"metadata": {},
|
|
75
|
+
"outputs": [],
|
|
76
|
+
"source": [
|
|
77
|
+
"m = geoai.MapLibre(center=[-100, 40], zoom=3, style=\"positron\", projection=\"globe\")\n",
|
|
78
|
+
"m.add_basemap(\"Esri.WorldImagery\")\n",
|
|
79
|
+
"m.add_overture_3d_buildings()\n",
|
|
80
|
+
"m"
|
|
81
|
+
]
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
"cell_type": "markdown",
|
|
85
|
+
"metadata": {},
|
|
86
|
+
"source": [
|
|
87
|
+
""
|
|
88
|
+
]
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
"cell_type": "markdown",
|
|
92
|
+
"metadata": {},
|
|
93
|
+
"source": [
|
|
94
|
+
"## Create 3D choropleth maps"
|
|
95
|
+
]
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
"cell_type": "code",
|
|
99
|
+
"execution_count": null,
|
|
100
|
+
"metadata": {},
|
|
101
|
+
"outputs": [],
|
|
102
|
+
"source": [
|
|
103
|
+
"m = geoai.MapLibre(\n",
|
|
104
|
+
" center=[19.43, 49.49], zoom=3, pitch=60, style=\"positron\", projection=\"globe\"\n",
|
|
105
|
+
")\n",
|
|
106
|
+
"source = {\n",
|
|
107
|
+
" \"type\": \"geojson\",\n",
|
|
108
|
+
" \"data\": \"https://docs.maptiler.com/sdk-js/assets/Mean_age_of_women_at_first_marriage_in_2019.geojson\",\n",
|
|
109
|
+
"}\n",
|
|
110
|
+
"m.add_source(\"countries\", source)\n",
|
|
111
|
+
"layer = {\n",
|
|
112
|
+
" \"id\": \"eu-countries\",\n",
|
|
113
|
+
" \"source\": \"countries\",\n",
|
|
114
|
+
" \"type\": \"fill-extrusion\",\n",
|
|
115
|
+
" \"paint\": {\n",
|
|
116
|
+
" \"fill-extrusion-color\": [\n",
|
|
117
|
+
" \"interpolate\",\n",
|
|
118
|
+
" [\"linear\"],\n",
|
|
119
|
+
" [\"get\", \"age\"],\n",
|
|
120
|
+
" 23.0,\n",
|
|
121
|
+
" \"#fff5eb\",\n",
|
|
122
|
+
" 24.0,\n",
|
|
123
|
+
" \"#fee6ce\",\n",
|
|
124
|
+
" 25.0,\n",
|
|
125
|
+
" \"#fdd0a2\",\n",
|
|
126
|
+
" 26.0,\n",
|
|
127
|
+
" \"#fdae6b\",\n",
|
|
128
|
+
" 27.0,\n",
|
|
129
|
+
" \"#fd8d3c\",\n",
|
|
130
|
+
" 28.0,\n",
|
|
131
|
+
" \"#f16913\",\n",
|
|
132
|
+
" 29.0,\n",
|
|
133
|
+
" \"#d94801\",\n",
|
|
134
|
+
" 30.0,\n",
|
|
135
|
+
" \"#8c2d04\",\n",
|
|
136
|
+
" ],\n",
|
|
137
|
+
" \"fill-extrusion-opacity\": 1,\n",
|
|
138
|
+
" \"fill-extrusion-height\": [\"*\", [\"get\", \"age\"], 5000],\n",
|
|
139
|
+
" },\n",
|
|
140
|
+
"}\n",
|
|
141
|
+
"first_symbol_layer_id = m.find_first_symbol_layer()[\"id\"]\n",
|
|
142
|
+
"m.add_layer(layer, first_symbol_layer_id)\n",
|
|
143
|
+
"m.add_layer_control()\n",
|
|
144
|
+
"m"
|
|
145
|
+
]
|
|
146
|
+
},
|
|
147
|
+
{
|
|
148
|
+
"cell_type": "code",
|
|
149
|
+
"execution_count": null,
|
|
150
|
+
"metadata": {},
|
|
151
|
+
"outputs": [],
|
|
152
|
+
"source": [
|
|
153
|
+
"data = \"https://github.com/opengeos/datasets/releases/download/vector/countries.geojson\""
|
|
154
|
+
]
|
|
155
|
+
},
|
|
156
|
+
{
|
|
157
|
+
"cell_type": "code",
|
|
158
|
+
"execution_count": null,
|
|
159
|
+
"metadata": {},
|
|
160
|
+
"outputs": [],
|
|
161
|
+
"source": [
|
|
162
|
+
"m = geoai.MapLibre(style=\"liberty\", projection=\"globe\")\n",
|
|
163
|
+
"first_symbol_id = m.find_first_symbol_layer()[\"id\"]\n",
|
|
164
|
+
"m.add_data(\n",
|
|
165
|
+
" data,\n",
|
|
166
|
+
" column=\"POP_EST\",\n",
|
|
167
|
+
" scheme=\"Quantiles\",\n",
|
|
168
|
+
" cmap=\"Blues\",\n",
|
|
169
|
+
" legend_title=\"Population\",\n",
|
|
170
|
+
" name=\"Population\",\n",
|
|
171
|
+
" before_id=first_symbol_id,\n",
|
|
172
|
+
" extrude=True,\n",
|
|
173
|
+
" scale_factor=1000,\n",
|
|
174
|
+
")\n",
|
|
175
|
+
"m.add_layer_control()\n",
|
|
176
|
+
"m"
|
|
177
|
+
]
|
|
178
|
+
},
|
|
179
|
+
{
|
|
180
|
+
"cell_type": "markdown",
|
|
181
|
+
"metadata": {},
|
|
182
|
+
"source": [
|
|
183
|
+
""
|
|
184
|
+
]
|
|
185
|
+
},
|
|
186
|
+
{
|
|
187
|
+
"cell_type": "markdown",
|
|
188
|
+
"metadata": {},
|
|
189
|
+
"source": [
|
|
190
|
+
"## Vector data"
|
|
191
|
+
]
|
|
192
|
+
},
|
|
193
|
+
{
|
|
194
|
+
"cell_type": "code",
|
|
195
|
+
"execution_count": null,
|
|
196
|
+
"metadata": {},
|
|
197
|
+
"outputs": [],
|
|
198
|
+
"source": [
|
|
199
|
+
"m = geoai.MapLibre(style=\"liberty\", projection=\"globe\")\n",
|
|
200
|
+
"train_raster_url = (\n",
|
|
201
|
+
" \"https://huggingface.co/datasets/giswqs/geospatial/resolve/main/naip_rgb_train.tif\"\n",
|
|
202
|
+
")\n",
|
|
203
|
+
"train_vector_url = \"https://huggingface.co/datasets/giswqs/geospatial/resolve/main/naip_train_buildings.geojson\"\n",
|
|
204
|
+
"m.add_cog_layer(train_raster_url, name=\"NAIP\")\n",
|
|
205
|
+
"paint = {\"fill-color\": \"#ff0000\", \"fill-opacity\": 0.4, \"fill-outline-color\": \"#ffff00\"}\n",
|
|
206
|
+
"m.add_geojson(train_vector_url, name=\"Buildings\", layer_type=\"fill\", paint=paint)\n",
|
|
207
|
+
"m.add_layer_control()\n",
|
|
208
|
+
"m"
|
|
209
|
+
]
|
|
210
|
+
},
|
|
211
|
+
{
|
|
212
|
+
"cell_type": "markdown",
|
|
213
|
+
"metadata": {},
|
|
214
|
+
"source": [
|
|
215
|
+
"## Planetary Computer"
|
|
216
|
+
]
|
|
217
|
+
},
|
|
218
|
+
{
|
|
219
|
+
"cell_type": "code",
|
|
220
|
+
"execution_count": null,
|
|
221
|
+
"metadata": {},
|
|
222
|
+
"outputs": [],
|
|
223
|
+
"source": [
|
|
224
|
+
"collection = \"landsat-8-c2-l2\"\n",
|
|
225
|
+
"item = \"LC08_L2SP_047027_20201204_02_T1\""
|
|
226
|
+
]
|
|
227
|
+
},
|
|
228
|
+
{
|
|
229
|
+
"cell_type": "code",
|
|
230
|
+
"execution_count": null,
|
|
231
|
+
"metadata": {},
|
|
232
|
+
"outputs": [],
|
|
233
|
+
"source": [
|
|
234
|
+
"m = geoai.MapLibre(projection=\"globe\")\n",
|
|
235
|
+
"m.add_stac_layer(\n",
|
|
236
|
+
" collection=collection, item=item, assets=\"SR_B7,SR_B5,SR_B4\", name=\"False color\"\n",
|
|
237
|
+
")\n",
|
|
238
|
+
"m"
|
|
239
|
+
]
|
|
240
|
+
},
|
|
241
|
+
{
|
|
242
|
+
"cell_type": "code",
|
|
243
|
+
"execution_count": null,
|
|
244
|
+
"metadata": {},
|
|
245
|
+
"outputs": [],
|
|
246
|
+
"source": [
|
|
247
|
+
"m = geoai.MapLibre(projection=\"globe\")\n",
|
|
248
|
+
"m.add_stac_layer(\n",
|
|
249
|
+
" collection=collection,\n",
|
|
250
|
+
" item=item,\n",
|
|
251
|
+
" assets=[\"SR_B5\", \"SR_B4\", \"SR_B3\"],\n",
|
|
252
|
+
" name=\"Color infrared\",\n",
|
|
253
|
+
")\n",
|
|
254
|
+
"m"
|
|
255
|
+
]
|
|
256
|
+
},
|
|
257
|
+
{
|
|
258
|
+
"cell_type": "code",
|
|
259
|
+
"execution_count": null,
|
|
260
|
+
"metadata": {},
|
|
261
|
+
"outputs": [],
|
|
262
|
+
"source": [
|
|
263
|
+
"m = geoai.MapLibre(projection=\"globe\")\n",
|
|
264
|
+
"m.add_stac_layer(\n",
|
|
265
|
+
" collection=collection, item=item, assets=\"SR_B5,SR_B4,SR_B3\", name=\"Color infrared\"\n",
|
|
266
|
+
")\n",
|
|
267
|
+
"m.add_stac_layer(\n",
|
|
268
|
+
" collection=collection,\n",
|
|
269
|
+
" item=item,\n",
|
|
270
|
+
" expression=\"(SR_B5-SR_B4)/(SR_B5+SR_B4)\",\n",
|
|
271
|
+
" rescale=\"-1,1\",\n",
|
|
272
|
+
" colormap_name=\"greens\",\n",
|
|
273
|
+
" name=\"NDVI Green\",\n",
|
|
274
|
+
")\n",
|
|
275
|
+
"m"
|
|
276
|
+
]
|
|
277
|
+
}
|
|
278
|
+
],
|
|
279
|
+
"metadata": {
|
|
280
|
+
"kernelspec": {
|
|
281
|
+
"display_name": "Python 3 (ipykernel)",
|
|
282
|
+
"language": "python",
|
|
283
|
+
"name": "python3"
|
|
284
|
+
},
|
|
285
|
+
"language_info": {
|
|
286
|
+
"codemirror_mode": {
|
|
287
|
+
"name": "ipython",
|
|
288
|
+
"version": 3
|
|
289
|
+
},
|
|
290
|
+
"file_extension": ".py",
|
|
291
|
+
"mimetype": "text/x-python",
|
|
292
|
+
"name": "python",
|
|
293
|
+
"nbconvert_exporter": "python",
|
|
294
|
+
"pygments_lexer": "ipython3",
|
|
295
|
+
"version": "3.12.2"
|
|
296
|
+
}
|
|
297
|
+
},
|
|
298
|
+
"nbformat": 4,
|
|
299
|
+
"nbformat_minor": 4
|
|
300
|
+
}
|