in src/mapillary/interface.py [0:0]
def map_features_in_geojson(geojson: dict, **filters: dict):
"""
Extracts all map features within a geojson's boundaries
:param geojson: A geojson as the shape acting as the query extent
:type geojson: dict
:param filters: Different filters that may be applied to the output, defaults to {}
:type filters: dict (kwargs)
:param filters.zoom: The zoom level of the tiles to obtain, defaults to 14
:type filters.zoom: int
:param filters.max_captured_at: The max date. Format from 'YYYY', to 'YYYY-MM-DDTHH:MM:SS'
:type filters.max_captured_at: str
:param filters.min_captured_at: The min date. Format from 'YYYY', to 'YYYY-MM-DDTHH:MM:SS'
:type filters.min_captured_at: str
:param filters.image_type: The tile image_type to be obtained, either as 'flat', 'pano'
(panoramic), or 'all'. See https://www.mapillary.com/developer/api-documentation/ under
'image_type Tiles' for more information
:type filters.image_type: str
:param filters.compass_angle: The compass angle of the image
:type filters.compass_angle: int
:param filters.sequence_id: ID of the sequence this image belongs to
:type filters.sequence_id: str
:param filters.organization_id: ID of the organization this image belongs to. It can be absent
:type filters.organization_id: str
:return: A GeoJSON object
:rtype: mapillary.models.geojson.GeoJSON
Usage::
>>> import mapillary as mly
>>> import json
>>> mly.interface.set_access_token('MLY|YYY')
>>> data = mly.interface.map_features_in_geojson(
... json.load(
... open('my_geojson.geojson', mode='r')
... )
... )
>>> open('output_geojson.geojson', mode='w').write(data.encode())
"""
if isinstance(geojson, str):
if "http" in geojson:
geojson = json.loads(requests.get(geojson).content.decode("utf-8"))
return image.geojson_features_controller(
geojson=geojson, is_image=False, filters=filters
)