stacmap
Create interactive maps of STAC items and collections without the heavy dependencies and boilerplate of geopandas.GeoDataFrame.explore.
Features
- 🗺️ Explore STAC item footprints
- 🌈 Color-code items by properties
- 🖼️ Preview item thumbnails
- 🪶 Lightweight dependencies (just
foliumandpystac)
Installation
$ pip install stacmap
Quickstart
stacmap.explore creates an interactive Folium map from STAC items or collections.
import stacmap
from pystac_client import Client
# Find Landsat Collection 2 scenes over an area of interest
catalog = Client.open("https://landsatlook.usgs.gov/stac-server")
items = catalog.search(
bbox=[-120.9519, 37.2455, -113.4812, 45.1025],
collections=["landsat-c2l2-srby"],
datetime="2019-08-01/2019-08-03"
).get_all_items()
# Plot the items on an interactive map, color-coded by cloud cover
stacmap.explore(items, prop="eo:cloud_cover")
Check out the docs for details or try out an interactive notebook in Binder.
Compared to GeoPandas
Let's look at a simple example to see how stacmap simplifies plotting a STAC collection and search bounds over geopandas.
First, we'll load our STAC items:
from pystac_client import Client
catalog = pystac_client.Client.open("https://planetarycomputer.microsoft.com/api/stac/v1")
bbox = (-67.008753, -9.96445, -65.615556, -8.57408)
items = catalog.search(
collections=["sentinel-2-l2a"],
bbox=bbox,
datetime="2019-06-01/2019-06-10"
).get_all_items()
Now we'll create an interactive map that shows our items and our bounding box.
| stacmap | geopandas |
|---|---|
!pip install stacmap
import stacmap
stacmap.explore(
items,
prop="eo:cloud_cover",
bbox=bbox
)
|
!pip install geopandas folium mapclassify matplotlib
import geopandas as gpd
import shapely
import folium
gdf = gpd.GeoDataFrame.from_features(
items.to_dict(),
crs="EPSG:4326"
)
bbox_geom = shapely.geometry.mapping(shapely.geometry.box(*bbox))
bbox_layer = folium.GeoJson(bbox_geom)
m = gdf.explore(column="eo:cloud_cover")
bbox_layer.add_to(m)
m
|
Users coming from geopandas can check out the transition guide for tips on switching to the stacmap API.
Metadata
Release files for stacmap 0.0.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| stacmap-0.0.4.tar.gz | 12.5 kB | Without provenance | Details for stacmap-0.0.4.tar.gz |
Release files / stacmap-0.0.4.tar.gz
| Download URL | stacmap-0.0.4.tar.gz |
|---|---|
| Size | 12.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
3a4fa294c9309761f13c1e889351facfb3aa2d88b92208378cfe923ed9b2b761
|
|
BLAKE2b-256 checksum How to use checksums |
f6747df46375d67118be7675f670a3a6e8cf725210829db7cb152c1f2aeee0aa
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.0 CPython/3.9.12
|
Security for stacmap 0.0.4
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.