By Sidu Ponnappa

S2 is Google’s Hilbert curve based spatial indexing library that’s generally awesome, and of incredible use to us when working with maps. It’s available in Java, C++ and Golang.

We do some work in JRuby that depends on this, so we’ve repackaged the Java version as a gem for JRuby.
gojek-engineering/s2-geometry-library-jruby
JRuby gem wrapping Google’s S2 Library. Contribute to gojek-engineering/s2-geometry-library-jruby development by creating an account on GitHub.
$ gem install s2geometry-jar
or via bundler
gem 's2geometry-jar', require: 'S2Geometry'
and off you go:
require "S2Geometry"
module Demo
import 'com.google.common.geometry'
a = S2LatLng.from_degrees(-6.2, 106.816667)
b = S2LatLng.from_degrees(-6.1, 106.816667)
puts a.getEarthDistance(b)
end