I signed up for an individual account and created a application. I am using the following code in jupyter notebook to pull images for a geo-coordinate.
I copied the client token from developer page and am using it. It’s of the following form:
MLY|22292192312312|xxxxdsadsdaufhdasx
However, when I run the code, I get an error: {'code': 'client_id_invalid', 'message': 'The provided client id is invalid'}
Full code:
import json, requests
from IPython.display import Image, display # import module to print an image
# set our building blocks
client_id = 'MLY|22292192312312|xxxxdsadsdaufhdasx' # client ID
coordinates = '-122.40347,37.780205' # the coordinates of our point of interest
distance = 15 # the maximum distance in meters that our image should be from the point it looks toward
# API call URL - we just want one image, and no pagination
url = ('https://a.mapillary.com/v3/images?client_id={}&per_page=1&lookat={}&closeto={}&radius={}').format(client_id,coordinates,coordinates,distance)
# request a JSON showing the point location and metadata of the images looking at our coordinates
resp = requests.get(url)
data = resp.json()
print(data)
You are trying to access V3 API with V4 key. Since the keys are totally different, it won’t work. The old API is technically still up, but no new keys can be generated and it will probably shut down permanently.
It’s up to you how to process that - find closest, newest within distance or something like that. Depends on the use case really. Anyway, once you find suitable id, you can get rest of the data from here: https://graph.mapillary.com/:image_id, where fields=thumb_2048_url gives you the image.
Not as far I can tell - the main element is the image id and all other data (including the visual representation itself) is under that. So there is no server-side aggregation involved.