Using GeoPandas

To use the HERE GeoPandas Adapter, initialize the platform object with the GeoPandasAdapter as shown below:

from here.platform import Platform
from here.geopandas_adapter.GeoPandasAdapter import GeoPandasAdapter

platform = Platform(adapter=GeoPandasAdapter())
sdii_catalog = platform.get_catalog("hrn:here:data::olp-here:olp-sdii-sample-berlin-2")
weather_catalog = platform.get_catalog('hrn:here:data::olp-here:live-weather-eu')

versioned_layer = sdii_catalog.get_layer("sample-versioned-layer")
volatile_layer = weather_catalog.get_layer("latest-data")
index_layer = sdii_catalog.get_layer("sample-index-layer")
stream_layer = sdii_catalog.get_layer("sample-streaming-layer")

Get Partitions Metadata

Get Partitions Metadata from Versioned Layer in a Dataframe

get_partitions_metadata parameters:

partition_ids – The list of partition IDs. If not specified, all partitions are returned

version – the catalog version. If not specified, the latest catalog version will be used

part – indicates which part of the layer shall be queried. If not specified, return all the partitions. It cannot be specified together with partition_ids

additional_fields – Additional metadata fields dataSize, checksum, compressedDataSize, crc. By default considers all.

Example

partition_df = versioned_layer.get_partitions_metadata(partition_ids=["377893751"], version=sdii_catalog.latest_version())

partition_df.head()

Get Partitions Metadata from Volatile Layer in a Dataframe

get_partitions_metadata parameters:

partition_ids – The list of partition IDs. If not specified, all partitions are read.

additional_fields – Additional metadata fields dataSize, checksum, compressedDataSize, crc. By default considers all.

Example

partition_df = volatile_layer.get_partitions_metadata(partition_ids=["81150"])
partition_df.head()

Get Partitions Metadata from Index Layer in a Dataframe

get_partitions_metadata parameters:

query – the RSQL query

Example

partition_df = index_layer.get_partitions_metadata(query="hour_from=ge=10")
partition_df.head()

Get Partitions Metadata from Stream Layer in a Dataframe

get_stream_metadata parameters:

subscription – the subscription from where to consume the data

update_offsets – automatically update offsets so next read starts at the end of the last consumed message.

Example

subscription = stream_layer.subscribe()
partition_df = stream_layer.get_stream_metadata(subscription=subscription)
partition_df.head()

Read Partitions

Read Partitions/Data from Versioned Layer in a Dataframe

read_partitions parameters:

partition_ids – The list of partition IDs. If not specified, all partitions are read.

version – the catalog version. If not specified, the latest catalog version will be used.

part – indicates which part of the layer shall be queried. If not specified, return all the partitions. It cannot be specified together with partition_ids

decode – whether to decode the data or return raw bytes.

kwargs –additional params for respective adapters For GeoPandasAdapter,For Protobuf data, geometry_column: an optional param for name of geometry column paths: an optional param for a list of schema field paths for protobuf dataFor Parquet data, engine: an optional param for type of engine used to parse the parquet data,values allowed are [auto, fastparquet, pyarrow]. If ‘auto’, then the behavior is to try ‘pyarrow’, falling back to ‘fastparquet’ if ‘ArrowNotImplementedError’ is raised. columns: an optional param indicating only these columns to be read from the parquet file.

Example

partition_df = versioned_layer.read_partitions(partition_ids=["377893751"], version=sdii_catalog.latest_version())

partition_df.head()

Read Partitions/Data from Volatile Layer in a Dataframe

read_partitions parameters:

partition_ids – The list of partition IDs. If not specified, all partitions are read.

decode – whether to decode the data or return raw bytes

kwargs –additional params for respective adapters For GeoPandasAdapter,For Protobuf data, geometry_column: an optional param for name of geometry column paths: an optional param for a list of schema field paths for protobuf dataFor Parquet data, engine: an optional param for type of engine used to parse the parquet data,values allowed are [auto, fastparquet, pyarrow]. If ‘auto’, then the behavior is to try ‘pyarrow’, falling back to ‘fastparquet’ if ‘ArrowNotImplementedError’ is raised. columns: an optional param indicating only these columns to be read from the parquet file.

Example

partition_df = volatile_layer.read_partitions(partition_ids=["81150"])
partition_df.head()

Read Partitions/Data from Index Layer in a Dataframe

read_partitions parameters:

query – the RSQL query

decode – whether to decode the data or return raw bytes

kwargs –additional params for respective adapters For GeoPandasAdapter,For Protobuf data, geometry_column: an optional param for name of geometry column paths: an optional param for a list of schema field paths for protobuf dataFor Parquet data, engine: an optional param for type of engine used to parse the parquet data, values allowed are [auto, fastparquet, pyarrow]. If ‘auto’, then the behavior is to try ‘pyarrow’, falling back to ‘fastparquet’ if ‘ArrowNotImplementedError’ is raised. columns: an optional param indicating only these columns to be read from the parquet file.

Example

partition_df = index_layer.read_partitions(query="hour_from=ge=10")
partition_df.head()

Read Partitions/Data from Stream Layer in a Dataframe

read_stream_data parameters:

subscription – the subscription from where to consume the data

update_offsets – automatically update offset so next read starts at the end of the last message.

decode – whether to decode the data or return raw bytes

kwargs –additional params for respective adapters For GeoPandasAdapter,For Protobuf data, geometry_column: an optional param for name of geometry column paths: an optional param for a list of schema field paths for protobuf dataFor Parquet data, engine: an optional param for type of engine used to parse the parquet data,values allowed are [auto, fastparquet, pyarrow]. If ‘auto’, then the behavior is to try ‘pyarrow’, falling back to ‘fastparquet’ if ‘ArrowNotImplementedError’ is raised. columns: an optional param indicating only these columns to be read from the parquet file.

Example

subscription = stream_layer.subscribe()
paths = ["path.positionEstimate.timeStampUTC_ms",
          "path.positionEstimate.latitude_deg",
          "path.positionEstimate.longitude_deg",
          "path.positionEstimate.heading_deg",
          "path.positionEstimate.speed_mps"
         ]
partition_df = stream_layer.read_stream_data(subscription=subscription, paths=paths)
partition_df.head()

results matching ""

    No results matching ""