> ## Documentation Index
> Fetch the complete documentation index at: https://docs-old.tilebox.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Query open satellite data

> Query Sentinel-2 metadata by time, location, and cloud cover.

Tilebox indexes searchable metadata for public Earth observation catalogs. Use metadata queries to find relevant observations before reading or downloading their image assets.

## Prerequisites

* You have a [Tilebox API key](https://docs-old.tilebox.com/authentication.md).
* You have installed the [Python SDK](https://docs-old.tilebox.com/sdks/python/install.md).

```bash theme={"system"}
uv add tilebox shapely
```

## Select the Sentinel-2 catalog

Open the Sentinel-2 dataset and its Level-2A collection:

```python Python theme={"system"}
from tilebox.datasets import Client, field

client = Client()
sentinel2 = client.dataset("open_data.aws_earth.sentinel2")
collection = sentinel2.collection("L2A")
```

You can browse other open datasets and inspect their schemas in the [Tilebox Console](https://console.tilebox.com/datasets/open-data).

## Query observation metadata

Query by time and area of interest. The result contains metadata and asset references, but does not download image bytes.

```python Python theme={"system"}
from shapely import box

area = box(-109.05, 37.0, -102.05, 41.0)

scenes = collection.query(
    temporal_extent=("2025-10-01", "2025-11-01"),
    spatial_extent=area,
    filter=field("cloud_cover") < 10,
    show_progress=True,
)

print(scenes[["stac_id", "cloud_cover", "platform"]])
```

The result is an `xarray.Dataset`. Use regular xarray operations to sort or select observations:

```python Python theme={"system"}
latest = scenes.sortby("time").isel(time=-1)

print(latest.stac_id.item())
print(latest.cloud_cover.item())
```

## Next steps

> [card] [Create a Sentinel-2 RGB image](https://docs-old.tilebox.com/guides/datasets/access-sentinel2-data.md)
>
> Read three COG windows and combine them into an RGB image.

> [card] [Querying data](https://docs-old.tilebox.com/datasets/query/querying-data.md)
>
> Learn more dataset query patterns.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.