xyzspaces.spaces module

An more Pythonic abstraction for XYZ Spaces.

This contains only one class for an XYZ “space” which in turn provides access to “features”. There is no separate class abstraction for single features, but they are taken to be valid geojson.GeoJSON objects. Various other bits of the XYZ Hub API are simply returned as-is, usually wrapped in dictionaries, like the “statistics” of some given XYZ space.

class xyzspaces.spaces.Space(api=None, config=None)[source]

Bases: object

An abstraction for XYZ Spaces.

A space object is created with an existing, authenticated XYZ Hub API instance.

Example:

>>> space = Space.new(...)
>>> space.delete()
>>> for feat in space.iter_feature():
....   print(feat["id"])
Parameters
classmethod from_id(space_id, config=None)[source]

Instantiate a space object for an existing space ID.

Parameters
  • space_id (str) – A string to represent the id of the space.

  • config (Optional[xyzspaces.config.default.XYZConfig]) – An object of class:XYZConfig, If not provied XYZ_TOKEN will be used from environment variable and other configurations will be used as defined in default_config.

Returns

An object of Space.

Return type

xyzspaces.spaces.Space

classmethod new(title, description, space_id=None, schema=None, enable_uuid=None, listeners=None, shared=None, config=None)[source]

Create new space object with given title and description.

Optionally, the desired space ID can be provided as well, and will be used if still available.

Parameters
  • title (str) – A string representing the title of the space.

  • description (str) – A string representing a description of the space.

  • space_id (Optional[str]) – A string representing space_id.

  • schema (Optional[str]) – JSON object or URL to be added as a schema for space.

  • enable_uuid (Optional[bool]) – A boolean if set True it will create additional activity log space to log the activities in current space.

  • listeners (Optional[Dict[str, Union[str, int]]]) – A dict for activity log listener params.

  • shared (Optional[bool]) – A boolean, if set to True, space will be shared with other users having XYZ account, they will be able to read from the space using their own token. By default space will not be a shared space.

  • config (Optional[xyzspaces.config.default.XYZConfig]) – An object of class:XYZConfig, If not provied XYZ_TOKEN will be used from environment variable and other configurations will be used as defined in default_config.

Returns

A object of Space.

Return type

xyzspaces.spaces.Space

classmethod virtual(title, description=None, config=None, **kwargs)[source]

Create a new virtual-space.

Virtual-space references one or multiple spaces. A virtual-space is described by definition which references other existing spaces (the upstream spaces). Queries being done to a virtual-space will return the features of its upstream spaces combined. There are different predefined operations of how to combine the features of the upstream spaces. In order to use virtual spaces feature user needs to have HERE Data Hub paid plan. Plans can be found here: HERE Data Hub.

Parameters
  • title (str) – A string representing the title of the virtual-space.

  • description (Optional[str]) – A string representing a description of the virtual-space.

  • config (Optional[xyzspaces.config.default.XYZConfig]) – An object of class:XYZConfig, If not provied XYZ_TOKEN will be used from environment variable and other configurations will be used as defined in default_config.

  • kwargs (Dict[str, Dict]) – A dict for the operation to perform on upstream spaces.

Returns

An object of Space.

Return type

xyzspaces.spaces.Space

__init__(api=None, config=None)[source]

Instantiate a space object, optionally with authenticated api instance and custom base URL as server, server is required only for self-hosted Data Hub instances.

Parameters
__repr__()[source]

Return string representation of this instance.

property info

Space config information.

list(owner='me', include_rights=False)[source]

Return list of spaces for given owner with access rights if desired.

This does not modify the space object itself.

Parameters
  • owner (str) – A string representing the owner.

  • include_rights (bool) – A boolean. If set to True, the access rights for each space are included in the response.

Returns

A JSON object with list of spaces.

Return type

Dict

read(id)[source]

Read existing space object for given space ID.

Parameters

id (str) –

Return type

xyzspaces.spaces.Space

update(title=None, description=None, tagging_rules=None, schema=None, shared=None)[source]

Update space attributes.

This method updates title, description, schema, shared status or tagging rules of space, at least one of these params should have a non-default value to update the space.

Does update the space in the XYZ storage and this object mirroring it. Also apply the tags based on rules mentioned in tagging_rules dict.

Parameters
  • title (Optional[str]) – A string representing the title of the space.

  • description (Optional[str]) – A string representing a description of the space.

  • tagging_rules (Optional[Dict[str, str]]) – A dict where the key is the tag to be applied to all features matching the JSON-path expression being the value.

  • schema (Optional[str]) – JSON object or URL to be added as schema for space.

  • shared (Optional[bool]) – A boolean, if set to True, space will be shared with other users having XYZ account, they will be able to read from the space using their own token. If set to False space will be unshared.

Returns

A response from API.

Return type

Dict

Example:

>>> import os
>>> from xyzspaces import XYZ
>>> os.environ["XYZ_TOKEN"] = "XYZ_TOKEN"
>>> xyz = XYZ()
>>> space = xyz.spaces.new(title="new space", description="new space")
>>> tagging_rules = {"large": "$.features[?(@.properties.area>=500)]"}
>>> space.update(title="updated title",
...              description="updated description",
...              tagging_rules=tagging_rules)
delete()[source]

Delete this space object.

get_statistics()[source]

Get statistics for this space object.

Returns

A JSON object with some statistics about the specified space.

Return type

dict

search(tags=None, limit=None, params=None, selection=None, skip_cache=None, geo_dataframe=None, force_2d=None)[source]

Search features for this space object.

Parameters
  • tags (Optional[List[str]]) – A list of strings holding tag values.

  • limit (Optional[int]) – A max. number of features to return in the result.

  • params (Optional[dict]) –

    A dict to represent additional filter on features to be searched. Examples:

    • params={"p.name": "foo"} returns all features with a value of property name equal to foo.

    • params={"p.name!": "foo"} returns all features with a value of property name not qual to foo.

    • params={"p.count=gte": "10"} returns all features with a value of property count greater than or equal to 10.

    • params={"p.count=lte": "10"} returns all features with a value of property count less than or equal to 10.

    • params={"p.count=gt": "10"} returns all features with a value of property count greater than 10.

    • params={"p.count=lt": "10"} returns all features with a value of property count less than 10.

    • params={"p.name=cs": "bar"} returns all features with a value of property name which contains bar.

  • selection (Optional[List[str]]) – A list, only these properties will be returned in features result list.

  • skip_cache (Optional[bool]) – If set to True the response is not returned from cache. Default is False.

  • geo_dataframe (Optional[bool]) – A boolean if set to True searched features will be yield as single Geopandas Dataframe.

  • force_2d (Optional[bool]) – If set to True the features in the response will have only X and Y components, by default all x,y,z coordinates will be returned.

Yields

A Feature object by default. If param geo_dataframe is True then yields single Geopandas Dataframe.

Return type

Generator[geojson.feature.Feature, None, None]

iter_feature(limit=100, force_2d=None)[source]

Iterate over features in this space object.

Parameters
  • limit (int) – A max. number of features to return in the result.

  • force_2d (Optional[bool]) – If set to True the features in the response will have only X and Y components, by default all x,y,z coordinates will be returned.

Yields

A Feature object.

Return type

Generator[geojson.feature.Feature, None, None]

get_feature(feature_id, force_2d=None)[source]

Retrieve one GeoJSON feature with given ID from this space.

Parameters
  • feature_id (str) – Feature id which is to fetched.

  • force_2d (Optional[bool]) – If set to True the features in the response will have only X and Y components, by default all x,y,z coordinates will be returned.

Returns

A GeoJSON representing a feature with the specified feature ID inside the space.

Return type

geojson.base.GeoJSON

add_feature(data, feature_id=None, add_tags=None, remove_tags=None)[source]

Add one GeoJSON feature with given ID in this space.

Parameters
  • data (Union[geojson.base.GeoJSON, Dict]) – A JSON object describing the feature to be added.

  • feature_id (Optional[str]) – A string with the ID of the feature to be created.

  • add_tags (Optional[List[str]]) – A list of strings describing tags to be added to the feature.

  • remove_tags (Optional[List[str]]) – A list of strings describing tags to be removed from the feature.

Returns

A GeoJSON representing a feature.

Return type

geojson.base.GeoJSON

update_feature(feature_id, data, add_tags=None, remove_tags=None)[source]

Update one GeoJSON feature with given ID in this space.

Parameters
  • feature_id (str) – A string with the ID of the feature to be modified.

  • data (dict) – A JSON object describing the feature to be changed.

  • add_tags (Optional[List[str]]) – A list of strings describing tags to be added to the feature.

  • remove_tags (Optional[List[str]]) – A list of strings describing tags to be removed from the feature.

Returns

A GeoJSON representing a feature.

Return type

geojson.base.GeoJSON

delete_feature(feature_id)[source]

Delete one GeoJSON feature with given ID in this space.

Parameters

feature_id (str) – A string with the ID of the feature to be deleted.

Returns

An empty string if the operation was successful.

get_features(feature_ids, geo_dataframe=None, force_2d=None)[source]

Retrieve one GeoJSON feature with given ID from this space.

Parameters
  • feature_ids (List[str]) – A list of feature_ids.

  • geo_dataframe (Optional[bool]) – A boolean if set to True features will be returned as single Geopandas Dataframe.

  • force_2d (Optional[bool]) – If set to True the features in the response will have only X and Y components, by default all x,y,z coordinates will be returned.

Returns

A feature collection with all features inside the specified space. If param geo_dataframe is set to True then return features in single Geopandas Dataframe.

Return type

Union[geojson.base.GeoJSON, gpd.GeoDataFrame]

add_features(features, add_tags=None, remove_tags=None, features_size=2000, chunk_size=1, id_properties=None, mutate=True)[source]

Add GeoJSON features to this space.

As API has a limitation on the size of features, features are divided into chunks, and multiple processes will process those chunks. Each chunk has a number of features based on the value of features_size. Each process handles chunks based on the value of chunk_size.

Parameters
  • features (Union[geojson.base.GeoJSON, Dict]) – A JSON object describing one or more features to add.

  • add_tags (Optional[List[str]]) – A list of strings describing tags to be added to the features.

  • remove_tags (Optional[List[str]]) – A list of strings describing tags to be removed from the features.

  • features_size (int) – An int representing a number of features to upload at a time.

  • chunk_size (int) – Number of chunks each process to handle. The default value is 1, for a large number of features please use chunk_size greater than 1 to get better results in terms of performance.

  • id_properties (Optional[List[str]]) – List of properties name from which id to be generated if id does not exists for a feature.

  • mutate (Optional[bool]) – If True will update the existing features object passed, this will prevent making copy of the features object which may help to improving performance.

Returns

A GeoJSON representing a feature collection.

Return type

geojson.base.GeoJSON

_upload_features(features, ids_map, add_tags=None, remove_tags=None, id_properties=None)[source]
Parameters
  • add_tags (Optional[List[str]]) –

  • remove_tags (Optional[List[str]]) –

  • id_properties (Optional[List[str]]) –

_process_features(features, id_properties, ids_map)[source]
_gen_id_from_properties(feature, id_properties)[source]
update_features(features, add_tags=None, remove_tags=None)[source]

Update GeoJSON features in this space.

Parameters
  • features (geojson.base.GeoJSON) – A JSON object describing one or more features to modify.

  • add_tags (Optional[List[str]]) – A list of strings describing tags to be added to the features.

  • remove_tags (Optional[List[str]]) – A list of strings describing tags to be removed from the features.

Returns

A GeoJSON representing a feature collection.

Return type

geojson.base.GeoJSON

delete_features(feature_ids, tags=None)[source]

Delete GeoJSON features in this space.

Parameters
  • feature_ids (List[str]) – A list of feature IDs to delete.

  • tags (Optional[List[str]]) – A list of strings describing tags the features to be deleted must have.

Returns

A response from API.

features_in_bbox(bbox, tags=None, clip=None, limit=None, params=None, selection=None, skip_cache=None, clustering=None, clustering_params=None, geo_dataframe=None, force_2d=None)[source]

Get features inside some given bounding box.

Parameters
  • bbox (List[Union[float, int]]) – A list of four numbers representing the West, South, East and North margins, respectively, of the bounding box.

  • tags (Optional[List[str]]) – A list of strings holding tag values.

  • clip (Optional[bool]) – A Boolean indicating if the result should be clipped (default: False).

  • limit (Optional[int]) – A max. number of features to return in the result.

  • params (Optional[dict]) –

    A dict to represent additional filter on features to be searched. Examples:

    • params={"p.name": "foo"} returns all features with a value of property name equal to foo.

    • params={"p.name!": "foo"} returns all features with a value of property name not qual to foo.

    • params={"p.count=gte": "10"} returns all features with a value of property count greater than or equal to 10.

    • params={"p.count=lte": "10"} returns all features with a value of property count less than or equal to 10.

    • params={"p.count=gt": "10"} returns all features with a value of property count greater than 10.

    • params={"p.count=lt": "10"} returns all features with a value of property count less than 10.

    • params={"p.name=cs": "bar"} returns all features with a value of property name which contains bar.

  • selection (Optional[List[str]]) – A list, only these properties will be returned in features result list.

  • skip_cache (Optional[bool]) – If set to True the response is not returned from cache. Default is False.

  • clustering (Optional[str]) –

  • clustering_params (Optional[dict]) –

  • geo_dataframe (Optional[bool]) – A boolean if set to True searched features will be yield as single Geopandas Dataframe.

  • force_2d (Optional[bool]) – If set to True the features in the response will have only X and Y components, by default all x,y,z coordinates will be returned.

Yields

A Feature object by default. If param geo_dataframe is True then yields single Geopandas Dataframe.

Return type

Generator[geojson.feature.Feature, None, None]

features_in_tile(tile_type, tile_id, tags=None, clip=None, params=None, selection=None, skip_cache=None, clustering=None, clustering_params=None, margin=None, limit=None, geo_dataframe=None, force_2d=None, mode=None, viz_sampling=None)[source]

Get features in tile.

Parameters
  • tile_type (str) – A string with the name of a tile type, one of “quadkeys”, “web”, “tms” or “here”. See below.

  • tile_id (str) – A string holding a valid tile ID according to the specified tile_type.

  • tags (Optional[List[str]]) – A list of strings holding tag values.

  • clip (Optional[bool]) – A Boolean indicating if the result should be clipped (default: False).

  • params (Optional[dict]) –

    A dict to represent additional filter on features to be searched. Examples:

    • params={"p.name": "foo"} returns all features with a value of property name equal to foo.

    • params={"p.name!": "foo"} returns all features with a value of property name not qual to foo.

    • params={"p.count=gte": "10"} returns all features with a value of property count greater than or equal to 10.

    • params={"p.count=lte": "10"} returns all features with a value of property count less than or equal to 10.

    • params={"p.count=gt": "10"} returns all features with a value of property count greater than 10.

    • params={"p.count=lt": "10"} returns all features with a value of property count less than 10.

    • params={"p.name=cs": "bar"} returns all features with a value of property name which contains bar.

  • selection (Optional[List[str]]) – A list, only these properties will be returned in features result list.

  • skip_cache (Optional[bool]) – If set to True the response is not returned from cache. Default is False.

  • clustering (Optional[str]) –

  • clustering_params (Optional[dict]) –

  • margin (Optional[int]) –

  • limit (Optional[int]) – A max. number of features to return in the result.

  • geo_dataframe (Optional[bool]) – A boolean if set to True searched features will be yield as single Geopandas Dataframe.

  • force_2d (Optional[bool]) – If set to True the features in the response will have only X and Y components, by default all x,y,z coordinates will be returned.

  • mode (Optional[str]) – A string to indicate how to optimize the resultset and geometries for display. Allowed values are raw and viz.

  • viz_sampling (Optional[str]) – A string to indicate the sampling strength in case of mode=viz. Allowed values are: low, med, high, and off, default: med.

Yields

A Feature object by default. If param geo_dataframe is True then yields single Geopandas Dataframe.

Raises

ValueError – If tile_type is invalid, valid tile_types are quadkeys, web, tms and here.

Return type

Generator[geojson.feature.Feature, None, None]

Get features with radius search.

Parameters
  • lat (Optional[float]) – A float in WGS’84 decimal degree (-90 to +90) of the center Point.

  • lon (Optional[float]) – A float in WGS’84 decimal degree (-180 to +180) of the center Point.

  • ref_space_id (Optional[str]) – A string as alternative for defining center coordinates, it is possible to reference a geometry in a space, hence it is needed to provide the ref_space_id where the referenced feature is stored. Always to use in combination with ref_feature_id.

  • ref_feature_id (Optional[str]) – A string as unique identifier of a feature in the referenced space. The geometry of that feature gets used for the spatial query. Always to use in combination with ref_space_id.

  • radius (Optional[int]) – An int in meter which defines the diameter of the search request.

  • tags (Optional[List[str]]) – A list of strings holding tag values.

  • limit (Optional[int]) – A max. number of features to return in the result.

  • params (Optional[dict]) –

    A dict to represent additional filter on features to be searched. Examples:

    • params={"p.name": "foo"} returns all features with a value of property name equal to foo.

    • params={"p.name!": "foo"} returns all features with a value of property name not qual to foo.

    • params={"p.count=gte": "10"} returns all features with a value of property count greater than or equal to 10.

    • params={"p.count=lte": "10"} returns all features with a value of property count less than or equal to 10.

    • params={"p.count=gt": "10"} returns all features with a value of property count greater than 10.

    • params={"p.count=lt": "10"} returns all features with a value of property count less than 10.

    • params={"p.name=cs": "bar"} returns all features with a value of property name which contains bar.

  • selection (Optional[List[str]]) – A list of strings holding properties values.

  • skip_cache (Optional[bool]) – A Boolean if set to True the response is not returned from cache.

  • geo_dataframe (Optional[bool]) – A boolean if set to True searched features will be yield as single Geopandas Dataframe.

  • force_2d (Optional[bool]) – If set to True the features in the response will have only X and Y components, by default all x,y,z coordinates will be returned.

Yields

A Feature object by default. If param geo_dataframe is True then yields single Geopandas Dataframe.

Return type

Generator[geojson.feature.Feature, None, None]

spatial_search_geometry(data, radius=None, tags=None, limit=None, params=None, selection=None, skip_cache=None, divide=False, cell_width=None, units='m', chunk_size=1, geo_dataframe=None, force_2d=None)[source]

Search features which intersect the provided geometry.

Parameters
  • data (dict) – A JSON object which is getting used for the spatial search.

  • radius (Optional[int]) – An int which defines the diameter(meters) of the search request.

  • tags (Optional[List[str]]) – A list of strings holding tag values.

  • limit (Optional[int]) – A max. number of features to return in the result.

  • params (Optional[dict]) –

    A dict to represent additional filter on features to be searched. Examples:

    • params={"p.name": "foo"} returns all features with a value of property name equal to foo.

    • params={"p.name!": "foo"} returns all features with a value of property name not qual to foo.

    • params={"p.count=gte": "10"} returns all features with a value of property count greater than or equal to 10.

    • params={"p.count=lte": "10"} returns all features with a value of property count less than or equal to 10.

    • params={"p.count=gt": "10"} returns all features with a value of property count greater than 10.

    • params={"p.count=lt": "10"} returns all features with a value of property count less than 10.

    • params={"p.name=cs": "bar"} returns all features with a value of property name which contains bar.

  • selection (Optional[List[str]]) – A list of strings holding properties values.

  • skip_cache (Optional[bool]) – A Boolean if set to True the response is not returned from cache.

  • divide (Optional[bool]) – To divide geometry if the resultant features count is large.

  • cell_width (Optional[float]) – Width of each cell in which geometry is to be divided in units specified, default values is meters.

  • units (Optional[str]) – Unit for cell_width please refer, https://github.com/omanges/turfpy/blob/master/measurements.md#units-type

  • chunk_size (int) – Number of chunks each process to handle. The default value is 1, for a large number of features please use chunk_size greater than 1 to get better results in terms of performance.

  • geo_dataframe (Optional[bool]) – A boolean if set to True searched features will be yield as single Geopandas Dataframe.

  • force_2d (Optional[bool]) – If set to True the features in the response will have only X and Y components, by default all x,y,z coordinates will be returned.

Yields

A Feature object by default. If param geo_dataframe is True then yields as single Geopandas Dataframe.

Return type

Generator[geojson.feature.Feature, None, None]

_spatial_search_geometry(data, feature_list, radius=None, tags=None, limit=None, params=None, selection=None, skip_cache=None, force_2d=None)[source]
Parameters
  • data (dict) –

  • feature_list (List[dict]) –

  • radius (Optional[int]) –

  • tags (Optional[List[str]]) –

  • limit (Optional[int]) –

  • params (Optional[dict]) –

  • selection (Optional[List[str]]) –

  • skip_cache (Optional[bool]) –

  • force_2d (Optional[bool]) –

add_features_geojson(path, encoding='utf-8', features_size=2000, chunk_size=1)[source]

Add features in space from a GeoJSON file.

As API has a limitation on the size of features, features are divided into chunks, and multiple processes will process those chunks. Each chunk has a number of features based on the value of features_size. Each process handles chunks based on the value of chunk_size.

Parameters
  • path (str) – Path to the GeoJSON file.

  • encoding (str) – A string to represent the type of encoding.

  • features_size (int) – An int representing a number of features to upload at a time.

  • chunk_size (int) – Number of chunks for each process to handle. The default value is 1, for a large number of features please use chunk_size greater than 1.

add_features_csv(path, lon_col, lat_col, id_col='', alt_col='', delimiter=',', add_tags=None, remove_tags=None, features_size=2000, chunk_size=1, id_properties=None)[source]

Add features in space from a csv file.

As API has a limitation on the size of features, features are divided into chunks, and multiple processes will process those chunks. Each chunk has a number of features based on the value of features_size. Each process handles chunks based on the value of chunk_size.

Parameters
  • path (str) – Path to csv file.

  • lon_col (str) – Name of the column for longitude coordinates.

  • lat_col (str) – Name of the column for latitude coordinates.

  • id_col (str) – Name of the column for feature id’s.

  • alt_col (str) – Name of the column for altitude, if not provided altitudes with default value 0.0 will be added.

  • delimiter (str) – delimiter which should be used to process the csv file.

  • add_tags (Optional[List[str]]) – A list of strings describing tags to be added to the features.

  • remove_tags (Optional[List[str]]) – A list of strings describing tags to be removed from the features.

  • features_size (int) – An int representing a number of features to upload at a time.

  • chunk_size (int) – Number of chunks each process to handle. The default value is 1, for a large number of features please use chunk_size greater than 1 to get better results in terms of performance.

  • id_properties (Optional[List[str]]) – List of properties name from which id to be generated if id does not exists for a feature.

Raises

Exception – If values of params lat_col, lon_col, id_col do not match with column names in csv file.

cluster(clustering, clustering_params=None)[source]

Apply clustering algorithm for the space data.

Parameters
Returns

GeoJSON.

Raises

Exception – If bounding box is not present in space statistics.

Return type

dict

Example:

>>> import os
>>> from xyzspaces import XYZ
>>> os.environ["XYZ_TOKEN"] = "MY-XYZ-TOKEN"
>>> xyz = XYZ()
>>> space = xyz.spaces.from_id(space_id="existing-space-id")
>>> space.cluster(clustering="hexbin")
isshared()[source]

Return the shared status of the space.

Returns

A boolean to indicate shared status of the space.

Return type

bool

add_features_shapefile(path, features_size=2000, chunk_size=1, encoding='utf-8')[source]

Upload shapefile to the space.

Parameters
  • path (str) – A string representing full path of the shapefile. For zipped shapefile prepend zip:// before path of shapefile.

  • features_size (int) – An int representing a number of features to upload at a time.

  • chunk_size (int) – Number of chunks for each process to handle. The default value is 1, for a large number of features please use chunk_size greater than 1.

  • encoding (str) – A string to represent the type of encoding.

Example:

>>> import os
>>> from xyzspaces import XYZ
>>> os.environ["XYZ_TOKEN"] = "MY-XYZ-TOKEN"
>>> xyz = XYZ()
>>> space = xyz.spaces.from_id(space_id="existing-space-id")
>>> space.add_features_shapefile(path="shapefile.shp")
add_features_wkt(path)[source]

To upload data from wkt file to a space

Parameters

path (str) – Path to wkt file

add_features_gpx(path, features_size=2000, chunk_size=1)[source]

Upload data from gpx file to the space.

Parameters
  • path (str) – A string representing full path of the gpx file.

  • features_size (int) – An int representing a number of features to upload at a time.

  • chunk_size (int) – Number of chunks for each process to handle. The default value is 1, for a large number of features please use chunk_size greater than 1.

add_features_kml(path, features_size=2000, chunk_size=1)[source]

To upload data from kml file to a space

Parameters
  • path (str) – Path to kml file

  • features_size (int) – An int representing a number of features to upload at a time.

  • chunk_size (int) – Number of chunks for each process to handle. The default value is 1, for a large number of features please use chunk_size greater than 1.

add_features_geobuf(path, features_size=2000, chunk_size=1)[source]

To upload data from geobuff file to a space.

Parameters
  • path (str) – Path to geobuff file.

  • features_size (int) – An int representing a number of features to upload at a time.

  • chunk_size (int) – Number of chunks for each process to handle. The default value is 1, for a large number of features please use chunk_size greater than 1.

add_features_geopandas(data, features_size=2000, chunk_size=1)[source]

Add features from GeoPandas dataframe to a space.

Parameters
  • data (gpd.GeoDataFrame) – GeoPandas dataframe to be uploaded

  • features_size (int) – The number of features to upload at a time.

  • chunk_size (int) – Number of chunks for each process to handle. The default value is 1, for a large number of features please use chunk_size greater than 1.

clone(space_id=None, chunks=1000)[source]

Copy current space data into a newly created or into an existing space.

Parameters
  • space_id (Optional[str]) – space id into which to copy data, if not provided will create a new space and copy the data.

  • chunks (int) – A max. number of features to read in a single iteration while iterating over the source space.

Returns

The cloned Space Object

browse()[source]

Inspect and analyze space using Data Hub Space Invader. More information about Data Hub Space Invader can be found here.