Find and organize satellite images for area/time of interest (tailored for Planet Labs Imagery)
planet_overlap is a scalable satellite imagery query engine for retrieving and filtering Planet Labs imagery (PSScene and SkySatScene) over large areas and long time periods.
It supports:
- ๐ฐ Imagery Types: PSScene (PlanetScope) and SkySatScene
- ๐ Multiple Areas of Interest (AOIs)
- ๐ Automatic buffering of point inputs
- ๐บ Automatic spatial tiling (in degrees)
- ๐ Flexible date range filtering
- โ Cloud cover filtering (0โ1 fraction)
- โ Sun angle filtering (degrees)
- ๐ Progress tracking
- ๐ Retry + timeout handling
- ๐ง Runtime and memory profiling
- ๐งช Automated testing (CI-enabled)
You provide:
- A geographic area (GeoJSON file)
- A date range (YYYY-MM-DD format)
- Image quality filters (cloud cover, sun angle)
- An output directory
The system:
- Connects to the Planet API with your API key
- Searches for PSScene and SkySatScene imagery
- Filters imagery by date and quality
- Automatically tiles large areas (if needed)
- Tracks progress during execution
- Logs runtime (seconds) and peak memory usage (MB)
- Saves structured results (GeoJSON and JSON files)
Clone the repository:
git clone https://github.com/your-username/planet_overlap.git
cd planet_overlapInstall locally:
pip install .There may be a need for pre-compiled wheel files to be installed for several packages (GDAL, Fiona, Shapely, pyproj, and Rtree). Downloading GDAL first will avoid dependency errors. You will need to taylor these downloads for your specific python version and architecture (ie., Python 3.14 64-bit)
python -m pip install --index https://gisidx.github.io/gwi gdal fiona shapely pyproj rtreeVerify your installation:
python -c "import geopandas; import fiona; import shapely; import pyproj; import rtree; print('All dependencies installed!')"Install GeoPandas after the wheels:
python -m pip install geopandasRationale This package uses GDAL and Fiona which arenon-python C/ C++ code libraries. Pip cannot automatically build GDALon Windows so it needs precompiled binary packages (wheels).
This tool requires a valid Planet API key to search and retrieve imagery. You can obtain an API key from the Planet Developer Portal.
Set your API key as an environment variable:
export PLANET_API_KEY=your_api_key_hereTo make this permanent, add it to your ~/.bashrc or ~/.zshrc:
echo 'export PLANET_API_KEY=your_api_key_here' >> ~/.bashrc
source ~/.bashrcsetx PLANET_API_KEY "your_api_key_here"Restart your terminal or PowerShell session to apply the changes.
To verify your API key is set correctly:
echo $PLANET_API_KEY # macOS/Linux
echo $env:PLANET_API_KEY # PowerShellRun from CLI:
planet_overlap \
--aoi-file aoi.geojson \
--start-date 2023-01-01 \
--end-date 2023-01-31 \
--output-dir ./output| Option | Description | Default |
|---|---|---|
--aoi-file |
Path to GeoJSON file containing Area of Interest | required |
--start-date |
Start date in YYYY-MM-DD format | required |
--end-date |
End date in YYYY-MM-DD format | required |
--output-dir |
Output directory for results | required |
--max-cloud |
Maximum cloud cover fraction (0.0-1.0) | 0.5 |
--min-sun-angle |
Minimum sun angle in degrees (0.0-90.0) | 0.0 |
--tile-size |
Spatial tile size in decimal degrees | 1.0 |
--point-buffer |
Buffer size for point inputs in degrees | 0.001 |
planet_overlap \
--aoi-file colorado.geojson \
--start-date 2023-01-01 \
--end-date 2023-01-31 \
--max-cloud 0.3 \
--min-sun-angle 30 \
--output-dir ./outputDates must be provided in ISO format:
YYYY-MM-DDExample:
2023-01-01The system calculates the total date span in days. If the date range exceeds 30 days, spatial tiling is automatically applied.
Cloud cover is expressed as a fraction between 0.0 and 1.0:
| Value | Meaning |
|---|---|
| 0.0 | 0% cloud cover |
| 0.5 | 50% cloud cover |
| 1.0 | 100% cloud cover |
--max-cloud 0.5Sun angle is measured in degrees (ยฐ) above the horizon. Lower values may produce long shadows.
| Sun Angle (ยฐ) | Interpretation |
|---|---|
| 0ยฐ | Sun at horizon |
| 10ยฐ | Low sun |
| 30ยฐ | Moderate sun |
| 60ยฐ+ | High sun |
--min-sun-angle 10The tool searches for the following Planet imagery types:
| Type | Description | Resolution |
|---|---|---|
| PSScene | PlanetScope imagery (3-band and 4-band) | ~3.7m per pixel |
| SkySatScene | High-resolution satellite imagery | ~0.5m per pixel |
Both imagery types are searched simultaneously and results are combined in the output.
Large AOIs are automatically divided into grid tiles. This can also occur for long date ranges and memory-sensitive runs. Tile size is specified in decimal degrees (ยฐ):
--tile-size 1.0Meaning:
- 1.0ยฐ latitude โ 111 km
- 1.0ยฐ longitude โ 111 km ร cos(latitude)
At mid-latitudes (e.g., California):
- 1ยฐ โ ~80โ111 km per side
- So a 1.0ยฐ tile is roughly: ~80โ111 km ร ~111 km
If your AOI contains:
- Point
- MultiPoint
They are automatically buffered into polygons.
Buffer size is specified in decimal degrees (ยฐ):
--point-buffer 0.0010.001ยฐ โ 111 meters (latitude direction)
The CLI generates the following files in your output directory:
| File | Description |
|---|---|
results.geojson |
GeoJSON file with filtered satellite imagery (contains geometry, timestamps, cloud cover, sun angle, etc.) |
properties.json |
JSON file with all scene properties for further analysis |
Each scene in results.geojson includes:
name: Scene IDgeometry: Scene footprint as a polygonview_angle: View angle of the sceneacquired: Acquisition timestampcloud_cover: Cloud cover fraction (0.0-1.0)sun_elevation: Sun elevation anglesun_angle: Sun angle above horizon (90ยฐ - sun_elevation)satellite_id: Satellite identifiercentral_lon/central_lat: Scene center coordinateslocal_times: Local acquisition timemax_sun_diff: Maximum sun angle difference with overlapping scenes
Each run reports:
- Total runtime (seconds)
- Peak memory usage (megabytes, MB)
- Number of spatial tiles processed
- Progress percentage
Example log:
Starting: run_pagination
Processing 138 tiles
Completed: run_pagination | Runtime: 270.41s | Peak Memory: 184.73 MBTests verify:
- Geometry handling
- Tiling behavior
- Point buffering
- Filter construction
- CLI argument parsing
- Planet API integration
Run all tests with pytest:
pytest tests/Run tests with verbose output:
pytest tests/ -vThis repository includes GitHub Actions. On every push:
- Tests are executed
- Linting is performed (automatically analyzing your code (or configuration files) for errors, stylistic issues, or potential bugs as part of a workflow)
- Failures prevent merge
Workflow file:
.github/workflows/ci.ymlREADME.md # Project documentation
pyproject.toml # Project configuration
.gitignore # Files Git should ignore
src/
โโโ planet_overlap/
โโโ __init__.py
โโโ cli.py # CLI interface and argument parsing
โโโ geometry.py # AOI loading, point detection, buffering
โโโ filters.py # Planet API filter construction
โโโ pagination.py # Spatial and temporal tiling
โโโ quality.py # Quality filtering functions
โโโ analysis.py # Analysis and processing pipeline
โโโ performance.py # Runtime and memory profiling
โโโ logger.py # Logging configuration
โโโ client.py # Planet API client and session management
โโโ io.py # File I/O operations
โโโ utils.py # Utility functions
tests/
โโโ __init__.py
โโโ test_geometry.py # Test loading AOIs, point detection, buffering, polygons
โโโ test_filters.py # Test single/multiple .geojson AOIs, date ranges, cloud/sun filters
โโโ test_analysis.py # Test overall analysis pipeline logic, derived columns
โโโ test_cli.py # Test CLI argument parsing, dynamic config, and default overrides
โโโ test_geometry.py # Test geometry operations
โโโ test_points.py # Test point handling and date tiling
โโโ test_tiling.py # Test automatic spatial and temporal tiling logic- Python โฅ 3.10
- requests
- geopandas
- shapely
- tqdm
After cloning the repository, install the package with its dependencies:
pip install .Or install dependencies manually:
pip install geopandas shapely requests tqdm