Skip to main content

mapillary.config.api.entities

mapillary.config.api.entities#

This module contains the class implementation of the Entities API endpoints as string, for the entity API endpoint aspect of the API v4 of Mapillary.

For more information, please check out https://www.mapillary.com/developer/api-documentation/.

  • Copyright: (c) 2021 Facebook
  • License: MIT LICENSE

class mapillary.config.api.entities.Entities()#

Bases: object

Each API call requires specifying the fields of the Entity you’re interested in explicitly. A sample image by ID request which returns the id and a computed geometry could look as below. For each entity available fields are listed in the relevant sections. All IDs are unique and the underlying metadata for each entity is accessible at https://graph.mapillary.com/:id?fields=A,B,C. The responses are uniform and always return a single object, unless otherwise stated (collection endpoints). All collection endpoint metadata are wrapped in a {“data”: [ {…}, …]} JSON object.

Usage:

$ GET 'https://graph.mapillary.com/$IMAGE_ID?access_token=TOKEN&fields=id,computed_geometry'... {...     "id": "$IMAGE_ID",...     "computed_geometry": {...         "type": "Point",...         "coordinates": [0, 0]...     }... }

static get_detection_with_image_id(image_id: str, fields: list)#

Represent an object detected in a single image. For convenience this version of the API serves detections as collections. They can be requested as a collection on the resource (e.g. image) they contribute or belong to.

Usage:

>>> 'https://graph.mapillary.com/:image_id/detections'>>> # detections in the image with ID image_id

Fields:

1. created_at - timestamp, when was this detection created2. geometry - string, base64 encoded polygon3. image - object, image the detection belongs to4. value - string, what kind of object the detection represents

static get_detection_with_image_id_fields()#

Gets list of possible detections for image ids

  • Returns

    Possible detection parameters

  • Return type

    list

static get_detection_with_map_feature_id(map_feature_id: str, fields: list)#

Represent an object detected in a single image. For convenience this version of the API serves detections as collections. They can be requested as a collection on the resource (e.g. map feature) they contribute or belong to.

Usage:

>>> 'https://graph.mapillary.com/:map_feature_id/detections'>>> # detections in the image with ID map_feature_id

Fields:

1. created_at - timestamp, when was this detection created2. geometry - string, base64 encoded polygon3. image - object, image the detection belongs to4. value - string, what kind of object the detection represents

static get_detection_with_map_feature_id_fields()#

Gets list of possible field parameters for map features

  • Returns

    Map feature detection fields

  • Return type

    list

static get_image(image_id: str, fields: list)#

Represents the metadata of the image on the Mapillary platform with the following properties.

Usage:

>>> 'https://graph.mapillary.com/:image_id' # endpoint

Fields:

1. altitude - float, original altitude from Exif2. atomic_scale - float, scale of the SfM reconstruction around the image3. camera_parameters - array of float, intrinsic camera parameters4. camera_type - enum, type of camera projection (perspective, fisheye, or spherical)5. captured_at - timestamp, capture time6. compass_angle - float, original compass angle of the image7. computed_altitude - float, altitude after running image processing8. computed_compass_angle - float, compass angle after running image processing9. computed_geometry - GeoJSON Point, location after running image processing10. computed_rotation - enum, corrected orientation of the image11. exif_orientation - enum, orientation of the camera as given by the exif tag    (see: https://sylvana.net/jpegcrop/exif_orientation.html)12. geometry - GeoJSON Point geometry13. height - int, height of the original image uploaded14. thumb_256_url - string, URL to the 256px wide thumbnail15. thumb_1024_url - string, URL to the 1024px wide thumbnail16. thumb_2048_url - string, URL to the 2048px wide thumbnail17. merge_cc - int, id of the connected component of images that were aligned together18. mesh - { id: string, url: string } - URL to the mesh19. quality_score - float, how good the image is (experimental)20. sequence - string, ID of the sequence21. sfm_cluster - { id: string, url: string } - URL to the point cloud22. width - int, width of the original image uploaded

static get_image_fields()#

Gets list of possible image fields

  • Returns

    Image field list

  • Return type

    list

static get_map_feature(map_feature_id: str, fields: list)#

These are objects with a location which have been derived from multiple detections in multiple images.

Usage:

>>> 'https://graph.mapillary.com/:map_feature_id' # endpoint

Fields:

1. first_seen_at - timestamp, timestamp of the least recent detection    contributing to this feature2. last_seen_at - timestamp, timestamp of the most recent detection    contributing to this feature3. object_value - string, what kind of map feature it is4. object_type - string, either a traffic_sign or point5. geometry - GeoJSON Point geometry6. images - list of IDs, which images this map feature was derived from

static get_map_feature_fields()#

Gets map feature fields

  • Returns

    Possible map feature fields

  • Return type

    list

static get_organization_id(organization_id: str, fields: list)#

Represents an organization which can own the imagery if users upload to it

Usage:

>>> 'https://graph.mapillary.com/:organization_id' # endpoint

Fields:

1. slug - short name, used in URLs2. name - nice name3. description - public description of the organization

static get_organization_id_fields()#

Gets list of possible organization id fields

  • Returns

    Possible organization fields

  • Return type

    list

static get_sequence(sequence_id: str)#

Represents a sequence of Image IDs ordered by capture time

Usage:

>>> 'https://graph.mapillary.com/image_ids?sequence_id=XXX'>>> # endpoint

Fields:

1. id - ID of the image belonging to the sequence