Documentation ¶
Index ¶
- Constants
- Variables
- func CheckGISPointInArea(polygonList [][2]float64, pointLng float64, pointLat float64) bool
- func CrossProduct(a, b, c Point) float64
- func DecodeBounds(geohash string) (LatLng, LatLng)
- func GetConvexHullPolygon(points [][2]float64) (result [][2]float64)
- func GetNeighbor(geohash string, direction string) string
- func GetNeighborsByGeohash(geohash string, precision int, minLat, maxLat, minLng, maxLng float64) []string
- func GetNeighborsByLatLon(latitude, longitude float64, precision int) []string
- func PolygonToGeohashes(polygon *Polygon, precision int, inner bool) []string
- type Bound
- type Box
- type GPS
- func (gps *GPS) Bd_decrypt(bdLat float64, bdLon float64) map[string]float64
- func (gps *GPS) Bd_encrypt(gcjLat float64, gcjLon float64) map[string]float64
- func (gps *GPS) Bd_wgs(bdLat float64, bdLon float64) map[string]float64
- func (gps *GPS) CoordinatesConvert(lat float64, lon float64, gtype string) map[string]float64
- func (gps *GPS) Distance(latA float64, lonA float64, latB float64, lonB float64) float64
- func (gps *GPS) Gcj_decrypt(gcjLat float64, gcjLon float64) map[string]float64
- func (gps *GPS) Gcj_decrypt_exact(gcjLat float64, gcjLon float64) map[string]float64
- func (gps *GPS) Gcj_encrypt(wgsLat float64, wgsLon float64) map[string]float64
- func (gps *GPS) Mercator_decrypt(mercatorLat float64, mercatorLon float64) map[string]float64
- func (gps *GPS) Mercator_encrypt(wgsLat float64, wgsLon float64) map[string]float64
- func (gps *GPS) Wgs_bd(wgsLat float64, wgsLon float64) map[string]float64
- type Hull
- type LatLng
- type Neighbors
- type Point
- type Points
- type Polygon
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 CrossProduct ¶
func DecodeBounds ¶
func GetConvexHullPolygon ¶
func GetNeighbor ¶
func GetNeighborsByGeohash ¶
func GetNeighborsByLatLon ¶
计算该点(latitude, longitude)在精度precision下的邻居 -- 周围8个区域+本身所在区域 返回这些区域的geohash值,总共9个
Types ¶
type Box ¶
type Box struct { MinLat float64 `json:"minLat"` // 维度 MaxLat float64 `json:"maxLat"` MinLng float64 `json:"minLng"` MaxLng float64 `json:"maxLng"` // 经度 }
geohash的精度与其长度成正比 每个点的geohash值实际上代表了一个区域,这个区域的大小与geohash的精度成反比 坐标点的格式为(纬度,经度) 将这个区域用一个矩形表示
type GPS ¶
type GPS struct {
XPI float64
}
func (*GPS) Bd_decrypt ¶
BD-09 to GCJ-02
func (*GPS) Bd_encrypt ¶
GCJ-02 to BD-09
func (*GPS) CoordinatesConvert ¶
func (*GPS) Gcj_decrypt ¶
GCJ-02 to WGS-84
func (*GPS) Gcj_decrypt_exact ¶
GCJ-02 to WGS-84 exactly
func (*GPS) Gcj_encrypt ¶
WGS-84 to GCJ-02
func (*GPS) Mercator_decrypt ¶
Web mercator to WGS-84 mercatorLat.y mercatorLon.x
func (*GPS) Mercator_encrypt ¶
WGS-84 to Web mercator mercatorLat.y mercatorLon.x
type Neighbors ¶
type Neighbors struct { Top string TopRight string Right string BottomRight string Bottom string BottomLeft string Left string TopLeft string }
func GetNeighbors ¶
type Polygon ¶
type Polygon struct {
Path [][2]float64 `json:"polygon"`
}
func NewPolygon ¶
func (*Polygon) IntersectWithoutInside ¶
相交但不包含
Click to show internal directories.
Click to hide internal directories.