Preview imagery#
Get bounded previews and georeferenced windows of a catalog record. The service reads the raster; you pass only a collection and record ID.
Prerequisites#
A connected client (Use the Python client) with
services:read.A catalog record that has a raster asset (Search the catalog).
Steps#
Inspect the record to see its assets and how pixels map to the ground:
info = client.media.inspect("preview-imagery", "preview-coast-001")
REST:
GET /v1/media/records/{collection}/{record_id}/inspect.Render a preview:
preview = client.media.preview( "preview-imagery", "preview-coast-001", max_width=768, max_height=768 ) open("preview.jpg", "wb").write(preview.content)
REST:
GET .../preview?max_width=768&max_height=768. Optionalbands,stretch(percentile,minmax,none) andasset.Render a pixel window of a georeferenced record:
window = client.media.georeferenced_window( "preview-imagery", "preview-coast-001", x=0, y=0, width=512, height=512 )
REST:
GET .../georeferenced-window?x=0&y=0&width=512&height=512. The window is at most 4096 pixels on a side;output_widthandoutput_heightresample it. A record without georeferencing returns 422 (ServicesValidationError), as the local stack’s seeded PNG does.
Result#
Each call returns MediaContent with content, media_type, byte_size and a sha256 you
can check. Calls take a max_bytes limit. More calls: tile, pixel, histogram,
download and product_manifest. See Media API.