Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Maxar 'Browse Image' Documentation #40

Open
Jack-Hayes opened this issue Jan 3, 2025 · 1 comment
Open

Maxar 'Browse Image' Documentation #40

Jack-Hayes opened this issue Jan 3, 2025 · 1 comment
Assignees
Labels
documentation Improvements or additions to documentation

Comments

@Jack-Hayes
Copy link
Member

Jack-Hayes commented Jan 3, 2025

For now, Maxar ordering relies on clunky G-EGD platform. Providing users with a 'browse' for an input Maxar GeoDataFrame returned from coincident.search will be useful. You can call a GET request to do so if you have the image id via f"https://api.maxar.com/browse-archive/v1/browse/show?image_id={image_id}". The browse TIFs are also accessible. Their API endpoint converts these tifs to JPGs w/o georeferencing on their server... But you can just access the tifs directly as seen below:

%matplotlib inline
import xarray as xr
import rasterio
import numpy as np
import os 

env = rasterio.Env(
    GDAL_DISABLE_READDIR_ON_OPEN="EMPTY_DIR",
    GDAL_HTTP_HEADERS=f'MAXAR-API-KEY:{os.environ["MAXAR_API_KEY"]}'
)

href = 'https://api.maxar.com/discovery/v1/catalogs/imagery/collections/wv01/items/102001008EC5AC00/assets/collections/dg-archive/assets/browse/102001008EC5AC00.browse.tif'

with env:
    da = xr.open_dataarray(href, engine='rasterio', 
                           mask_and_scale=False, # otherwise uint8 -> float32!
                           backend_kwargs=dict(open_kwargs={'overview_level':1})
    )
da

We can also pull inspiration ASP plot and loop in Ben Purinton down the line for more-detailed stereo report on any user-input stereo data hopefully

@Jack-Hayes Jack-Hayes added the enhancement New feature or request label Jan 3, 2025
@Jack-Hayes Jack-Hayes moved this to Todo in Coincident v1.0 Jan 3, 2025
@scottyhq
Copy link
Member

scottyhq commented Jan 3, 2025

@Jack-Hayes there is already a function for this in the codebase here

def open_maxar_browse(item: pystac.Item, overview_level: int = 0) -> xr.DataArray:

as seen in this notebook.

Let's try to avoid links to private content when possible.

...But looks like the function is from the docs! The API page could certainly be made easier to navigate, and it might be worth adding a series of example jupyter notebooks per-dataset since that is often more interesting to people than API docs :) https://coincident.readthedocs.io/en/latest/api.html

@Jack-Hayes Jack-Hayes changed the title Maxar Show 'Browse Image' Maxar 'Browse Image' Documentation Jan 3, 2025
@Jack-Hayes Jack-Hayes self-assigned this Jan 3, 2025
@Jack-Hayes Jack-Hayes added documentation Improvements or additions to documentation and removed enhancement New feature or request labels Jan 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
Status: Todo
Development

No branches or pull requests

2 participants