WorldView Data Import Examples
The examples below include both simple and native search so you can compare their interfaces, though both would not normally be used in the same workflow. The same applies for the order products and order using query examples. To execute the requests, create an OAuth client as explained in the authentication documentation. It is named oauth in these examples.
Get Your Quota
url = "https://services.sentinel-hub.com/api/v1/dataimport/quotas"
response = oauth.get(url=url)
response.raise_for_status()
response.json()
WorldView Data Import
Search
Simple Search
url = "https://services.sentinel-hub.com/api/v1/dataimport/search"
query = {
"provider": "MAXAR",
"bounds": {
"geometry": {
"type": "Polygon",
"coordinates": [
[
[15.81, 46.70],
[15.84, 46.70],
[15.84, 46.72],
[15.81, 46.72],
[15.81, 46.70]
]
]
}
},
"data": [
{
"productBands": "4BB",
"dataFilter": {
"timeRange": {
"from": "2020-11-06T00:00:00.0Z",
"to": "2020-11-06T23:59:59.9Z"
}
}
}
]
}
response = oauth.post(url, json=query)
response.raise_for_status()
results = response.json()
To get product IDs:
item_ids = [feature["catalogID"] for feature in results["features"]]
Native Search
This native search is equivalent to the simple search above.
url = "https://services.sentinel-hub.com/api/v1/dataimport/nativesearch"
payload = {
"provider": "MAXAR",
"startDate": "2020-11-06",
"endDate": "2020-11-07",
"aoiInGeoJson": {
"type": "Polygon",
"coordinates": [
[
[15.81, 46.70],
[15.84, 46.70],
[15.84, 46.72],
[15.81, 46.72],
[15.81, 46.70]
]
],
"crs": {
"type": "name",
"properties": {
"name": "EPSG:4326"
}
}
},
"geometry": "true"
}
response = oauth.post(url, json=payload)
response.raise_for_status()
results = response.json()
To get product IDs:
item_ids = [feature["catalogID"] for feature in results["features"]]
Thumbnail
After searching, you can check the thumbnail of each item by entering the item ID into the thumbnail request URL:
item_id = '1040010063790D00'
# or get it from search results: item_id = item_ids[0]
url = f"https://services.sentinel-hub.com/api/v1/dataimport/collections/MAXAR_WORLDVIEW/products/{item_id}/thumbnail"
response = oauth.get(url)
Display the thumbnail in Python:
import io
from PIL import Image
image_bytes = io.BytesIO(response.content)
Image.open(image_bytes)
Order
To order WorldView data, provider must be set to "MAXAR".
Order Products
To order the import of products from the item_ids variable returned by search:
url = "https://services.sentinel-hub.com/api/v1/dataimport/orders"
payload = {
"name": "My WorldView order",
# collectionId is optional. Remove it to create a new collection.
"collectionId": "<your WorldView collectionId>",
"input": {
"provider": "MAXAR",
"bounds": {
"geometry": {
"type": "Polygon",
"coordinates": [
[
[15.81, 46.70],
[15.84, 46.70],
[15.84, 46.72],
[15.81, 46.72],
[15.81, 46.70]
]
]
}
},
"data": [{
"productBands": "4BB",
"selectedImages": item_ids
}]
}
}
response = oauth.post(url, json=payload)
response.raise_for_status()
order = response.json()
Order Using Query
Another way to order data is using a search query from the simple search above:
url = "https://services.sentinel-hub.com/api/v1/dataimport/orders"
payload = {
"name": "My WorldView order using query",
# collectionId is optional. Remove it to create a new collection.
"collectionId": "<your WorldView collectionId>",
"input": query
}
response = oauth.post(url, json=payload)
response.raise_for_status()
order = response.json()
To extract the order ID:
order_id = order['id']
To extract the cost in square kilometers:
sqkm = order['sqkm']
Confirm the Order
Confirming the order subtracts the ordered area in km² from your quota.
To initiate import, confirm the order:
url = f"https://services.sentinel-hub.com/api/v1/dataimport/orders/{order_id}/confirm"
response = oauth.post(url)
response.raise_for_status()
Get Order Information
url = f"https://services.sentinel-hub.com/api/v1/dataimport/orders/{order_id}"
response = oauth.get(url)
response.raise_for_status()
order = response.json()
To extract the order status:
status = order['status']
To extract the BYOC collection ID:
collection_id = order['collectionId']
List All Your Orders
url = "https://services.sentinel-hub.com/api/v1/dataimport/orders"
response = oauth.get(url)
response.raise_for_status()
response.json()
Access WorldView Data in a BYOC Collection and Process a Truecolor Image
This is a standard Processing API request using a BYOC collectionId fetched from the get order information request.
url = 'https://services.sentinel-hub.com/api/v1/process'
payload = {
'input': {
"bounds": {
"geometry": {
"type": "Polygon",
"coordinates": [
[
[15.81, 46.70],
[15.84, 46.70],
[15.84, 46.72],
[15.81, 46.72],
[15.81, 46.70]
]
]
}
},
"data": [{
"type": "byoc-991fe3be-4d19-4d9f-9941-879da0a5c3b3",
"dataFilter": {
"timeRange": {
"from": "2020-11-06T00:00:00.0Z",
"to": "2020-11-06T23:59:59.9Z"
}
}
}]
},
"output": {
"width": 512,
"height": 512
},
"evalscript": """
//VERSION=3
function setup() {
return {
input: ["Red", "Green", "Blue", "dataMask"],
output: { bands: 4 }
};
}
var f = 2000;
function evaluatePixel(sample) {
return [sample.Red/f, sample.Green/f, sample.Blue/f, sample.dataMask];
}
"""
}
response = oauth.post(url, json=payload)
response.raise_for_status()