Implicits (Scala only)

The Location Library offers Implicits objects that simplify the use of the Location Library type classes. For example, by exposing type class operations as extension methods.

The simplest way to achieve this is to add this line at the top of your source file:


You can see the resulting simplification in the following example:

def processLineString[LS: LineStringOperations](lineString: LS) = {
  // Using the type class without the `Implicits` object
  val points = implicitly[LineStringOperations[LS]].points(lineString)


  // Using the type class with the `Implicits` object
  val points2 = lineString.points

  assert(points == points2)

The Location Library also supports using HERE Map Content types with Location Library type classes by importing the contents of the corresponding Implicits object.

val point0 =, 0)
val point1 =, 1)


val distance = GeoCoordinates.greatCircleDistanceMeters(point0, point1)

results matching ""

    No results matching ""