Hi, I’m new to Mapillary. I’ve been learning for a month and am currently working on collecting data. I want the geo coordinates of features that Mapillary can detect. I’ve used the API, but it returns geometry in pixel coordinates. What I’m trying to ask is, is there any way to obtain the geo coordinates of features from the Mapillary API?
Hey @fuse , great question!
So the detections and the features are different. The detections API is going to only return information about the label and the segmentation coordinates, as you mention, pixels in the image. Most of these do not have a position exactly. If you are using MapillaryJS library, you can find a project and unproject function that will convert pixel XY to approximate lonLat, however, only built into that library when the relevant image is loaded.
If you just want the lonLat of the features, then you need to use not the detections API but the Map Feature API: API Documentation
This will return every map feature with a point geometry.
Let me know if that helps and you make progress, or if you get stuck.
Is there an alternative method to obtain map feature IDs? While I have successfully downloaded Map Data in JSON format via Mapillary and extracted map_feature_ids along with coordinates from the file, I am interested in accessing this information programmatically through the API.
I am aware of the graph.mapillary.com/map_features endpoint, which requests bbox, but I prefer to retrieve features directly associated with specific images. Is there a specific API endpoint or method that allows me to obtain map features linked to particular images within the Mapillary platform?
I think no way to do what you are asking.
With /map_features endpoint, you cannot pre-filter by image IDs.
You can do /<IMAGE_ID>/detections to get associated detections, and /<MAP_FEATURE_ID>/detections.
So the closest thing you could do is:
- request all map features in a bbox with list of image IDs
- get the detection IDs for each map feature
- get the detection IDs for each image in the list of map features
- join these so that a map feature has a list of image IDs, joined on detection IDs
Then lookup for an image ID you have, which map features are associated.
@boris this could be a feature request for having an endpoint like graph.mapillary.com/<image_id>/map_features to get the features derived from this image. It could be useful in Rapid as well to quickly highlight on the map what map feature point objects are visible in that exact image.