api

package
v0.13.0 Latest Latest
Warning

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

Go to latest
Published: Jan 29, 2025 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package api provides structs for use with OGC API implementations.

See the specifications below for more detail:

Index

Constants

View Source
const (
	TopLeft    = "topLeft"
	BottomLeft = "bottomLeft"
)
View Source
const (
	TileDataTypeVector   = "vector"
	TileDataTypeMap      = "map"
	TileDataTypeCoverage = "coverage"
)

Data types for tilesets.

View Source
const (
	TMSWebMercatorQuad = "WebMercatorQuad"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type BoundingBox

type BoundingBox struct {
	CRS         string    `json:"crs,omitempty"`
	OrderedAxes []string  `json:"orderedAxes,omitempty"`
	LowerLeft   []float64 `json:"lowerLeft"`
	UpperRight  []float64 `json:"upperRight"`
}

type Collection added in v0.9.0

type Collection struct {
	Id          string      `json:"id"`
	Title       string      `json:"title,omitempty"`
	Description string      `json:"description,omitempty"`
	Links       []*Link     `json:"links"`
	Extent      *Extent     `json:"extent,omitempty"`
	ItemType    string      `json:"itemType,omitempty"`
	Crs         []string    `json:"crs,omitempty"`
	Extensions  []Extension `json:"-"`
}

func (Collection) MarshalJSON added in v0.9.0

func (collection Collection) MarshalJSON() ([]byte, error)

func (*Collection) UnmarshalJSON added in v0.9.0

func (collection *Collection) UnmarshalJSON(data []byte) error

type CollectionsList added in v0.9.0

type CollectionsList struct {
	Collections []*Collection `json:"collections"`
	Links       []*Link       `json:"links"`
}

type Conformance

type Conformance struct {
	Links      []*Link  `json:"links"`
	ConformsTo []string `json:"conformsTo"`
}

type Extension added in v0.9.0

type Extension interface {
	URI() string
	Encode(map[string]any) error
	Decode([]byte) error
}

type Extent added in v0.9.0

type Extent struct {
	Spatial  *SpatialExtent  `json:"spatial,omitempty"`
	Temporal *TemporalExtent `json:"temporal,omitempty"`
}

type Feature added in v0.9.0

type Feature struct {
	Id         string         `json:"id,omitempty"`
	Geometry   any            `json:"geometry"`
	Properties map[string]any `json:"properties"`
	Links      []*Link        `json:"links,omitempty"`
	Extensions []Extension    `json:"-"`
}

func (Feature) MarshalJSON added in v0.9.0

func (feature Feature) MarshalJSON() ([]byte, error)

type FeatureCollection added in v0.9.0

type FeatureCollection struct {
	Type           string     `json:"type"`
	Features       []*Feature `json:"features"`
	Links          []*Link    `json:"links,omitempty"`
	TimeStamp      string     `json:"timeStamp,omitempty"`
	NumberMatched  int        `json:"numberMatched,omitempty"`
	NumberReturned int        `json:"numberReturned,omitempty"`
}
type Link struct {
	Href             string         `mapstructure:"href"`
	Rel              string         `mapstructure:"rel"`
	Type             string         `mapstructure:"type,omitempty"`
	HrefLang         string         `mapstructure:"hreflang,omitempty"`
	Title            string         `mapstructure:"title,omitempty"`
	Length           int            `mapstructure:"length,omitempty"`
	Templated        bool           `mapstructure:"templated,omitempty"`
	VarBase          string         `mapstructure:"varBase,omitempty"`
	AdditionalFields map[string]any `mapstructure:",remain"`
}

Link is used to connect resources in an OGC API.

Implementations that conform to the Common Core Conformance class (http://www.opengis.net/spec/ogcapi-common-1/1.0/conf/core) must link to associated resources with the fields below.

The AdditionalFields map will be populated with any additional fields when unmarshalling JSON. You can use this map to add additional fields when marshalling JSON.

func (*Link) MarshalJSON added in v0.9.0

func (link *Link) MarshalJSON() ([]byte, error)

func (*Link) UnmarshalJSON added in v0.9.0

func (link *Link) UnmarshalJSON(data []byte) error

type RecordCore added in v0.9.0

type RecordCore struct {
	Id          string
	Type        string
	Title       string
	Description string
	Time        time.Time
	Created     time.Time
	Updated     time.Time
}

func (*RecordCore) Decode added in v0.9.0

func (r *RecordCore) Decode(data []byte) error

func (*RecordCore) Encode added in v0.9.0

func (r *RecordCore) Encode(featureMap map[string]any) error

func (*RecordCore) URI added in v0.9.0

func (r *RecordCore) URI() string

type Root

type Root struct {
	Links       []*Link `json:"links"`
	Title       string  `json:"title,omitempty"`
	Description string  `json:"description,omitempty"`
	Attribution string  `json:"attribution,omitempty"`
}

type SpatialExtent added in v0.9.0

type SpatialExtent struct {
	Bbox [][]float64 `json:"bbox"`
	Crs  string      `json:"crs,omitempty"`
}

type TemporalExtent added in v0.9.0

type TemporalExtent struct {
	Interval [][]any `json:"interval"`
	Trs      string  `json:"trs,omitempty"`
}

type TileMatrix

type TileMatrix struct {
	Title                string                 `json:"title,omitempty"`
	Description          string                 `json:"description,omitempty"`
	Keywords             []string               `json:"keywords,omitempty"`
	ID                   string                 `json:"id"`
	ScaleDenominator     float64                `json:"scaleDenominator"`
	CellSize             float64                `json:"cellSize"`
	CornerOfOrigin       string                 `json:"cornerOfOrigin,omitempty"`
	PointOfOrigin        []float64              `json:"pointOfOrigin"`
	TileWidth            int                    `json:"tileWidth"`
	TileHeight           int                    `json:"tileHeight"`
	MatrixWidth          int                    `json:"matrixWidth"`
	MatrixHeight         int                    `json:"matrixHeight"`
	VariableMatrixWidths []*VariableMatrixWidth `json:"variableMatrixWidths,omitempty"`
}

TileMatrix includes for a single "level" in a tile matrix set.

Implementations that conform to the Tileset Conformance class (http://www.opengis.net/spec/ogcapi-tiles-1/1.0/conf/tileset) must link to a tiling scheme where each level includes this metadata.

func (*TileMatrix) BoundingBox

func (matrix *TileMatrix) BoundingBox() *BoundingBox

BoundingBox returns the map extent of a tile matrix.

func (*TileMatrix) Limit

func (matrix *TileMatrix) Limit(bounds *BoundingBox) (*TileMatrixSetLimit, error)

Limit returns the tile range for a single matrix level. Pass a nil bounds to get the full tile range for a level.

type TileMatrixSet

type TileMatrixSet struct {
	ID                string        `json:"id,omitempty"`
	Title             string        `json:"title,omitempty"`
	Description       string        `json:"description,omitempty"`
	Keywords          []string      `json:"keywords,omitempty"`
	URI               string        `json:"uri,omitempty"`
	OrderedAxes       []string      `json:"orderedAxes,omitempty"`
	CRS               string        `json:"crs"`
	WellKnownScaleSet string        `json:"wellKnownScaleSet,omitempty"`
	BoundingBox       *BoundingBox  `json:"boundingBox,omitempty"`
	TileMatrices      []*TileMatrix `json:"tileMatrices"`
	Links             []*Link       `json:"links,omitempty"`
}

TileMatrixSet includes metadata tiling schema.

Implementations that conform to the Tileset Conformance class (http://www.opengis.net/spec/ogcapi-tiles-1/1.0/conf/tileset) must link to a tiling scheme for each tileset.

func GetTileMatrixSet

func GetTileMatrixSet(id string, options ...TileMatrixSetOption) (*TileMatrixSet, error)

func (*TileMatrixSet) Limits

func (tms *TileMatrixSet) Limits(minLevel int, maxLevel int, bounds *BoundingBox) ([]*TileMatrixSetLimit, error)

Limits generates a slice of tile ranges for the given levels and bounds. Pass a nil bounds to get the full tile range for a level.

type TileMatrixSetItem

type TileMatrixSetItem struct {
	ID    string  `json:"id,omitempty"`
	Title string  `json:"title,omitempty"`
	URI   string  `json:"uri,omitempty"`
	CRS   string  `json:"crs,omitempty"`
	Links []*Link `json:"links"`
}

type TileMatrixSetLimit

type TileMatrixSetLimit struct {
	TileMatrix string `json:"tileMatrix"`
	MinTileRow int    `json:"minTileRow"`
	MaxTileRow int    `json:"maxTileRow"`
	MinTileCol int    `json:"minTileCol"`
	MaxTileCol int    `json:"maxTileCol"`
}

TileMatrixSetLimit adds metadata to a tileset describing limits on the referenced tiling scheme.

Implementations that conform to the TileMatrixSetLimits Conformance class (http://www.opengis.net/spec/tms/2.0/conf/tilematrixsetlimits) may provide these metadata fields.

type TileMatrixSetList

type TileMatrixSetList struct {
	TileMatrixSets []*TileMatrixSetItem `json:"tileMatrixSets"`
	Links          []*Link              `json:"links,omitempty"`
}

type TileMatrixSetMaxZoom

type TileMatrixSetMaxZoom int

type TileMatrixSetMinZoom

type TileMatrixSetMinZoom int

type TileMatrixSetOption

type TileMatrixSetOption interface {
	// contains filtered or unexported methods
}

type TilePoint

type TilePoint struct {
	Coordinates      []float64 `json:"coordinates"`
	CRS              string    `json:"crs,omitempty"`
	TileMatrix       string    `json:"tileMatrix"`
	ScaleDenominator float64   `json:"scaleDenominator,omitempty"`
	CellSize         float64   `json:"cellSize,omitempty"`
}

type TileSet

type TileSet struct {
	Title               string                `json:"title,omitempty"`
	Description         string                `json:"description,omitempty"`
	Keywords            []string              `json:"keywords,omitempty"`
	Version             string                `json:"version,omitempty"`
	PointOfContact      string                `json:"pointOfContact,omitempty"`
	Attribution         string                `json:"attribution,omitempty"`
	License             string                `json:"license,omitempty"`
	AccessConstraints   []string              `json:"accessConstraints,omitempty"`
	MediaTypes          []string              `json:"mediaTypes,omitempty"`
	DataType            string                `json:"dataType"`
	TileMatrixSetURI    string                `json:"tileMatrixSetURI,omitempty"`
	TileMatrixSetLimits []*TileMatrixSetLimit `json:"tileMatrixSetLimits,omitempty"`
	CRS                 string                `json:"crs"`
	Epoch               float64               `json:"epoch,omitempty"`
	Links               []*Link               `json:"links"`
	BoundingBox         *BoundingBox          `json:"boundingBox,omitempty"`
	CenterPoint         *TilePoint            `json:"centerPoint,omitempty"`
}

TileSet includes metadata for a tileset.

Implementations that conform to the Tileset Conformance class (http://www.opengis.net/spec/ogcapi-tiles-1/1.0/conf/tileset) must provide these metadata fields.

type TileSetItem

type TileSetItem struct {
	Title            string  `json:"title,omitempty"`
	DataType         string  `json:"dataType"`
	CRS              string  `json:"crs"`
	TileMatrixSetURI string  `json:"tileMatrixSetURI,omitempty"`
	Links            []*Link `json:"links"`
}

TileSetItem includes metadata for a a list of tilesets.

Implementations that conform to the Tileset List Conformance class (http://www.opengis.net/spec/ogcapi-tiles-1/1.0/conf/tilesets-list) must provide these metadata fields when rendering a list of tilesets.

type TileSetList

type TileSetList struct {
	TileSets []*TileSetItem `json:"tilesets"`
	Links    []*Link        `json:"links,omitempty"`
}

TileSetList represents a list of tilesets.

Implementations that conform to the Tileset List Conformance class (http://www.opengis.net/spec/ogcapi-tiles-1/1.0/conf/tilesets-list) must provide a list of tilesets.

type VariableMatrixWidth

type VariableMatrixWidth struct {
	Coalesce   int `json:"coalesce"`
	MinTileRow int `json:"minTileRow"`
	MaxTileRow int `json:"maxTileRow"`
}

Jump to

Keyboard shortcuts

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