Working with OLR

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:

The available types and their mappings in 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:

val location = GeoCoordinateLocation(52.521864, 13.413306)

val reference: OpenLRLocationReference =
  LocationReferenceCreators.olr(optimizedMap, cacheManager).create(location)

println(LocationReferenceResolvers.olr(optimizedMap, cacheManager).resolve(reference))
final ReferencingLocation location = new GeoCoordinateLocation(52.521864, 13.413306);

final OpenLRLocationReference reference =
    LocationReferenceCreators.olr(optimizedMap, cacheManager).create(location);

    LocationReferenceResolvers.olr(optimizedMap, cacheManager).resolve(reference));

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.

Visualization of a Geocoordinate Location Reference
Figure 1. Visualization of a Geocoordinate Location Reference

Create and resolve geocoordinates:

val geoCoordinate = GeoCoordinateLocation(52.521864, 13.413306)

val reference: GeoCoordinateLocationReference =
final GeoCoordinateLocation geoCoordinate = new GeoCoordinateLocation(52.521864, 13.413306);

final GeoCoordinateLocationReference reference =

Circle Location 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.

Visualization of a Circle Location Reference
Figure 2. Visualization of a Circle Location Reference

Create and resolve circle references:

val circle = CircleLocation(52.521864, 13.413306, 1000.0)

val reference: CircleLocationReference = LocationReferenceCreators.olrCircle.create(circle)
final CircleLocation circle = new CircleLocation(52.521864, 13.413306, 1000.0);

final CircleLocationReference reference = LocationReferenceCreators.olrCircle().create(circle);

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.

Visualization of a Rectangle Location Reference
Figure 3. Visualization of a Rectangle Location Reference

Create and resolve rectangle references:

val boundingBox = RectangleLocation(52.576042, 52.422035, 13.502779, 13.194462)

val reference: RectangleLocationReference =
final RectangleLocation location =
    new RectangleLocation(52.576042, 52.422035, 13.502779, 13.194462);

final RectangleLocationReference reference =

Grid Location 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.

Create and resolve grid references:

val grid = GridLocation(52.481352, 52.470520, 13.320212, 13.289946, 3, 4)

val reference: GridLocationReference = LocationReferenceCreators.olrGrid.create(grid)
val resolvedGrid = LocationReferenceResolvers.olrGrid.resolve(reference)

for {
  row <- resolvedGrid.rectangles(SinusoidalProjection)
  cell <- row
} println(cell)
final GridLocation grid = new GridLocation(52.481352, 52.470520, 13.320212, 13.289946, 3, 4);

final GridLocationReference reference = LocationReferenceCreators.olrGrid().create(grid);
final GridLocation resolvedGrid = LocationReferenceResolvers.olrGrid().resolve(reference);

    .forEach(row -> row.forEach(System.out::println));
Visualization of a Grid Location Reference
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.

Visualization of a Polygon Location Reference
Figure 5. Visualization of a Polygon Location Reference

Create and resolve polygon references:

val polygon = PolygonLocation(
    GeoCoordinate(52.506730, 13.333547),
    GeoCoordinate(52.513119, 13.331632),
    GeoCoordinate(52.518681, 13.347873),
    GeoCoordinate(52.519508, 13.374674),
    GeoCoordinate(52.512330, 13.376650),
    GeoCoordinate(52.510150, 13.345835)

val reference: PolygonLocationReference = LocationReferenceCreators.olrPolygon.create(polygon)
final PolygonLocation polygon =
    new PolygonLocation(
            new GeoCoordinate(52.506730, 13.333547),
            new GeoCoordinate(52.513119, 13.331632),
            new GeoCoordinate(52.518681, 13.347873),
            new GeoCoordinate(52.519508, 13.374674),
            new GeoCoordinate(52.512330, 13.376650),
            new GeoCoordinate(52.510150, 13.345835)));

final PolygonLocationReference reference =

Linear 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.

Visualization of a Linear Location Reference
Figure 6. Visualization of a Linear Location Reference

Create and resolve linear location references:

val location: LinearLocation = findLinearLocation(optimizedMap, cacheManager)

val reference: LinearLocationReference =
    .olrLinear(optimizedMap, cacheManager)

val resolvedLocation: LinearLocation =
    .olrLinear(optimizedMap, cacheManager)

final LinearLocation location = paths.findLinearLocation(optimizedMap, cacheManager);

final LinearLocationReference reference =
    LocationReferenceCreators.olrLinear(optimizedMap, cacheManager).create(location);

final LinearLocation resolvedLocation =
    LocationReferenceResolvers.olrLinear(optimizedMap, cacheManager).resolve(reference);


Closed-linear Location Reference

Visualization of a Closed-linear Location Reference
Figure 7. Visualization of a Closed-linear Location Reference

Create and resolve closed linear location references:

val location: ClosedLinearLocation = findClosedLinearLocation(optimizedMap, cacheManager)

val reference: ClosedLinearLocationReference =
    .olrClosedLinear(optimizedMap, cacheManager)

val resolvedLocation: ClosedLinearLocation =
    .olrClosedLinear(optimizedMap, cacheManager)

final ClosedLinearLocation location =
    paths.findClosedLinearLocation(optimizedMap, cacheManager);

final ClosedLinearLocationReference reference =
    LocationReferenceCreators.olrClosedLinear(optimizedMap, cacheManager).create(location);

final ClosedLinearLocation resolvedLocation =
    LocationReferenceResolvers.olrClosedLinear(optimizedMap, cacheManager).resolve(reference);


Point along a line Location Reference

Visualization of a Point Along a Line Location Reference
Figure 8. Visualization of a Point Along a Line Location Reference

Create and resolve point along a line references:

val location: AccessPoint = findAccessPoint(optimizedMap, cacheManager)

val reference: PointAlongLineLocationReference =
    .olrPointAlongLine(optimizedMap, cacheManager)

val resolvedLocation: AccessPoint =
    .olrPointAlongLine(optimizedMap, cacheManager)

final AccessPoint location = paths.findAccessPoint(optimizedMap, cacheManager);

final PointAlongLineLocationReference reference =
    LocationReferenceCreators.olrPointAlongLine(optimizedMap, cacheManager).create(location);

final AccessPoint resolvedLocation =
    LocationReferenceResolvers.olrPointAlongLine(optimizedMap, cacheManager).resolve(reference);


POI with access point Location Reference

Visualization of a POI with Access Point Location Reference
Figure 9. Visualization of a POI with Access Point Location Reference

Create and resolve point of interest (POI) with access point references:

val location: PointOfInterest = findPointOfInterest(optimizedMap, cacheManager)

val reference: POIWithAccessPointLocationReference =
    .olrPoiWithAccessPoint(optimizedMap, cacheManager)

val resolvedLocation: PointOfInterest =
    .olrPoiWithAccessPoint(optimizedMap, cacheManager)

final PointOfInterest location = paths.findPointOfInterest(optimizedMap, cacheManager);

final POIWithAccessPointLocationReference reference =
    LocationReferenceCreators.olrPoiWithAccessPoint(optimizedMap, cacheManager)

final PointOfInterest resolvedLocation =
    LocationReferenceResolvers.olrPoiWithAccessPoint(optimizedMap, cacheManager)


results matching ""

    No results matching ""