dmarcous / s2utilities

Utilites and functions for easy usage of S2 objects (Google geometries abstractions)

Version Matrix


This projects aims at providing a set of tools to make working with geospatial objects quick and painless. These tools were designed with S2 objects (Google's "geometry on a sphere" abstractions) in mind as the leading data structure to be used when working with geospatial data.

Build Status License

Getting S2Utilites

The current stable version is 1.1.0, which is cross-built against Scala 2.11.x and 2.12.x.

If you're using SBT, add the following line to your build file:

libraryDependencies += "com.github.dmarcous" %% "s2utils_2.12" % "1.1.0"

For Maven and other build tools, you can visit

Quick Start

import com.github.dmarcous.s2utils._

val longitude = 34.777112
val latitude = 32.071801
val s2Level = 14
val s2CellToen = CoordinateConverters.lonLatToS2CellFullToken(longitude, latitude, s2Level)


API documents in S2Utilities Scaladocs


S2Utilities contain the following packages : converters - Tools for converting between geo measurement untis and coordinate related objects. geo - Tools for handling jts geometry objects with ease. s2 - Tools for handling S2Cells and related S2 family objects.


UnitConverters - methods for converting between units like degrees-radians, angles-meters. CoordinateConverters - methods for converting between coordinate related objects like radian/polar-cartesian/degrees, lon/lat-s2cell.


GeographyUtilities - methods for handling jts geometry objects with ease like WKT/WKB converters, haversina/geosphere distnace computationg, geometry simplifications.


S2Utilities - methods for handling S2Cells and related S2 family objects like coordinate to cell/cellId/cellToken converters, and providing quick simple access to cell properties like center point, neighbour cells, parent cells.