geo

package module
v0.0.0-...-ea1057f Latest Latest
Warning

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

Go to latest
Published: Feb 10, 2023 License: MIT Imports: 1 Imported by: 0

README

go-georadius

redis georadius命令会在redis server中进行距离计算,而redis主线程又是单线程的,无法利用多核增加这部分计算的性能。

因此可以将计算部分提升到redis client中进行,仅将redis server作为数据库,实现”存储-计算“分离。

可以利用这个库将原本的georadius命令转为多个zrangebyscore命令,粗筛出坐标点后再在go程序中进行利用该库进行距离计算,筛选出不符合距离条件的坐标点。

Documentation

Index

Constants

View Source
const (
	GEO_LONG_MAX           float64 = 180 // Limits from EPSG:900913 / EPSG:3785 / OSGEO:41001 南极和北极不能编码
	GEO_LONG_MIN           float64 = -180
	GEO_LAT_MAX            float64 = 85.05112878
	GEO_LAT_MIN            float64 = -85.05112878
	ONE_INT                int     = 1
	GEO_STEP_MAX                   = 26
	M_PI                   float64 = 3.14159265358979323846264338327950288
	D_R                    float64 = (M_PI / 180.0)
	EARTH_RADIUS_IN_METERS float64 = 6372797.560856
	MERCATOR_MAX           float64 = 20037726.37
)

Variables

This section is empty.

Functions

func GetDistanceByScore

func GetDistanceByScore(lon1d, lat1d float64, score uint64) float64

func NeighborRanges

func NeighborRanges(longitude, latitude, radiusMeters float64) [][2]uint64

Types

type Area

type Area struct {
	// contains filtered or unexported fields
}

type Bits

type Bits struct {
	// contains filtered or unexported fields
}

type Neighbors

type Neighbors struct {
	// contains filtered or unexported fields
}

type Radius

type Radius struct {
	// contains filtered or unexported fields
}

type Range

type Range struct {
	// contains filtered or unexported fields
}

Jump to

Keyboard shortcuts

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