query

package
v0.16.2 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2025 License: BSD-3-Clause Imports: 15 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExecuteQuery

func ExecuteQuery(ctx context.Context, db database.SpatialDatabase, fn SpatialFunction, req *SpatialQuery) (spr.StandardPlacesResults, error)

func NewSPRFilterFromSpatialQuery

func NewSPRFilterFromSpatialQuery(req *SpatialQuery) (spatial.Filter, error)

func RegisterSpatialFunction

func RegisterSpatialFunction(ctx context.Context, scheme string, init_func SpatialFunctionInitializationFunc) error

RegisterSpatialFunction registers 'scheme' as a key pointing to 'init_func' in an internal lookup table used to create new `SpatialFunction` instances by the `NewSpatialFunction` method.

func SpatialFunctionSchemes

func SpatialFunctionSchemes() []string

SpatialFunctionSchemes returns the list of schemes that have been registered.

Types

type IntersectsSpatialFunction

type IntersectsSpatialFunction struct {
	SpatialFunction
}

func (*IntersectsSpatialFunction) Execute

func (q *IntersectsSpatialFunction) Execute(ctx context.Context, db database.SpatialDatabase, geom orb.Geometry, f ...spatial.Filter) (spr.StandardPlacesResults, error)

type MapTileSpatialQuery added in v0.15.1

type MapTileSpatialQuery struct {
	Tile                *Tile    `json:"tile,omitempty"`
	Placetypes          []string `json:"placetypes,omitempty"`
	Geometries          string   `json:"geometries,omitempty"`
	AlternateGeometries []string `json:"alternate_geometries,omitempty"`
	IsCurrent           []int64  `json:"is_current,omitempty"`
	IsCeased            []int64  `json:"is_ceased,omitempty"`
	IsDeprecated        []int64  `json:"is_deprecated,omitempty"`
	IsSuperseded        []int64  `json:"is_superseded,omitempty"`
	IsSuperseding       []int64  `json:"is_superseding,omitempty"`
	InceptionDate       string   `json:"inception_date,omitempty"`
	CessationDate       string   `json:"cessation_date,omitempty"`
	Properties          []string `json:"properties,omitempty"`
	Sort                []string `json:"sort,omitempty"`
}

func (*MapTileSpatialQuery) MapTile added in v0.15.1

func (q *MapTileSpatialQuery) MapTile() (*maptile.Tile, error)

func (*MapTileSpatialQuery) SpatialQuery added in v0.15.1

func (q *MapTileSpatialQuery) SpatialQuery() *SpatialQuery

type PointInPolygonSpatialFunction

type PointInPolygonSpatialFunction struct {
	SpatialFunction
}

func (*PointInPolygonSpatialFunction) Execute

func (q *PointInPolygonSpatialFunction) Execute(ctx context.Context, db database.SpatialDatabase, geom orb.Geometry, f ...spatial.Filter) (spr.StandardPlacesResults, error)

type SpatialFunction

type SpatialFunction interface {
	// Execute performs a specific spatial function
	Execute(context.Context, database.SpatialDatabase, orb.Geometry, ...spatial.Filter) (spr.StandardPlacesResults, error)
}

SpatialFunction in an interface for spatial functions

func NewIntersectsSpatialFunction

func NewIntersectsSpatialFunction(ctx context.Context, uri string) (SpatialFunction, error)

func NewPointInPolygonSpatialFunction

func NewPointInPolygonSpatialFunction(ctx context.Context, uri string) (SpatialFunction, error)

func NewSpatialFunction

func NewSpatialFunction(ctx context.Context, uri string) (SpatialFunction, error)

NewSpatialFunction returns a new `SpatialFunction` instance configured by 'uri'. The value of 'uri' is parsed as a `url.URL` and its scheme is used as the key for a corresponding `SpatialFunctionInitializationFunc` function used to instantiate the new `SpatialFunction`. It is assumed that the scheme (and initialization function) have been registered by the `RegisterSpatialFunction` method.

type SpatialFunctionInitializationFunc

type SpatialFunctionInitializationFunc func(ctx context.Context, uri string) (SpatialFunction, error)

SpatialFunctionInitializationFunc is a function defined by individual function package and used to create an instance of that function

type SpatialQuery

type SpatialQuery struct {
	Geometry            *geojson.Geometry `json:"geometry"`
	Placetypes          []string          `json:"placetypes,omitempty"`
	Geometries          string            `json:"geometries,omitempty"`
	AlternateGeometries []string          `json:"alternate_geometries,omitempty"`
	IsCurrent           []int64           `json:"is_current,omitempty"`
	IsCeased            []int64           `json:"is_ceased,omitempty"`
	IsDeprecated        []int64           `json:"is_deprecated,omitempty"`
	IsSuperseded        []int64           `json:"is_superseded,omitempty"`
	IsSuperseding       []int64           `json:"is_superseding,omitempty"`
	InceptionDate       string            `json:"inception_date,omitempty"`
	CessationDate       string            `json:"cessation_date,omitempty"`
	Properties          []string          `json:"properties,omitempty"`
	Sort                []string          `json:"sort,omitempty"`
}

type Tile added in v0.15.1

type Tile struct {
	Zoom uint32 `json:"zoom"`
	X    uint32 `json:"x"`
	Y    uint32 `json:"y"`
}

Jump to

Keyboard shortcuts

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