Skip to content

chobeat/scala-geohash

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

scala-geohash aims to provide the basic tools to work with Geohashes in idiomatic Scala.

Basic Usage

Encode a point as GeoHash

import org.chobeat.scalageohash.GeoHash

val precision = 12
GeoHash.encodeGeohash(-23.12, -12.33, precision)
import org.chobeat.scalageohash.{GeoHash,GeoPoint}

val precision = 12
val p = GeoPoint(-90.0, -180.00)
GeoHash.encodeGeohash(p, precision)

Decode a GeoHash

import org.chobeat.scalageohash.{GeoHash,GeoPoint}
import org.chobeat.scalageohash.GeoHash.BoxRange
import org.chobeat.scalageohash.ImplicitConversions._
val geohash = "5667gf"
val ((latW, latE), (lonN, lonS)): BoxRange = GeoHash(geohash).boxRange
val (lat,lon) = GeoHash(geohash).centroid

Get the neighbour of a GeoHash

import org.chobeat.scalageohash.{GeoHash,GeoPoint}
import org.chobeat.scalageohash.Directions._
import org.chobeat.scalageohash.ImplicitConversions._
val geohash = GeoHash("gbsuv")
val neighbour = geohash.getNeighbour(North)

Get all the neighbours of a GeoHash

import org.chobeat.scalageohash.{GeoHash,GeoPoint}

val geohash = GeoHash("gbsuv")
val neighbourSet = geohash.getNeighbourSet()

Releases

No releases published

Packages

No packages published

Languages