Skip to content

heremaps/here-workspace-examples-java-scala

Repository files navigation

HERE Workspace Examples for Java and Scala Developers

Introduction

This repository holds a series of Java and Scala examples, that demonstrate typical use cases for the HERE Workspace – a part of HERE platform. HERE Workspace is an environment to enrich, transform and deploy location-centric data. Go to HERE platform to learn more. If you are interested in knowing what the platform offers specifically for Java and Scala developers, visit this page.

Prerequisites

In order to run the examples, you need to have a HERE Workspace account. If you do not have an account, navigate to Pricing and Plans to apply for a free trial.

You need to get access credentials and prepare your environment. For more information on how to prepare your environment, see our guide for Java and Scala developers.

Code Examples

Processing Sensor Data

The following documents illustrate two use cases around inferring real-world situations from sensor data. Batch processing is useful when it is important to aggregate sensor input over a longer time period (that is hours and longer). Stream processing is recommended for time-critical use cases, like informing about road hazards.

Name Description Source Labels / Topics
Infer Stop Sign Locations from Automotive Sensor Observations The example takes archived sensor data, clusters and path-matches it in a distributed Spark batch environment, and creates a map layer with stop signs at the output. Scala Location Library, Data Client Library, Spark, Batch, GeoJSON, SDII
Stream Path Matcher The example stands for a similar but time critical use case. It does not hash out anything but map matching. It takes sensor data from a stream, map-matches it in Flink, and puts on an output stream. Java Location Library, Data Client Library, Flink, Stream, SDII

Incremental Map Processing & Validation

For more information, see a use case illustration of keeping a client map up to date with incremental processing.

Name Description Source Labels / Topics
Geometry Lifter An application that takes level 12 partitions of road topology and geometry and aggregates them to higher-level (i.e. bigger) partitions. Java / Scala Data Processing Library, Spark, Batch, Protobuf, HERE Map Content
Pedestrian Topologies Extraction to GeoJSON Topologies, accessible by pedestrians, are selected based on the segment attributes and then are transformed into GeoJSON file format and stored in a new catalog. Java / Scala Data Processing Library, Spark, Batch, GeoJSON, HERE Map Content
Pedestrian Topologies Extraction to Protobuf Topologies, accessible by pedestrians, are selected based on the segment attributes and then are transformed to a newly created proto schema format and stored in a new catalog layer that follows that schema. Java / Scala Data Processing Library, Spark, Batch, Protobuf, HERE Map Content
Statistics creation across multiple processing runs with stateful processing The application counts how often the node cardinality of the topology changes in each partition. Java / Scala Data Processing Library, Spark, Batch, JSON, HERE Map Content
Here Map Content Diff-Tool An application to compare the content of two different versions of an input catalog. Java / Scala Data Processing Library, Spark, Batch, JSON, HERE Map Content
Here Map Content Validation An application to validate road topology and geometry content against a set of acceptance criteria using scalatest. Scala Data Processing Library, Spark, Batch, JSON, HERE Map Content

Archiving Stream Data

The HERE Workspace allows you to retain stream data for longer periods, which allows you to later query and process the retained data for non-real-time use cases. For more information, see Data Archiving Library Developer Guide.

Name Description Source Labels / Topics
Archiving SDII stream data in Avro The example shows how to use the Data Archiving Library to quickly develop an archiving solution that archives data in Avro format. Java Data Archiving Library, Flink, Stream, Avro, SDII
Archiving SDII stream data in Parquet The example shows how to use the Data Archiving Library to quickly develop an archiving solution that archives data in Parquet format. Java Data Archiving Library, Flink, Stream, Parquet, SDII
Archiving SENSORIS stream data in Protobuf The example shows how to use the Data Archiving Library to quickly develop an archiving solution that archives SENSORIS data in Protobuf format. Java Data Archiving Library, Flink, Stream, SENSORIS, Protobuf

Compacting Index Data

The HERE Workspace allows you to compact data files with the same index attribute values into one or more files based on the configuration. Compaction reduces the index layer storage cost, improves query performance, and makes subsequent data processing more efficient. For more information, see Index Compaction Library Developer Guide.

Name Description Source Labels / Topics
Compacting Parquet format indexed data The example shows how to use the Index Compaction Library to quickly develop a compaction application that compacts parquet format data. Java Index Compaction Library, Spark, Batch, Parquet, SDII
Compacting Protobuf format indexed data The example shows how to use the Index Compaction Library to quickly develop a compaction application that compacts protobuf format data. Java Index Compaction Library, Spark, Batch, Parquet, SDII

Small Examples Showing Usage of Location Library

The following examples demonstrate how to use the Location Library.

Name Description Source Labels / Topics
Point Matching Example Takes probe points and matches each one against the closest geometry without consider the path. Java / Scala Location Library, GeoJSON, CSV
Traversing the Graph Shows how to create a traversable graph from the HERE Optimized Map for Location Library catalog. Java / Scala Location Library, GeoJSON
Most Probable Path Navigates the graph along the most probable path based on simple assumptions like try to stay on same functional class. Java / Scala Location Library, GeoJSON
Path Matching Example Matches path probe points against the graph. Java / Scala Location Library, GeoJSON, CSV
Path Matching with Restrictions Matches path probe points against a graph that excludes segments that are not accessible by taxis. Scala Location Library, GeoJSON, CSV
Turn Restrictions Shows how to check if turns on a road network are restricted or not. Java / Scala Location Library, GeoJSON
Generic Range Based Attributes Shows how to load a generic attribute that is not available in the HERE Optimized Map for Location Library using a Vertex reference as input. Java / Scala Location Library
Path Matching Sparse Probe Data Shows how to match sparse path points against the graph by traversing it using the most probable path assumptions. Java / Scala Location Library, GeoJSON, CSV
Converting References from HERE Optimized Map for Location Library to HERE Map Content Converts Vertex references to Topology Segments and vice versa. Java / Scala Location Library, HERE Map Content
Converting References from TPEG2 to its Binary Representation Shows how to read an OpenLR location reference that has been written in the TPEG2 XML encoding and convert it to its binary representation. Java / Scala Location Library, TPEG2, OpenLR
Extracting TPEG2 Document Demonstrates how to load a TPEG2 document and extract its parts. Java / Scala Location Library, TPEG2
Creating and Resolving TMC Reference Searches for a well-known vertex that is covered by TMC to define the input location. Java / Scala Location Library, TMC
Resolving TMC References in RTTI Message Demonstrates how TMC references in Real Time Traffic Incident (RTTI) messages can be converted to TPEG2 TMC references, and how the location-referencing module can be used to resolve those references. Java / Scala Location Library, TPEG2
Creating OpenLR Reference from Road Segments Transforms a path given as segment references in HERE Map Content to OpenLR reference. Java / Scala Location Library, HERE Map Content, OpenLR
Resolving OpenLR Reference from Road Segments Shows how to take an OpenLR reference given in XML and resolve this reference to segments in HERE Map Content Java / Scala Location Library, HERE Map Content, OpenLR
Functional Class for a Vertex Shows how you can get the functional class for a vertex. Java / Scala Location Library, GeoJSON
ADAS Curvature Attribute Shows how to fetch and use ADAS attributes in the HERE Optimized Map for Location Library using a Vertex or an Edge reference. Java / Scala Location Library, GeoJSON

License

Copyright (C) 2017-2024 HERE Europe B.V.

Unless otherwise noted in LICENSE files, source code files for specific files or directories, the LICENSE in the root applies to all content in this repository.