OLR offers a number of different location reference types. These types are embedded into an OpenLRLocationReference.
The Location Library offers a unifying interface/trait for these locations: ReferencingLocation.
The available types and their mappings in the Location Library are the following:
OLR Type
Location Library Type
GeoCoordinateLocationReference
GeoCoordinateLocation
RectangleLocationReference
RectangleLocation
GridLocationReference
GridLocation
CircleLocationReference
CircleLocation
PolygonLocationReference
PolygonLocation
LinearLocationReference
LinearLocation
ClosedLinearLocationReference
ClosedLinearLocation
PointAlongLineLocationReference
AccessPoint
POIWithAccessPointLocationReference
PointOfInterest
Note: TISA OLR vs TomTom OpenLR
The difference between TISA OLR and TomTom OpenLR relates to the history of the specification: TomTom submitted the OpenLR specification to TISA. It was adopted in a slightly modified form by TISA as part 22 of the TISA SP14006 (TPEG2) standard series. The TISA standard was later in turn adopted without modifications as ISO 21219-22:2017.
In the TISA standard the abbreviation OLR (OpenLR Location Referencing) is used to describe this location referencing method.
As part of the adoption by TISA the standard was modified to be in line with the conventions and rules used in the TPEG2 series of standards. The concepts and the information in the references are the same, but the TISA version uses some different field names and the binary and XML representations are slightly different from those found in the TomTom OpenLR version. This means there are now two versions of the standard that are not interoperable at the binary or XML level.
The implementation in the Location Library follows the TISA OLR (and thus also ISO 21219-22:2017) specification for marshalling and unmarshalling of OLR References. Whenever we use the terms OLR or OpenLR we refer to the TISA OLR version of the standard.
The snippets throughout this section assume that you have the following imports in scope:
The simplest way to create and resolve OLR references is to use, respectively, the LocationReferenceCreator and LocationReferenceResolver, which is independent of a location type. The following snippet shows how to use these abstractions:
If you are working only with a single type of reference, it might be more convenient to use creators and resolvers for that particular type. Some of the reference types are not necessarily associated to a map, and therefore the factory methods for the corresponding creators and resolvers don't require a catalog.
OLR Reference Types
The reference types provided by OLR fall into two categories. There are those references that refer to locations that are described by geometric shapes given in terms of geocoordinates. And, there are those references that refer to locations in or in relation to the road network.
The following reference types are backed by geometric shapes:
Geocoordinate
Circle
Rectangle
Grid
Polygon
The following reference types are bound to the road network:
Linear location
Closed linear location
Point along a line
Point of Interest with access point
Geocoordinate Location Reference
A geocoordinate location reference is a simple reference type that refers to a single point in the map, described using WGS84 geocoordinates. This type is not bound to the road network, and can be used to indicate exact locations.
Figure 1. Visualization of a Geocoordinate Location Reference
Create and resolve geocoordinates:
Scala
Java
val geoCoordinate = GeoCoordinateLocation(52.521864,13.413306)val reference: GeoCoordinateLocationReference =
LocationReferenceCreators.olrGeoCoordinate.create(geoCoordinate)
println(LocationReferenceResolvers.olrGeoCoordinate.resolve(reference))
A circle location reference describes a circle in terms of geocoordinates that define the center of the circle, and a radius. Real-world examples include a Wi-Fi hotspot with its signal range, or the center and radius used with a proximity search. This type is also not bound to the road network.
Figure 2. Visualization of a Circle Location Reference
Create and resolve circle references:
Scala
Java
val circle = CircleLocation(52.521864,13.413306,1000.0)val reference: CircleLocationReference = LocationReferenceCreators.olrCircle.create(circle)
println(LocationReferenceResolvers.olrCircle.resolve(reference))
finalCircleLocation circle =newCircleLocation(52.521864,13.413306,1000.0);finalCircleLocationReference reference =LocationReferenceCreators.olrCircle().create(circle);System.out.println(LocationReferenceResolvers.olrCircle().resolve(reference));
Rectangle Location Reference
A rectangle location reference is defined in terms of the geocoordinates of the southwesternmost and northeasternmost corners of a rectangle. It can be used to create references of rectangular areas, like a box containing a city. This type is not bound to the road network.
Figure 3. Visualization of a Rectangle Location Reference
Create and resolve rectangle references:
Scala
Java
val boundingBox = RectangleLocation(52.576042,52.422035,13.502779,13.194462)val reference: RectangleLocationReference =
LocationReferenceCreators.olrRectangle.create(boundingBox)
println(LocationReferenceResolvers.olrRectangle.resolve(reference))
A grid location reference is similar to a rectangle location reference. It defines a base rectangle that is multiplied to the north by the the number of rows and to the east by the number of columns. The cells in the grid can, for instance, be used to encode local weather information, such as precipitation rates.
Figure 4. Visualization of a Grid Location Reference
Polygon Location Reference
A polygon location reference defines a non-intersecting shape represented by a sequence of geocoordinate pairs. Examples for the use of polygon location references are low emission zones, an area with heavy traffic, or the geometry of a building.
Figure 5. Visualization of a Polygon Location Reference
Linear location references can refer to arbitrary paths in the road network. Another referencing scheme that supports important paths in the road network is TMC. However, OLR is more flexible, because it does not depend on any sort of predefined tables. This allows OLR linear location references to be used to refer to virtually any part of the road network.
Figure 6. Visualization of a Linear Location Reference