georange
Georange is a package that helps with encoding geohashes, decoding geohashes,calculating distance between 2 points and generating latitudinal and longitudinal ranges as geohashes to help with the querying of databases (Tested on Firestore Only).
Getting Started
You should ensure that you add Georange as a dependency in your flutter project.
You should then run flutter packages get
Example
There is a detailed example project in the example
folder.
Initialize
Import georange
to your dart file and initialize
Encode LatLng
This method encodes the latitude and longitude
prints kzf0tvg5n
Decode Geohash
Decode a [geohash] into a pair of latitude and longitude.
prints
-1.2862372398376465
36.819584369659424
Generate Range
prints
kzf05k6hh
kzf30mptu
Calculate Distance between 2 Points
prints
439.716
Distance in Kilometres
Usage with Firestore
- Add a document to firestore with a
geohash
field or a different name
- Query Firestore (Runs like a normal firestore query)