How to use graph properties
How to use graph properties
Vertices and edges of the routing graph can have additional information associated with them in the form of properties.
Vertex properties
Vertices can have properties, such as a speed limit, accessibility restrictions for a particular type of vehicle, or a road geometry. These properties can apply to a whole vertex or only to sections of a vertex.
The Location Library provides two interfaces to access these properties:
- PropertyMap to query the value of a property for the whole vertex
- RangeBasedPropertyMap to query the value of a property at a given position within the vertex
Note that a RangeBasedPropertyMap is a PropertyMap. For a given vertex, a
RangeBasedPropertyMap returns a sequence of sections, also called ranges,
and the property values on these sections.
Properties and catalogs
The attribute layers of HERE Map Content store properties for road segments (or sections of road segments). However, retrieving the value of a property for a road segment is complex and expensive due to the underlying Topology Attribution Referencing Model.
Instead of using an attribute layer of HERE Map Content directly, the Location
Library creates an instance of a PropertyMap (or of a RangeBasedPropertyMap)
from the attribute layer of HERE Map Content. The way this instance stores the
properties allows for efficient access.
Creating the PropertyMap from an attribute layer of a catalog such as HERE Map
Content in a running application is called on-the-fly compilation. You can use
the method
PropertyMaps.rangeBasedProperty
to compile a PropertyMap on-the-fly lazily: This method immediately returns an
instance of RangeBasedPropertyMap but the first access to a property takes
longer since the on-the-fly compilation takes place only then.
If available, you can efficiently access the properties from the catalog
Optimized Map for Location Library.
The
PropertyMaps
factory provides PropertyMaps that lazily load properties from this catalog.
Edge properties
As mentioned in the section The Routing Graph, an edge represents a possible transition from one vertex to another. Edges can have properties too. For example, to determine whether the turn from one road to another is restricted, you can use a PropertyMap with the Edge as a key to query the value of the edge between the corresponding vertices.
Updated 22 days ago