Skip to content

V-AI-S/planet-box-extractor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Planet-Box-Extractor

Tiles

Description

Python tool to extract a bounding box of a given radius around a center location (longitude, latitude) using the Planet Tiles API.

The bounding box is projected onto longitude and latitude using the World Geodetic System 1984 WGS84. The Planet Tiles API is indexed using Spherical Mercator Projection.

Images are prepared and processed as follows:

  1. Prepare URLs by filling templates from Planet Tiles API with the corresponding tiles. A bounding box may lie on 1, 2, or 4 tiles.

  2. The image data is downloaded from the URLs.

  3. If the bounding box lies on more than one tile, these tiles are stitched together to form one image.

  4. Calculate the bounds of the bounding box within the stitched image.

  5. Crop the bounding box from the stitched image.

We wrote a blog post with more details about the foundational concepts behind the API. You find it here.

Requiriments

  • PIL

  • urllib

  • mercantile

  • numpy

Setup:

git clone https://github.com/V-AI-S/planet-box-extractor.git
cd planet-box-extractor
pip install --upgrade build
pip build .
pip install .

Example Usage:

from planet_box_extractor import PlanetBoxExtractor

radius = 0.2
zoom = 15
map_id = '' # can be found in the Planet Explorer
API_KEY = '' # can be found in the user account

extractor = PlanetBoxExtractor(radius, zoom, map_id, API_KEY)
image = extractor.Process(latitude, longitude)

Documentation

Browse the API documentation here.

Licesne

MIT Licesne

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages