def get_feature_from_key_controller()

in src/mapillary/controller/feature.py [0:0]


def get_feature_from_key_controller(key: int, fields: list) -> str:
    """
    A controller for getting properties of a certain image given the image key and
    the list of fields/properties to be returned

    :param key: The image key
    :type key: int

    :param fields: List of possible fields
    :type fields: list

    :return: The requested feature properties in GeoJSON format
    :rtype: str
    """

    valid_id(identity=key, image=False)

    # ? feature_to_geojson returns dict, but merged_features_list_to_geojson takes list as input
    return merged_features_list_to_geojson(
        features_list=feature_to_geojson(
            json_data=EntityAdapter().fetch_map_feature(
                map_feature_id=key, fields=fields
            )
        )
    )