tms20

package
v0.0.0-...-aaa3bb6 Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2024 License: MIT Imports: 16 Imported by: 0

Documentation

Overview

Package tms20 implements the OGC Tile Matrix Set standard (v2.0) as a slippy.Grid See https://www.ogc.org/standard/tms/

Index

Constants

View Source
const (
	CoordPrecision                 = 9
	StandardizedRenderingPixelSize = 0.00028
)

Variables

This section is empty.

Functions

func IsLatLon

func IsLatLon(crs CRS) (bool, error)

func ToXYPoint

func ToXYPoint(tms *TileMatrixSet, point [2]float64) (geom.Point, error)

ToXYPoint ensures that the coordinates in a point are in XY order

Types

type CRS

type CRS interface {
	Description() string
	Authority() string
	Version() string
	Code() string
}

type CornerOfOrigin

type CornerOfOrigin string
const (
	TopLeft    CornerOfOrigin = "topLeft"
	BottomLeft CornerOfOrigin = "bottomLeft"
)

func (*CornerOfOrigin) UnmarshalJSONFromMap

func (c *CornerOfOrigin) UnmarshalJSONFromMap(data interface{}) error

type ProjJSON

type ProjJSON struct {
	ID ProjJSONID `validate:"required" json:"id"`
}

TODO expand the ProjJSON type

type ProjJSONID

type ProjJSONID struct {
	AuthorityName string `validate:"required" json:"authority"`
	AuthorityCode string `validate:"required" json:"code"` // TODO can be int cq number
}

type ReferenceSystemCRS

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

func (*ReferenceSystemCRS) Authority

func (crs *ReferenceSystemCRS) Authority() string

func (*ReferenceSystemCRS) Code

func (crs *ReferenceSystemCRS) Code() string

func (*ReferenceSystemCRS) Description

func (crs *ReferenceSystemCRS) Description() string

func (*ReferenceSystemCRS) MarshalJSON

func (crs *ReferenceSystemCRS) MarshalJSON() ([]byte, error)

func (*ReferenceSystemCRS) UnmarshalJSON

func (crs *ReferenceSystemCRS) UnmarshalJSON(data []byte) error

func (*ReferenceSystemCRS) UnmarshalJSONFromMap

func (crs *ReferenceSystemCRS) UnmarshalJSONFromMap(data interface{}) error

func (*ReferenceSystemCRS) Version

func (crs *ReferenceSystemCRS) Version() string

type TMID

type TMID = int

TMID is a Tile Matrix ID

type TileMatrix

type TileMatrix struct {
	// Identifier selecting one of the scales defined in the TileMatrixSet and representing the scaleDenominator the tile.
	// Implementation of 'identifier'
	ID string `validate:"required" json:"id"`
	// Title of this tile matrix, normally used for display to a human
	Title string `json:"title,omitempty"`
	// Brief narrative description of this tile matrix set, normally available for display to a human
	Description string `json:"description,omitempty"`
	// Unordered list of one or more commonly used or formalized word(s) or phrase(s) used to describe this dataset
	Keywords []string `json:"keywords,omitempty"`
	// Scale denominator of this tile matrix
	ScaleDenominator float64 `validate:"required,gt=0" json:"scaleDenominator"`
	// Cell size of this tile matrix
	CellSize float64 `validate:"required,gt=0" json:"cellSize"`
	// The corner of the tile matrix (_topLeft_ or _bottomLeft_) used as the origin for numbering tile rows and columns.
	// This corner is also a corner of the (0, 0) tile.
	CornerOfOrigin CornerOfOrigin `validate:"omitempty,oneof=topLeft bottomLeft" json:"cornerOfOrigin,omitempty"`
	// Precise position in CRS coordinates of the corner of origin (e.g. the top-left corner) for this tile matrix. This position is also a corner of the (0, 0) tile. In previous version, this was 'topLeftCorner' and 'cornerOfOrigin' did not exist.
	PointOfOrigin *TwoDPoint `validate:"required" json:"pointOfOrigin"`
	// Width of each tile of this tile matrix in pixels
	TileWidth uint `validate:"required,min=1" json:"tileWidth"`
	// Height of each tile of this tile matrix in pixels
	TileHeight uint `validate:"required,min=1" json:"tileHeight"`
	// Width of the matrix (number of tiles in width)
	MatrixWidth uint `validate:"required,min=1" json:"matrixWidth"`
	// Height of the matrix (number of tiles in height)
	MatrixHeight uint `validate:"required,min=1" json:"matrixHeight"`
	// Describes the rows that have variable matrix width
	VariableMatrixWidths []VariableMatrixWidth `json:"variableMatrixWidths,omitempty"`
}

A tile matrix, usually corresponding to a particular zoom level of a TileMatrixSet.

func (*TileMatrix) UnmarshalJSON

func (tm *TileMatrix) UnmarshalJSON(data []byte) error

func (*TileMatrix) UnmarshalJSONFromMap

func (tm *TileMatrix) UnmarshalJSONFromMap(data interface{}) error

type TileMatrixSet

type TileMatrixSet struct {
	// Tile matrix set identifier. Implementation of 'identifier'
	ID string `json:"id,omitempty"`
	// Title of this tile matrix set, normally used for display to a human
	Title string `json:"title,omitempty"`
	// Brief narrative description of this tile matrix set, normally available for display to a human
	Description string `json:"description,omitempty"`
	// Unordered list of one or more commonly used or formalized word(s) or phrase(s) used to describe this tile matrix set
	Keywords []string `json:"keywords,omitempty"`
	// Reference to an official source for this TileMatrixSet
	URI string `validate:"omitempty,uri" json:"uri,omitempty"`
	// (This is informative, the CRS is authoritative)
	OrderedAxes []string `validate:"omitnil,min=1" json:"orderedAxes"`
	// Coordinate Reference System (CRS)
	CRS CRS `validate:"required" json:"-"`
	// Reference to a well-known scale set
	WellKnownScaleSet string `validate:"omitempty,uri" json:"wellKnownScaleSet,omitempty"`
	// Minimum bounding rectangle surrounding the tile matrix set, in the supported CRS
	BoundingBox *TwoDBoundingBox `json:"boundingBox,omitempty"`
	// Describes scale levels and its tile matrices
	TileMatrices map[TMID]TileMatrix `validate:"required,min=1" json:"-"`
}

TileMatrixSet is a definition of a tile matrix set following the Tile Matrix Set standard. For tileset metadata, such a description (in `TileMatrixSet` property) is only required for offline use, as an alternative to a link with a `http://www.opengis.net/def/rel/ogc/1.0/tiling-scheme` relation type.

func LoadEmbeddedTileMatrixSet

func LoadEmbeddedTileMatrixSet(id string) (TileMatrixSet, error)

func LoadJSONTileMatrixSet

func LoadJSONTileMatrixSet(path string) (TileMatrixSet, error)

func (*TileMatrixSet) FromNative

func (tms *TileMatrixSet) FromNative(zoom uint, pt geom.Point) (*slippy.Tile, bool)

func (*TileMatrixSet) MarshalJSON

func (tms *TileMatrixSet) MarshalJSON() ([]byte, error)

func (*TileMatrixSet) MatrixBoundingBox

func (tms *TileMatrixSet) MatrixBoundingBox(tmID TMID) (bottomLeft geom.Point, topRight geom.Point, err error)

MatrixBoundingBox returns the bounding box of a TileMatrix, in native CRS

func (*TileMatrixSet) MatrixSize

func (tms *TileMatrixSet) MatrixSize(tmID TMID) (width float64, height float64)

MatrixSize returns the width and height of a TileMatrix in native CRS units

func (*TileMatrixSet) SRID

func (tms *TileMatrixSet) SRID() uint

func (*TileMatrixSet) Size

func (tms *TileMatrixSet) Size(zoom uint) (*slippy.Tile, bool)

func (*TileMatrixSet) ToNative

func (tms *TileMatrixSet) ToNative(tile *slippy.Tile) (geom.Point, bool)

func (*TileMatrixSet) UnmarshalJSON

func (tms *TileMatrixSet) UnmarshalJSON(data []byte) error

type TwoDBoundingBox

type TwoDBoundingBox struct {
	LowerLeft   *TwoDPoint `validate:"required" json:"lowerLeft"`
	UpperRight  *TwoDPoint `validate:"required" json:"upperRight"`
	CRS         CRS        `json:"-"`
	OrderedAxes []string   `validate:"omitempty,len=2" json:"orderedAxes,omitempty"`
}

Minimum bounding rectangle surrounding a 2D resource in the CRS indicated elsewhere

func (*TwoDBoundingBox) MarshalJSON

func (bb *TwoDBoundingBox) MarshalJSON() ([]byte, error)

func (*TwoDBoundingBox) UnmarshalJSON

func (bb *TwoDBoundingBox) UnmarshalJSON(data []byte) error

type TwoDPoint

type TwoDPoint [2]float64

A 2D Point in the CRS indicated elsewhere

type URICRS

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

func (*URICRS) Authority

func (crs *URICRS) Authority() string

func (*URICRS) Code

func (crs *URICRS) Code() string

func (*URICRS) Description

func (crs *URICRS) Description() string

func (*URICRS) MarshalJSON

func (crs *URICRS) MarshalJSON() ([]byte, error)

func (*URICRS) UnmarshalJSON

func (crs *URICRS) UnmarshalJSON(data []byte) error

func (*URICRS) UnmarshalJSONFromMap

func (crs *URICRS) UnmarshalJSONFromMap(data interface{}) error

func (*URICRS) Version

func (crs *URICRS) Version() string

type VariableMatrixWidth

type VariableMatrixWidth struct {
	// Number of tiles in width that coalesce in a single tile for these rows
	Coalesce uint `validate:"required,min=2" json:"coalesce"`
	// First tile row where the coalescence factor applies for this tilematrix
	MinTileRow uint `validate:"required,min=0" json:"minTileRow"`
	// Last tile row where the coalescence factor applies for this tilematrix
	MaxTileRow uint `validate:"required,min=0" json:"maxTileRow"`
}

Variable Matrix Width data structure

type WKTCRS

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

func (*WKTCRS) Authority

func (crs *WKTCRS) Authority() string

func (*WKTCRS) Code

func (crs *WKTCRS) Code() string

func (*WKTCRS) Description

func (crs *WKTCRS) Description() string

func (*WKTCRS) MarshalJSON

func (crs *WKTCRS) MarshalJSON() ([]byte, error)

func (*WKTCRS) UnmarshalJSON

func (crs *WKTCRS) UnmarshalJSON(data []byte) error

func (*WKTCRS) UnmarshalJSONFromMap

func (crs *WKTCRS) UnmarshalJSONFromMap(data interface{}) error

func (*WKTCRS) Version

func (crs *WKTCRS) Version() string

Jump to

Keyboard shortcuts

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