here.platform.api.data_interactive_api module
here.platform.api.data_interactive_api module
This module contains a DataInteractiveApi class to perform API operations.
The HERE API reference documentation used in this module can be found here: Interactive API Reference
class here.platform.api.data_interactive_api.DataInteractiveApi(base_url: str, platform_config: PlatformConfig, application_config: ApplicationConfig, auth: Auth | None, proxies: dict | None = None)
Bases: BaseApi
This class provides access to HERE platform Data Interactive APIs.
Interactive APIs offer a set of unique capabilities, enabling you to store, retrieve, search for, analyze and modify data at a feature (e.g., a place) and feature property (e.g., the name of the place) level. With interactive APIs, data is stored in GeoJSON and can be retrieved dynamically at any zoom level.
delete_feature(layer_id: str, feature_id: str) dict | str
Delete an existing feature.
Parameters:
-
layer_id – Identifier of the Interactive Map Layer.
-
feature_id – Feature id which is to fetched.
Returns:
Response from the API.
delete_features(layer_id: str, feature_ids: List[str]) dict | str
Delete multiple features from the layer.
Parameters:
-
layer_id – Identifier of the Interactive Map Layer.
-
feature_ids – A list of feature_ids to be deleted.
Returns:
Response from the API.
get_feature(layer_id: str, feature_id: str, selection: List[str] | None = None, force2d: bool = False) dict
Return the feature with the provided feature_id.
Parameters:
-
layer_id – Identifier of the Interactive Map Layer.
-
feature_id – Feature id which is to fetched.
-
selection – A list, only these properties will be present in returned feature.
-
force2d – If set to
Truethen features in the response will have only X and Y components, else all x,y,z coordinates will be returned.
Returns:
Response from the API.
get_features(layer_id: str, feature_ids: List, selection: List[str] | None = None, force2d: bool = False) dict
Return all of the features found for the provided list of feature ids.
The response is always a FeatureCollection, even if there are no features with the provided ids.
Parameters:
-
layer_id – Identifier of the Interactive Map Layer.
-
feature_ids – A list of feature_ids to fetch.
-
selection – A list, only these properties will be present in returned features.
-
force2d – If set to
Truethen features in the response will have only X and Y components, else all x,y,z coordinates will be returned.
Returns:
Response from the API.
get_features_by_bbox(layer_id: str, bbox: tuple, clip: bool = False, limit: int = 30000, params: dict | None = None, selection: List[str] | None = None, skip_cache: bool = False, clustering: str | None = None, clustering_params: Dict | None = None, force2d: bool = False) dict
Return the features which are inside a bounding box stipulated by bbox parameter.
Parameters:
-
layer_id – Identifier of the Interactive Map Layer.
-
bbox – A tuple of four numbers representing the West, South, East and North margins, respectively, of the bounding box.
-
clip – A Boolean indicating if the result should be clipped (default: False).
-
limit – A maximum number of features to return in the result. Default is 30000. Hard limit is 100000.
-
params – A dict to represent additional filters on features to be searched.
-
selection – A list, only these properties will be present in returned features.
-
skip_cache – If set to
Truethe response is not returned from cache. Default isFalse. -
clustering – The clustering algorithm to apply to the data within the result. Clustering algorithms supported:
hexbin,quadbin. -
clustering_params – Parameters for the chosen clustering algorithm.
-
force2d – If set to
Truethen features in the response will have only X and Y components, else all x,y,z coordinates will be returned.
Returns:
Response from the API.
get_features_in_tile(layer_id: str, tile_type: str, tile_id: str, clip: bool = False, params: dict | None = None, selection: List[str] | None = None, skip_cache: bool = False, clustering: str | None = None, clustering_params: Dict | None = None, margin: int | None = 0, limit: int = 30000, force2d: bool = False) dict
Return features in tile.
Parameters:
-
layer_id – Identifier of the Interactive Map Layer.
-
tile_type – A string with the name of a tile type, one of “quadkeys”, “web”, “tms” or “here”. The type of tile identifier. “quadkey” - Virtual Earth, “web” - Web Mercator, “tms” - OSGEO Tile Map Service, “here” - Here Tile Schema.
-
tile_id – The tile identifier can be provided as quadkey (1), Web Mercator level,x,y coordinates (1_1_0) or OSGEO Tile Map Service level,x,y (1_1_0).
-
clip – A Boolean indicating if the result should be clipped (default: False).
-
params – A dict to represent additional filters on features to be searched.
-
selection – A list, only these properties will be present in returned features.
-
skip_cache – If set to
Truethe response is not returned from cache. Default isFalse. -
clustering – The clustering algorithm to apply to the data within the result. Clustering algorithms supported:
hexbin,quadbin. -
clustering_params – Parameters for the chosen clustering algorithm.
-
margin – Margin in pixels on the respective projected level around the tile. Default is 0.
-
limit – The maximum number of features in the response. Default is 30000. Hard limit is 100000.
-
force2d – If set to
Truethen features in the response will have only X and Y components, else all x,y,z coordinates will be returned.
Returns:
Response from the API.
get_features_with_geometry_intersection(layer_id: str, data: dict, radius: int | None = None, limit: int = 30000, params: dict | None = None, selection: List[str] | None = None, skip_cache: bool = False, force2d: bool = False) dict
Retrieve the features which are inside the specified radius and geometry.
The origin point is calculated based on the geometry provided as payload.
Parameters:
-
layer_id – Identifier of the Interactive Map Layer.
-
data – Geometry which will be used in intersection.
-
radius – Radius in meter which defines the diameter of the search request.
-
limit – The maximum number of features in the response. Default is 30000. Hard limit is 100000.
-
params – A dict to represent additional filters on features to be searched.
-
selection – A list, only these properties will be present in returned features.
-
skip_cache – If set to
Truethe response is not returned from cache. Default isFalse. -
force2d – If set to
Truethen features in the response will have only X and Y components, else all x,y,z coordinates will be returned.
Returns:
Response from the API.
get_features_with_radius_search(layer_id: str, lat: float | None = None, lng: float | None = None, ref_catalog: str | None = None, ref_layer_id: str | None = None, ref_feature_id: str | None = None, radius: int | None = None, limit: int = 30000, params: dict | None = None, selection: List[str] | None = None, skip_cache: bool = False, force2d: bool = False) dict
Return the features which are inside the specified radius.
The origin radius point is calculated based either on latitude & longitude or by specifying a feature’s geometry.
Parameters:
-
layer_id – Identifier of the Interactive Map Layer.
-
lat – The latitude in WGS’84 decimal degree (-90 to +90) of the center Point.
-
lng – The longitude in WGS’84 decimal degree (-180 to +180) of the center Point.
-
ref_catalog – The catalog HRN where the layer containing the referenced feature is stored. Always to use in combination with
ref_feature_id. -
ref_layer_id – As alternative for defining center coordinates, it is possible to reference a geometry in a layer. Therefore it is needed to provide the layer id where the referenced feature is stored. Always to use in combination with
ref_feature_id. -
ref_feature_id – The unique identifier of a feature in the referenced layer. The geometry of that feature gets used for the spatial query. Always to use in combination with
ref_catalogandref_layer_id. -
radius – Radius in meter which defines the diameter of the search request.
-
limit – The maximum number of features in the response. Default is 30000. Hard limit is 100000.
-
params – A dict to represent additional filters on features to be searched.
-
selection – A list, only these properties will be present in returned features.
-
skip_cache – If set to
Truethe response is not returned from cache. Default isFalse. -
force2d – If set to
Truethen features in the response will have only X and Y components, else all x,y,z coordinates will be returned.
Returns:
Response from the API.
get_statistics(layer_id: str, skip_cache: bool = False) dict
Return statistical information about this layer.
Parameters:
-
layer_id – Identifier of the Interactive Map Layer.
-
skip_cache – If set to
Truethe response is not returned from cache. Default isFalse.
Returns:
Response from the API.
iter_features(layer_id: str, limit: int = 30000, page_token: str | None = None, selection: List[str] | None = None, skip_cache: bool = False, force2d: bool = False) dict
Iterate over all of the features in the layer.
The features in the response are ordered so that no feature is returned twice.
Parameters:
-
layer_id – Identifier of the Interactive Map Layer.
-
limit – The maximum number of features in the response in single iteration. Default is 30000. Hard limit is 100000.
-
page_token – The page token where the iteration will continue.
-
selection – A list, only these properties will be present in returned features.
-
skip_cache – If set to
Truethe response is not returned from cache. Default isFalse. -
force2d – If set to
Truethen features in the response will have only X and Y components, else all x,y,z coordinates will be returned.
Returns:
Response from the API.
search_features(layer_id: str, limit: int = 30000, params: dict | None = None, selection: List[str] | None = None, skip_cache: bool = False, force2d: bool = False) dict
Search for features in the layer.
The results are unordered and the request does not allow to continue the search,
Parameters:
-
layer_id – Identifier of the Interactive Map Layer.
-
limit – The maximum number of features in the response. Default is 30000. Hard limit is 100000.
-
params – A dict to represent additional filters on features to be searched.
-
selection – A list, only these properties will be present in returned features.
-
skip_cache – If set to
Truethe response is not returned from cache. Default isFalse. -
force2d – If set to
Truethen features in the response will have only X and Y components, else all x,y,z coordinates will be returned.
Returns:
Response from the API.
update_feature(layer_id: str, feature_id: str, data: dict) dict
Update an existing feature.
Parameters:
-
layer_id – Identifier of the Interactive Map Layer.
-
feature_id – Feature id which is to fetched.
-
data – Request body representing feature to change.
Returns:
Response from the API.
update_features(layer_id: str, data: dict) dict
Update features.
Parameters:
-
layer_id – Identifier of the Interactive Map Layer.
-
data – Request body representing FeatureCollection to create or update.
Returns:
Response from the API.
write_feature(layer_id: str, feature_id: str, data: dict) dict
Create or replace a feature in the layer.
Parameters:
-
layer_id – Identifier of the Interactive Map Layer.
-
feature_id – Feature id which is to fetched.
-
data – Request body representing feature to create or replace.
Returns:
Response from the API.
write_features(layer_id: str, data: dict) dict
Write the provided features to Layer.
Parameters:
-
layer_id – Identifier of the Interactive Map Layer.
-
data – Request body representing FeatureCollection to create or replace.
Returns:
Response from the API.