diff --git a/README.md b/README.md index 248fb1f..8b89e0b 100644 --- a/README.md +++ b/README.md @@ -29,3 +29,21 @@ optional arguments: How many images you want to download --overwrite overwrite existing images ``` + +## How to get my access token + - Go to https://www.mapillary.com/dashboard/developers + - Click on "Registrer Application", enter the needed informations, enable the application to "Read" data, then click on register : + + ![register application](./doc/snapshot_mapillary_register_application.jpg) + - When this registration is done, click on "view" in the token column. This is you access token : + + ![token](./doc/snapshot_mapillary_token.jpg) + +## How to get my sequence id + + - Go to https://mapillary.com/app + - Click on one of the picture of the sequence you want to download + - Click on the "image option" button (right panel) + - Click on "advanced" then click on the sequence id to copy it in the clipboard + + ![snapshot](./doc/snapshot_mapillary_sequence.jpg) \ No newline at end of file diff --git a/doc/snapshot_mapillary_register_application.jpg b/doc/snapshot_mapillary_register_application.jpg new file mode 100644 index 0000000..59ccbe7 Binary files /dev/null and b/doc/snapshot_mapillary_register_application.jpg differ diff --git a/doc/snapshot_mapillary_sequence.jpg b/doc/snapshot_mapillary_sequence.jpg new file mode 100644 index 0000000..a9e20c8 Binary files /dev/null and b/doc/snapshot_mapillary_sequence.jpg differ diff --git a/doc/snapshot_mapillary_token.jpg b/doc/snapshot_mapillary_token.jpg new file mode 100644 index 0000000..8a5158f Binary files /dev/null and b/doc/snapshot_mapillary_token.jpg differ diff --git a/download.py b/download.py index 48b0b03..d760288 100644 --- a/download.py +++ b/download.py @@ -40,12 +40,14 @@ def download(url, filepath, metadata=None): f.write(image) print("{} downloaded".format(filepath)) + def get_single_image_data(image_id, mly_header): req_url = 'https://graph.mapillary.com/{}?fields=thumb_original_url,altitude,camera_type,captured_at,compass_angle,geometry,exif_orientation,sequence'.format(image_id) r = session.get(req_url, headers=mly_header) data = r.json() return data + def get_image_data_from_sequences(sequences_id, mly_header): for i,sequence_id in enumerate(sequences_id): url = 'https://graph.mapillary.com/image_ids?sequence_id={}'.format(sequence_id) @@ -61,6 +63,7 @@ def get_image_data_from_sequences(sequences_id, mly_header): image_data['sequence_id'] = sequence_id yield image_data + def get_image_data_from_sequences__future(sequences_id, mly_header): for i,sequence_id in enumerate(sequences_id): url = 'https://graph.mapillary.com/image_ids?sequence_id={}'.format(sequence_id) @@ -86,6 +89,7 @@ def get_image_data_from_sequences__future(sequences_id, mly_header): #print(image_data) yield image_data + def write_exif(picture, img_metadata): ''' Write exif metadata @@ -103,6 +107,7 @@ def write_exif(picture, img_metadata): return updated_image + if __name__ == '__main__': args = parse_args()