Documentation ¶
Index ¶
- Constants
- Variables
- func Bits(val int64) string
- func Colorize(color string, s interface{}) string
- func CycleRestrict(value, min, max float64) float64
- func DegreesToRadians(x float64) float64
- func FromWKT(s string) geom.T
- func GlobalPixelsToWGS84WithGD(gpx, gpy float64, zoom int64) (lat, lon float64)
- func ParseAsFloatArray(line string) ([]float64, error)
- func ParseAsInt64Array(line string) ([]int64, error)
- func RadiansToDegrees(x float64) float64
- func Restrict(value, min, max float64) float64
- func RoundToDigit(v float64, n int) float64
- func ToWKT(g Primitive) string
- type AbstractGeographic
- type BBox
- type Config
- type Data
- type DataSource
- type FeatureCollection
- type Geographic
- type GeographicCollection
- type GeographicMultiPolygon
- type GeographicPoint
- type GeographicPolygon
- type GeographicSystem
- func (g *GeographicSystem) CoordinatesToQuadKey(lat, long float64) QuadKey
- func (g *GeographicSystem) DrawROMBBox(mr *MapRequest, fc *FeatureCollection) error
- func (g *GeographicSystem) DrawROMTiles(mr *MapRequest, fc *FeatureCollection) error
- func (g *GeographicSystem) MRToTiles(mr *MapRequest) (tiles map[int64]Tile)
- func (g *GeographicSystem) TileIDToCenterPoint(tileID int64) (*GeographicPoint, error)
- func (g *GeographicSystem) TileXYToCenterPoint(tx, ty int64, z int64) *GeographicPoint
- func (g *GeographicSystem) TileXYToPoint(tx, ty int64, z int64) *GeographicPoint
- func (g *GeographicSystem) TileXYToPolygon(tx, ty int64, zoom int64) *GeographicPolygon
- type MapRequest
- type Point
- type Primitive
- type Projection
- type QuadKey
- type QuadKeySystem
- func (q *QuadKeySystem) BitDelta(len int64) int64
- func (q *QuadKeySystem) Contains(point QuadKey, tile QuadKey) bool
- func (q *QuadKeySystem) CreateMask(qk QuadKey, zoom int64, clusterLevel int64) QuadKey
- func (q *QuadKeySystem) QuadKeyRange(quadKey QuadKey) (min QuadKey, max QuadKey)
- func (q *QuadKeySystem) QuadKeyToTileXY(quadKey QuadKey) (tileX, tileY int64, err error)
- func (q *QuadKeySystem) TileXYToQuadKey(tx, ty int64, zoom int64) QuadKey
- type SRID
- type Tile
- type TileBBox
- type TileSystem
- type YandexGPConverter
Constants ¶
View Source
const ( DefaultTileSize = 256 DefaultMinZoom = 0 DefaultMaxZoom = 23 )
View Source
const ( // E Eccentricity of Earth ellipsoid E = 0.0818191908426 MajorEarthRadius = 6378137.0 SubRadius = 1 / MajorEarthRadius Equator = 2 * math.Pi * MajorEarthRadius HalfEquator = Equator / 2 SubEquator = 1 / Equator HalfPi = math.Pi / 2 Rad2Deg = 180 / math.Pi MaxLat = 90.0 MinLat = -90.0 MaxLon = 180.0 MinLon = -180.0 EGS3857MinLat = -85.0840 EGS3857MaxLat = 85.0840 )
View Source
const DegreesToRadiansFactor = math.Pi / 180
View Source
const RadiansToDegreesFactor = 180 / math.Pi
Variables ¶
View Source
var DefaultGeoSystemConfig = &Config{ ProjectionType: WGS84, MinZoom: DefaultMinZoom, MaxZoom: DefaultMaxZoom, TileSize: DefaultTileSize, }
Functions ¶
func CycleRestrict ¶
func DegreesToRadians ¶
func GlobalPixelsToWGS84WithGD ¶
GlobalPixelsToWGS84WithGD GD - https://en.wikipedia.org/wiki/Gudermannian_function
func ParseAsFloatArray ¶
func ParseAsInt64Array ¶
func RadiansToDegrees ¶
func RoundToDigit ¶
RoundToDigit rounds number to N digits after dot
Types ¶
type AbstractGeographic ¶
type AbstractGeographic struct { SRID geom.T }
func (*AbstractGeographic) Scan ¶
func (g *AbstractGeographic) Scan(input interface{}) error
type DataSource ¶
type DataSource interface { LoadMapView(ctx context.Context, mr *MapRequest, fc *FeatureCollection) error StoreGeoData(ctx context.Context, d interface{}) error }
type FeatureCollection ¶
type FeatureCollection struct {
geojson.FeatureCollection
}
func NewFeatureCollection ¶
func NewFeatureCollection() *FeatureCollection
func (*FeatureCollection) Add ¶
func (f *FeatureCollection) Add(id interface{}, geo interface{}, properties map[string]interface{}) error
func (*FeatureCollection) MarshalToJSONP ¶
func (f *FeatureCollection) MarshalToJSONP(callbackID string) ([]byte, error)
type Geographic ¶
type Geographic interface {
SRID() int
}
type GeographicCollection ¶
func (*GeographicCollection) FromGeom ¶
func (p *GeographicCollection) FromGeom(t geom.T) error
func (*GeographicCollection) Scan ¶
func (p *GeographicCollection) Scan(input interface{}) error
func (*GeographicCollection) ToGeom ¶
func (p *GeographicCollection) ToGeom() (geom.T, error)
type GeographicMultiPolygon ¶
type GeographicMultiPolygon struct { SRID Polygons []*GeographicPolygon }
func (*GeographicMultiPolygon) FromGeom ¶
func (p *GeographicMultiPolygon) FromGeom(t geom.T) error
func (*GeographicMultiPolygon) Scan ¶
func (p *GeographicMultiPolygon) Scan(input interface{}) error
func (*GeographicMultiPolygon) ToGeom ¶
func (p *GeographicMultiPolygon) ToGeom() (geom.T, error)
type GeographicPoint ¶
func (*GeographicPoint) FromGeom ¶
func (p *GeographicPoint) FromGeom(t geom.T) error
func (*GeographicPoint) Scan ¶
func (p *GeographicPoint) Scan(input interface{}) error
func (*GeographicPoint) ToGeom ¶
func (p *GeographicPoint) ToGeom() (geom.T, error)
type GeographicPolygon ¶
type GeographicPolygon struct { SRID Points []*GeographicPoint }
func (*GeographicPolygon) FromGeom ¶
func (p *GeographicPolygon) FromGeom(t geom.T) error
func (*GeographicPolygon) Scan ¶
func (p *GeographicPolygon) Scan(input interface{}) error
func (*GeographicPolygon) ToGeom ¶
func (p *GeographicPolygon) ToGeom() (geom.T, error)
type GeographicSystem ¶
type GeographicSystem struct { TileSystem *TileSystem QuadKeySystem *QuadKeySystem Projection Projection // contains filtered or unexported fields }
func NewGeographicSystem ¶
func NewGeographicSystem(cfg *Config) *GeographicSystem
func (*GeographicSystem) CoordinatesToQuadKey ¶
func (g *GeographicSystem) CoordinatesToQuadKey(lat, long float64) QuadKey
func (*GeographicSystem) DrawROMBBox ¶
func (g *GeographicSystem) DrawROMBBox(mr *MapRequest, fc *FeatureCollection) error
func (*GeographicSystem) DrawROMTiles ¶
func (g *GeographicSystem) DrawROMTiles(mr *MapRequest, fc *FeatureCollection) error
func (*GeographicSystem) MRToTiles ¶
func (g *GeographicSystem) MRToTiles(mr *MapRequest) (tiles map[int64]Tile)
func (*GeographicSystem) TileIDToCenterPoint ¶
func (g *GeographicSystem) TileIDToCenterPoint(tileID int64) (*GeographicPoint, error)
func (*GeographicSystem) TileXYToCenterPoint ¶
func (g *GeographicSystem) TileXYToCenterPoint(tx, ty int64, z int64) *GeographicPoint
func (*GeographicSystem) TileXYToPoint ¶
func (g *GeographicSystem) TileXYToPoint(tx, ty int64, z int64) *GeographicPoint
func (*GeographicSystem) TileXYToPolygon ¶
func (g *GeographicSystem) TileXYToPolygon(tx, ty int64, zoom int64) *GeographicPolygon
type MapRequest ¶
func ParseMapRequest ¶
func ParseMapRequest(coordsStr, tileStr, zoomStr, callbackID, debugStr, clusterDepthStr string) (*MapRequest, error)
ParseMapRequest from comma separated strings
type Projection ¶
type QuadKeySystem ¶
type QuadKeySystem struct {
// contains filtered or unexported fields
}
func NewQuadKeySystem ¶
func NewQuadKeySystem(minZoom int64, maxZoom int64) *QuadKeySystem
func (*QuadKeySystem) BitDelta ¶
func (q *QuadKeySystem) BitDelta(len int64) int64
func (*QuadKeySystem) CreateMask ¶
func (q *QuadKeySystem) CreateMask(qk QuadKey, zoom int64, clusterLevel int64) QuadKey
func (*QuadKeySystem) QuadKeyRange ¶
func (q *QuadKeySystem) QuadKeyRange(quadKey QuadKey) (min QuadKey, max QuadKey)
func (*QuadKeySystem) QuadKeyToTileXY ¶
func (q *QuadKeySystem) QuadKeyToTileXY(quadKey QuadKey) (tileX, tileY int64, err error)
func (*QuadKeySystem) TileXYToQuadKey ¶
func (q *QuadKeySystem) TileXYToQuadKey(tx, ty int64, zoom int64) QuadKey
type TileSystem ¶
type TileSystem struct {
// contains filtered or unexported fields
}
TileSystem allow transform any coordinate to TileXY
func NewTileSystem ¶
func NewTileSystem(minZoom, maxZoom int64, tileSize int64) *TileSystem
func (*TileSystem) GlobalPixelsToTileXY ¶
func (t *TileSystem) GlobalPixelsToTileXY(gpx, gpy float64) (tx, ty int64)
func (*TileSystem) TileXYToGlobalPixels ¶
func (t *TileSystem) TileXYToGlobalPixels(tx, ty int64) (gpx, gpy float64)
func (*TileSystem) TileXYToGlobalPixelsCenter ¶
func (t *TileSystem) TileXYToGlobalPixelsCenter(tx, ty int64) (gpx, gpy float64)
type YandexGPConverter ¶
type YandexGPConverter struct {
E float64
}
YandexGPConverter https://yandex.ru/dev/maps/tiles/doc/dg/concepts/about-tiles.html#get-tile-number https://yastatic.net/s3/front-maps-static/maps-front-jsapi-v2-1/2.1.79-41/build/debug/full-f444800dea2e3f74c30f6b13a88f1a6a7b7eb78a.js
func NewYandexGPConverter ¶
func NewYandexGPConverter(e float64) *YandexGPConverter
func (YandexGPConverter) FromGlobalPixels ¶
func (g YandexGPConverter) FromGlobalPixels(gpx, gpy float64, zoom int64) (lat, lon float64)
func (YandexGPConverter) ToGlobalPixels ¶
func (g YandexGPConverter) ToGlobalPixels(lat, lon float64, zoom int64) (gpx, gpy float64)
Source Files ¶
- abstract_geographic.go
- bbox.go
- data_source.go
- feature_collection.go
- generate.go
- geographic_collection.go
- geographic_multi_polygon.go
- geographic_point.go
- geographic_polygon.go
- geographic_system.go
- geographic_system_config.go
- geom_converter.go
- map_request.go
- math.go
- quadkey.go
- quadkey_system.go
- spatial.go
- tile.go
- tile_bbox.go
- tile_system.go
- utils.go
- yandex_gp_converter.go
Click to show internal directories.
Click to hide internal directories.