Created
August 15, 2022 10:35
-
-
Save Rubix982/d044a0dc36b10b50927807039ebf1b5a to your computer and use it in GitHub Desktop.
Getting the properties and separating out the thumbnails
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import json | |
from mapillary.models.client import Client | |
from mapillary.config.api.entities import Entities | |
# Useful list of fields we can use | |
# For a complete list of possible values, please visit the below link | |
# https://mapillary.github.io/mapillary-python-sdk/docs/mapillary.config.api/mapillary.config.api.entities#static-get_imageimage_id-str-fields-list | |
fields_to_pass_for_the_image: list = ['thumb_2048_url', 'merge_cc', 'mesh', | |
'sfm_cluster', 'atomic_scale', | |
'camera_parameters', 'camera_type', | |
'captured_at', 'compass_angle', | |
'computed_altitude', | |
'computed_compass_angle', | |
'computed_geometry'] | |
for index, image_ids in enumerate(image_id_list): | |
image_id_list[index]['thumb_2048_urls'] = [] | |
image_id_list[index]['property_data'] = [] | |
for image_id in image_ids['image_ids']: | |
response = Client().get(Entities.get_image(image_id=image_id, fields=fields_to_pass_for_the_image)) | |
data = json.loads(response.content.decode('utf-8')) | |
image_id_list[index]['thumb_2048_urls'].append(data['thumb_2048_url']) | |
del data['thumb_2048_url'] | |
image_id_list[index]['property_data'].append(data) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment