Accessing Imagery
The goal of our data access API is to allow users to seamlessly integrate Albedo satellite data with the their workflows, processes, and applications.
For the remainder of this guide, we'll use two of the assets returned in the example searches from the Searching for Imagery guide to demonstrate how to access these assets in a variety of ways:
- The
view_ready_cog
:/data/penns_landing_test/view_ready_cog/image.tif
- The
view_ready_tiles
:/data/penns_landing_test/view_ready_tiles/{z}/{x}/{y}.png
Download an Asset
To download an asset, access the asset URL directly:
https://rest-api.albedodev.com/data/penns_landing_test/view_ready_cog/image.tif
Behind-the-scenes, this URL will return a redirect to a download link. So, if using an HTTP client, be sure to allow your HTTP client to follow redirects.
Here's an example using the ubiquitous cURL client:
curl -L --request GET \
--url https://rest-api.albedodev.com/data/penns_landing_test/view_ready_cog/image.tif \
--header 'Authorization: Bearer <your bearer token>' > ~/penns_landing.tif
Beware that Albedo imagery is large, so downloads will take some time over a low-bandwidth network connection.
Stream a COG Asset
Our COG and COT assets support HTTP Range Request headers. This allows client applications to stream data from the asset as an alternative to downloading the asset in its entirety. Several geospatial imagery libraries and applications support interacting with COG assets in this way including:
- GDAL (Tutorial coming soon)
- geotiff.js (Tutorial coming soon)
Stream a Web Map Tile (XYZ) Asset
view_ready_tiles
asset for our Penn's Landing dataset is:
https://rest-api.albedodev.com/data/penns_landing_test/view_ready_tiles/{z}/{x}/{y}.png
{z}
,{x}
, and {y}
, elements should be replaced with actual - Determine the zoom level of your map. This is typically a number between 0 and 18, with higher numbers indicating a closer view of the map.
- Determine the latitude and longitude of the area you want to display on the map.
- Convert the latitude and longitude to pixel coordinates using a Mercator projection. There are many libraries and tools available that can do this for you. One such library is the OpenLayers library.
- Divide the pixel coordinates by the size of your tiles to get the tile coordinates. For example, if you're using 256x256 pixel tiles, and your pixel coordinates are (500, 700), your tile coordinates would be (1, 2) since 500/256=1.95 and 700/256=2.73, so you round to the nearest integer.
- Finally, append the zoom level to the tile coordinates to get the XYZ tile coordinates. For example, if your tile coordinates are (1, 2) and your zoom level is 5, your XYZ tile coordinates would be (5, 1, 2).
Note: Web map tile libraries and applications usually perform this function for the user. Our intent is that users can drop our templated URLs directly into those applications and the applications will do the rest.
To access a map tile directly, you can manually replace those elements with valid XYZ tile coordinates.
Updated over 1 year ago
For more information on the various formats mentioned above, please check out the following section