Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/chobeat/scala-geohash
Geohash tools for Scala
https://github.com/chobeat/scala-geohash
functional-programming geohash geolocation scala
Last synced: about 2 hours ago
JSON representation
Geohash tools for Scala
- Host: GitHub
- URL: https://github.com/chobeat/scala-geohash
- Owner: chobeat
- Created: 2017-09-24T14:47:13.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2018-02-12T22:42:18.000Z (over 6 years ago)
- Last Synced: 2023-04-03T13:31:09.371Z (over 1 year ago)
- Topics: functional-programming, geohash, geolocation, scala
- Language: Scala
- Size: 31.3 KB
- Stars: 4
- Watchers: 3
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
scala-geohash aims to provide the basic tools to work with Geohashes in idiomatic Scala.
**Basic Usage**
*Encode a point as GeoHash*
```scala
import org.chobeat.scalageohash.GeoHashval precision = 12
GeoHash.encodeGeohash(-23.12, -12.33, precision)
``````scala
import org.chobeat.scalageohash.{GeoHash,GeoPoint}val precision = 12
val p = GeoPoint(-90.0, -180.00)
GeoHash.encodeGeohash(p, precision)
```*Decode a GeoHash*
```scala
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*
```scala
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*
```scala
import org.chobeat.scalageohash.{GeoHash,GeoPoint}val geohash = GeoHash("gbsuv")
val neighbourSet = geohash.getNeighbourSet()
```