title | description | icon |
---|---|---|
Quickstart |
This guide will get you all set up and ready to use the Tilebox API. We'll cover how to get started using our python API clients for the data access module as well as the workflow orchestrator. |
rocket |
Check out the provided Sample Notebooks that you can use to get started with the Tilebox API. They provide a step-by-step guide to using the API and cover a wide variety of the features supported by Tilebox Python clients. You can also use the notebooks as a starting point for your own projects.
If you prefer to work locally in your device, the steps below help you get started.
Install the Tilebox python packages. The easiest way to do this is using `pip`. ``` pip install tilebox-datasets tilebox-workflows ``` Create an API key by logging into the [Tilebox Console](https://console.tilebox.com), heading to [Account -> API Keys](https://console.tilebox.com/account/api-keys) and clicking on the "Create API Key" button. <Frame>
<img src="/assets/console/api-keys-light.png" alt="Tilebox Console" className="dark:hidden" />
<img src="/assets/console/api-keys-dark.png" alt="Tilebox Console" className="hidden dark:block" />
</Frame>
</Step>
<Step title="Query data">
Use the datasets client to query data from a dataset.
```python
from tilebox.datasets import Client
client = Client(token="YOUR_TILEBOX_API_KEY")
# select a dataset
datasets = client.datasets()
dataset = datasets.open_data.copernicus.sentinel2_msi
# and load data from a collection in a given time range
collection = dataset.collection("S2A_S2MSI1C")
data_january_2022 = collection.load(("2022-01-01", "2022-02-01"))
```
</Step>
<Step title="Run a workflow task">
Use the workflows client to create and submit a task.
```python
from tilebox.workflows import Client, Task
class MyFirstTask(Task):
def execute(self):
print("Hello World from my first Tilebox task!")
client = Client(token="YOUR_TILEBOX_API_KEY")
# submit a job
jobs = client.jobs()
jobs.submit("my-very-first-job", MyFirstTask(), "some-compute-cluster")
# and run it
runner = client.runner("some-compute-cluster", tasks=[MyFirstTask])
runner.run_all()
```
<Note>
For this snippet to work you need to have a cluster already created. Check out the guide on [clusters](/workflows/concepts/clusters) to learn how to create one.
</Note>
</Step>
<Step title="Explore further">
Check out the following guides to learn more about the individual modules that make up Tilebox:
<CardGroup cols={2}>
<Card
title="Datasets Quickstart"
icon="database"
href="/datasets/introduction#quickstart"
horizontal
/>
<Card
title="Workflows Quickstart"
icon="network-wired"
href="/workflows/introduction#quickstart"
horizontal
/>
</CardGroup>
</Step>