I have a code that searches for the most recent basemap available.However, when I list all available mosaics, it only returns mosaics until the end of 2023. When I search by name, for example "planet_medres_normalized_analytic_2024-09_mosaic" I can't find this basemap, but when I search directly by its id, I can find it: {'_links': {'_self': 'https://api.planet.com/basemaps/v1/mosaics/02e1d63d-21d6-4355-beed-504c8e3595db?api_key='', 'quads': 'https:/ /api.planet.com/basemaps/v1/mosaics/02e1d63d-21d6-4355-beed-504c8e3595db/quads?api_key=''&bbox={lx},{ly},{ux},{uy}', 'tiles ': 'https://tiles.planet.com/basemaps/v1/planet-tiles/planet_medres_normalized_analytic_2024-09_mosaic/gmap/{z}/{x}/{y}.png?api_key=''}, 'bbox ': [-179.999999974944, -34.161818157002, 179.999999975056, 30.145127179625], 'coordinate_system': 'EPSG:3857', 'datatype': 'uint16', 'first_acquired': '2024-09-01T0 0:00:00.000Z', ' grid': {'quad_size': 4096, 'resolution': 4.777314267823516}, 'id': '02e1d63d-21d6-4355-beed-504c8e3595db', 'interval': '1 mon', 'item_types': ['PSScene' ], 'last_acquired': '2024-10-01T00:00:00.000Z', 'level': 15, 'name': 'planet_medres_normalized_analytic_2024-09_mosaic', 'product_type': 'timelapse', 'quad_download': True}, However, searching directly for the name, I don't find it. By loading all the available mosaics, this one does not appear in the list. What should I do?code: #...API_KEY = ''
today= datetime.datetime.now()
current_year= today.year
last_month= today.month - 1 if today.month > 1 else 12
last_month_str= str(last_month).zfill(2)
if last_month== 12:
current_year-= 1
name_mosaic = f'planet_medres_normalized_analytic_{current_year}-{last_month_str}_mosaic'
print(name_mosaic)
def find_mosaic_id(name_mosaic):
url = 'https://api.planet.com/basemaps/v1/mosaics'
headers = {'Authorization': f'api-key {API_KEY}'}
response = requests.get(url, headers=headers)
if response.status_code != 200:
print(f"Error: {response.status_code} - {response.text}")
return None
mosaics = response.json().get('mosaics', e])
for mosaic in mosaics:
if name_mosaic in mosaic 'name']:
return mosaice'id']
print("No mosaics found with the specified name.")
return None
def download_planet_quads(mosaic_id, bbox):
PLANET_API_URL = f'https://api.planet.com/basemaps/v1/mosaics/{mosaic_id}/quads'
headers = {'Authorization': f'api-key {API_KEY}'}
params = {'bbox': bbox}
response = requests.get(PLANET_API_URL, headers=headers, params=params)
if response.status_code != 200:
print(f"Erro finding the mosaic: {response.status_code} - {response.text}")
return None
quads = response.json().get('items', ])
if not quads:
print("No quad found for the AOI.")
return None
downloaded_files = o]
#….