deseasion.backend.services.geo_data module
- class deseasion.backend.services.geo_data.DataService
Bases:
object
- check_permission(data)
Check if the current user is authorized to access the data.
- Args:
data: A data object.
- Raises:
PermissionError is the user is not authorized to use the data.
- get_all_authorized_data(user, types: set[str])
Return the list of all the data.
- Args:
user: User for which to get the data.
- Returns:
A list of Data objects.
- get_if_authorized(data_id)
Return the global data if the user is authorized to access it.
- Args:
data_id (int): The id of the data to return.
- Raises:
RequestError (code 404) if the data does not exist.
- Returns:
The data.
- has_permission(data, user=None)
Return if the current user is authorized to access the data.
- Args:
data: A data object.
Returns: authorization as bool
- class deseasion.backend.services.geo_data.GeoDataService
Bases:
object
- check_permission(data)
Check if the current user is authorized to access the data.
- Args:
data: A geo-data object.
- Raises:
PermissionError is the user is not authorized to use the data.
- get_all_authorized_geo_data(user)
Return the list of all the geo data (not the generated geo data).
- Args:
user: User for which to get the geo data.
- Returns:
A list of GeoData objects.
- get_if_authorized(geo_data_id)
Return the geo data if the user is authorized to access it.
- Args:
geo_data_id (int): The id of the geo data to return.
- Raises:
RequestError (code 404) if the data does not exist.
- Returns:
The geo data.
- get_vector_tile(geo_data_id, z, x, y, property_name=None)
Return the geo data features as a Mapbox Vector Tile.
The geometries are simplified to the zoom level (z coordinate) and projected as web mercator. If a property_name is specified. Geometry near the poles are clipped as they cannot be transformed to Web Mercator Projection (EPSG:3857). The clipping is done above 85° North and below -85° South.
- Args:
geo_data_id (int): The id of the geo data to return. z (int): Z coordinate of the tile (zoom level). x (int): X coordinate of the tile. y (int): Y coordinate of the tile. property_name (str): The name of a property to return as an
attribute in the geometries. Default: None.
- Returns:
A string representing a Mapbox Vector Tile.
- class deseasion.backend.services.geo_data.GlobalDataService
Bases:
object
- check_permission(data)
Check if the current user is authorized to access the global data.
- Args:
data: A global data object.
- Raises:
PermissionError is the user is not authorized to use the global data.
- get_all_authorized_data(user)
Return the list of all the global data.
- Args:
user: User for which to get the global data.
- Returns:
A list of GlobalData objects.
- get_if_authorized(data_id)
Return the global data if the user is authorized to access it.
- Args:
data_id (int): The id of the global data to return.
- Raises:
RequestError (code 404) if the global data does not exist.
- Returns:
The data.
- class deseasion.backend.services.geo_data.StreamGeoDataService
Bases:
object
- check_permission(data)
Check if the current user is authorized to access the data.
- Args:
data: A geo-data stream object.
- Raises:
PermissionError is the user is not authorized to use the data.
- get_all_authorized_geo_data(user)
Return the list of all the geo data streams.
- Args:
user: User for which to get the geo data streams.
- Returns:
A list of StreamGeoData objects.
- get_if_authorized(stream_geo_data_id)
Return the geo data stream if the user is authorized to access it.
- Args:
stream_geo_data_id (int): The id of the geo data stream to return.
- Raises:
RequestError (code 404) if the stream does not exist.
- Returns:
The geo data stream.