mirror of
https://forge.chapril.org/tykayn/mapillary_download
synced 2025-10-09 17:02:46 +02:00
up
This commit is contained in:
parent
cdd4d6e549
commit
a080ab844f
15 changed files with 392 additions and 80 deletions
|
@ -34,14 +34,29 @@ def get_image_data_from_sequences():
|
|||
username = args.username
|
||||
input_file = "out_" + username + ".json"
|
||||
|
||||
print('get_image_data_from_sequences input_file', input_file)
|
||||
# Chargement du fichier JSON d'entrée
|
||||
with open(input_file, "r") as file:
|
||||
input_data = json.load(file)
|
||||
|
||||
# Itération sur les noeuds pour collectionner les image_ids
|
||||
# Vérification de l'existence des clés dans le chemin d'accès
|
||||
if "data" not in input_data:
|
||||
print("Erreur: 'data' n'existe pas dans le fichier JSON")
|
||||
return
|
||||
if "fetch__User" not in input_data["data"]:
|
||||
print("Erreur: 'fetch__User' n'existe pas dans les données")
|
||||
return
|
||||
if "feed" not in input_data["data"]["fetch__User"]:
|
||||
print("Erreur: 'feed' n'existe pas pour cet utilisateur")
|
||||
return
|
||||
if "nodes" not in input_data["data"]["fetch__User"]["feed"]:
|
||||
print("Erreur: 'nodes' n'existe pas dans le feed")
|
||||
return
|
||||
|
||||
nodelist = input_data["data"]["fetch__User"]["feed"]["nodes"]
|
||||
print("séquences : ", len(nodelist))
|
||||
image_ids = [node["image_id"] for node in nodelist]
|
||||
image_ids = [node["image_id"] for node in nodelist if "image_id" in node]
|
||||
print(image_ids)
|
||||
|
||||
dev_token = args.dev_token
|
||||
|
@ -51,7 +66,14 @@ def get_image_data_from_sequences():
|
|||
|
||||
ii = 0
|
||||
limit_requests = 1000000000
|
||||
# limit_requests = 5 # pour tester
|
||||
|
||||
FRANCE_MIN_LAT = 42.25
|
||||
FRANCE_MIN_LON = -4.77
|
||||
FRANCE_MAX_LAT = 51.10
|
||||
FRANCE_MAX_LON = 9.57
|
||||
|
||||
bbox_filter = f"&bbox={FRANCE_MIN_LAT},{FRANCE_MIN_LON},{FRANCE_MAX_LAT},{FRANCE_MAX_LON}"
|
||||
|
||||
# Boucle sur chaque image_id pour interroger l'API Mapillary
|
||||
for image_id in image_ids:
|
||||
ii += 1
|
||||
|
@ -63,8 +85,9 @@ def get_image_data_from_sequences():
|
|||
+ "?access_token="
|
||||
+ dev_token
|
||||
+ "&fields=id,sequence"
|
||||
+ bbox_filter
|
||||
)
|
||||
# print("requete: "+request_url)
|
||||
print("requete graphql : "+request_url)
|
||||
|
||||
response = requests.get(request_url)
|
||||
|
||||
|
@ -80,8 +103,9 @@ def get_image_data_from_sequences():
|
|||
print(
|
||||
"séquence trouvée: "
|
||||
+ str(ii)
|
||||
+ "/"
|
||||
+ args.max_sequence
|
||||
# TODO fix calculation of max sequence
|
||||
# + "/"
|
||||
# + args.max_sequence
|
||||
+ " : "
|
||||
+ raw_response["sequence"]
|
||||
)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue