import requests
# Query for visible images
response = requests.get(
"https://avert-legacy.ldeo.columbia.edu/api/imagery/visible/query",
params={
"site": "CLNE",
"vnum": 311240,
"search_from": "2022-10-01T00:00",
"search_to": "2022-10-02T00:00",
"limit": 10 # Control result size
}
)
images = response.json()
# Download images as ZIP if ≤100 results
if len(images) <= 100:
zip_response = requests.get(
"https://avert-legacy.ldeo.columbia.edu/api/imagery/visible/query",
params={
"site": "CLNE",
"vnum": 311240,
"search_from": "2022-10-01T00:00",
"search_to": "2022-10-02T00:00",
"download": True
}
)
with open("visible_images.zip", "wb") as f:
f.write(zip_response.content)
# Or download individual images
for image in images:
image_response = requests.get(
f"https://avert-legacy.ldeo.columbia.edu/api/imagery/visible/r/{image['image_id']}",
params={"download": True}
)
with open(f"visible_{image['image_id']}.jpg", "wb") as f:
f.write(image_response.content)