gisbeacon

package
v1.0.7 Latest Latest
Warning

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

Go to latest
Published: Jul 23, 2024 License: MulanPSL-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BASE32                = "0123456789bcdefghjkmnpqrstuvwxyz"
	MAX_LATITUDE  float64 = 90
	MIN_LATITUDE  float64 = -90
	MAX_LONGITUDE float64 = 180
	MIN_LONGITUDE float64 = -180
)
View Source
const (
	DIRECTION_TOP        = "top"
	DIRECTION_RIGHT      = "right"
	DIRECTION_BOTTOM     = "bottom"
	DIRECTION_LEFT       = "left"
	BASE32_DIR_TOP       = "p0r21436x8zb9dcf5h7kjnmqesgutwvy"
	BASE32_DIR_RIGHT     = "bc01fg45238967deuvhjyznpkmstqrwx"
	BASE32_DIR_BOTTOM    = "14365h7k9dcfesgujnmqp0r2twvyx8zb"
	BASE32_DIR_LEFT      = "238967debc01fg45kmstqrwxuvhjyznp"
	BASE32_BORDER_RIGHT  = "bcfguvyz"
	BASE32_BORDER_LEFT   = "0145hjnp"
	BASE32_BORDER_TOP    = "prxz"
	BASE32_BORDER_BOTTOM = "028b"
	EVEN                 = "even"
	ODD                  = "odd"
)

Variables

View Source
var PI float64 = 3.14159265358979324

Functions

func CheckGISPointInArea

func CheckGISPointInArea(polygonList [][2]float64, pointLng float64, pointLat float64) bool

func CrossProduct

func CrossProduct(a, b, c Point) float64

func DecodeBounds

func DecodeBounds(geohash string) (LatLng, LatLng)

func GetConvexHullPolygon

func GetConvexHullPolygon(points [][2]float64) (result [][2]float64)

func GetNeighbor

func GetNeighbor(geohash string, direction string) string

func GetNeighborsByGeohash

func GetNeighborsByGeohash(geohash string, precision int, minLat, maxLat, minLng, maxLng float64) []string

func GetNeighborsByLatLon

func GetNeighborsByLatLon(latitude, longitude float64, precision int) []string

计算该点(latitude, longitude)在精度precision下的邻居 -- 周围8个区域+本身所在区域 返回这些区域的geohash值,总共9个

func PolygonToGeohashes

func PolygonToGeohashes(polygon *Polygon, precision int, inner bool) []string

Types

type Bound

type Bound struct {
	Min LatLng
	Mid LatLng
	Max LatLng
}

func Decode

func Decode(geohash string) *Bound

type Box

type Box struct {
	MinLat float64 `json:"minLat"` // 维度
	MaxLat float64 `json:"maxLat"`
	MinLng float64 `json:"minLng"`
	MaxLng float64 `json:"maxLng"` // 经度
}

geohash的精度与其长度成正比 每个点的geohash值实际上代表了一个区域,这个区域的大小与geohash的精度成反比 坐标点的格式为(纬度,经度) 将这个区域用一个矩形表示

func Encode

func Encode(latitude, longitude float64, precision int) (string, *Box)

输入值:纬度,经度,精度(geohash的长度) 返回geohash, 以及该点所在的区域

func (*Box) Height

func (this *Box) Height() float64

func (*Box) Width

func (this *Box) Width() float64

type GPS

type GPS struct {
	XPI float64
}

func NewGPS

func NewGPS() *GPS

func (*GPS) Bd_decrypt

func (gps *GPS) Bd_decrypt(bdLat float64, bdLon float64) map[string]float64

BD-09 to GCJ-02

func (*GPS) Bd_encrypt

func (gps *GPS) Bd_encrypt(gcjLat float64, gcjLon float64) map[string]float64

GCJ-02 to BD-09

func (*GPS) Bd_wgs

func (gps *GPS) Bd_wgs(bdLat float64, bdLon float64) map[string]float64

BD-09 to WGS-84

func (*GPS) CoordinatesConvert

func (gps *GPS) CoordinatesConvert(lat float64, lon float64, gtype string) map[string]float64

func (*GPS) Distance

func (gps *GPS) Distance(latA float64, lonA float64, latB float64, lonB float64) float64

two point"s distance

func (*GPS) Gcj_decrypt

func (gps *GPS) Gcj_decrypt(gcjLat float64, gcjLon float64) map[string]float64

GCJ-02 to WGS-84

func (*GPS) Gcj_decrypt_exact

func (gps *GPS) Gcj_decrypt_exact(gcjLat float64, gcjLon float64) map[string]float64

GCJ-02 to WGS-84 exactly

func (*GPS) Gcj_encrypt

func (gps *GPS) Gcj_encrypt(wgsLat float64, wgsLon float64) map[string]float64

WGS-84 to GCJ-02

func (*GPS) Mercator_decrypt

func (gps *GPS) Mercator_decrypt(mercatorLat float64, mercatorLon float64) map[string]float64

Web mercator to WGS-84 mercatorLat.y mercatorLon.x

func (*GPS) Mercator_encrypt

func (gps *GPS) Mercator_encrypt(wgsLat float64, wgsLon float64) map[string]float64

WGS-84 to Web mercator mercatorLat.y mercatorLon.x

func (*GPS) Wgs_bd

func (gps *GPS) Wgs_bd(wgsLat float64, wgsLon float64) map[string]float64

WGS-84 to BD-09

type Hull

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

type LatLng

type LatLng struct {
	Lat float64
	Lng float64
}

type Neighbors

type Neighbors struct {
	Top         string
	TopRight    string
	Right       string
	BottomRight string
	Bottom      string
	BottomLeft  string
	Left        string
	TopLeft     string
}

func GetNeighbors

func GetNeighbors(geohash string) Neighbors

type Point

type Point struct {
	X, Y float64
}

type Points

type Points []Point

func (Points) Len

func (points Points) Len() int

func (Points) Less

func (points Points) Less(i, j int) bool

func (Points) Swap

func (points Points) Swap(i, j int)

type Polygon

type Polygon struct {
	Path [][2]float64 `json:"polygon"`
}

func GeohashToPolygon

func GeohashToPolygon(geo string) *Polygon

TODO polygon geohash set

func NewPolygon

func NewPolygon(polygon [][2]float64) *Polygon

func (*Polygon) Centroid

func (polygon *Polygon) Centroid() [2]float64

重心 polygon闭合

func (*Polygon) Contains

func (polygon *Polygon) Contains(point [2]float64) bool

func (*Polygon) Inside

func (polygon *Polygon) Inside(p *Polygon) bool

p inside polygon , 不计算 p > polygon 的情况

func (*Polygon) Intersect

func (polygon *Polygon) Intersect(p *Polygon) bool

相交,包括包含情况

func (*Polygon) IntersectWithoutInside

func (polygon *Polygon) IntersectWithoutInside(p *Polygon) bool

相交但不包含

Jump to

Keyboard shortcuts

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