proximityhash

package module
v0.0.0-...-53d0e96 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 12, 2023 License: MIT Imports: 3 Imported by: 3 modules, 2 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

go version of proximity hash

ProximityHash(go): Geohashes in Proximity (with the option of compression util) this package is a port of ashwin711/proximityhash

Geohash is a geocoding system invented by Gustavo Niemeyer and placed into the public domain. It is a hierarchical spatial data structure which subdivides space into buckets of grid shape, which is one of the many applications of what is known as a Z-order curve, and generally space-filling curves.

ProximityHash generates a set of geohashes that cover a circular area, given the center coordinates and the radius. It also has an additional option to use GeoRaptor that creates the best combination of geohashes across various levels to represent the circle, starting from the highest level and iterating till the optimal blend is brewed. Result accuracy remains the same as that of the starting geohash level, but data size reduces considerably, thereby improving speed and performance.

Example

$ proximityhash 48.858156 2.294776 1000 7

proximityhash

$ proximityhash 48.858156 2.294776 2000 7 --georaptor true proximityhash_georaptor

$ proximityhash 48.858156 2.294776 2000 7 --georaptor true --minlevel 3 --maxlevel 6

proximityhash_georaptor_limited

Installation

To install proximityhash, simply

go get github.com/echoface/proximityhash

API:

package proximityhash

// CompressGeoHash compress api, merge geohash codes as most as possible
func CompressGeoHash(codes []string, minPrecision, cutoffPrecision int) []string

// CreateGeohash generate geohash codes that cover a circular area
func CreateGeohash(latitude, longitude, radius float64, precision uint) []string

License:

Licensed under the MIT License

Contributors:

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CompressGeoHash

func CompressGeoHash(codes []string, minPrecision, cutoffPrecision int) []string

CompressGeoHash merge geohash code as far as possible, minPrecision: minimum length of geohash code after merge cutoffPrecision: cutoff precision geohash codes that can't be merged

func CreateGeohash

func CreateGeohash(latitude, longitude, radius float64, precision uint) []string

CreateGeohash Get the list of geohashed id(uint64) that approximate a circle

func GenNextPrecisionGeoHashCode

func GenNextPrecisionGeoHashCode(hashCode string) (results []string)

func MaxInt

func MaxInt(a, b int) int

func MinInt

func MinInt(a, b int) int

func PanicIf

func PanicIf(ok bool, ss string, v ...interface{})

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
⌂ 换网址