datasources

package
v1.9.6 Latest Latest
Warning

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

Go to latest
Published: Jun 9, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Datasource

type Datasource interface {

	// GetFeatures returns all Features matching the given criteria and Cursors for pagination
	GetFeatures(ctx context.Context, collection string, criteria FeaturesCriteria, axisOrder domain.AxisOrder, profile domain.Profile) (*domain.FeatureCollection, domain.Cursors, error)

	// GetFeature returns a specific Feature, based on its feature id
	GetFeature(ctx context.Context, collection string, featureID any, outputSRID domain.SRID, axisOrder domain.AxisOrder, profile domain.Profile) (*domain.Feature, error)

	// GetFeatureIDs returns all IDs of Features matching the given criteria, as well as Cursors for pagination.
	// To be used in concert with GetFeaturesByID
	GetFeatureIDs(ctx context.Context, collection string, criteria FeaturesCriteria) ([]int64, domain.Cursors, error)

	// GetFeaturesByID returns a collection of Features with the given IDs. To be used in concert with GetFeatureIDs
	GetFeaturesByID(ctx context.Context, collection string, featureIDs []int64, axisOrder domain.AxisOrder, profile domain.Profile) (*domain.FeatureCollection, error)

	// SearchFeaturesAcrossCollections search features in one or more collections. Collections can be located
	// in this dataset or in other datasets.
	SearchFeaturesAcrossCollections(ctx context.Context, criteria FeaturesSearchCriteria, axisOrder domain.AxisOrder, collections searchdomain.CollectionsWithParams) (*domain.FeatureCollection, error)

	// GetSchema returns the schema (fields, data types, descriptions, etc.) of the table associated with the given collection.
	// Along with configured queryables (= fields that can be used in filters), optionally enriched with allowed values.
	GetSchema(collection string) (*domain.Schema, Queryables, error)

	// GetCollectionType returns the type of data in the given collection, e.g. 'features' or 'attributes'.
	GetCollectionType(collection string) (geospatial.CollectionType, string, error)

	// SupportsOnTheFlyTransformation returns whether the datasource supports coordinate transformation/reprojection on-the-fly
	SupportsOnTheFlyTransformation() bool

	// Close closes (connections to) the datasource gracefully
	Close()
}

Datasource holds all Features for a single object type in a specific projection/CRS. This abstraction allows the rest of the system to stay datastore agnostic <== IMPORTANT.

type FeaturesCriteria

type FeaturesCriteria struct {
	// pagination (OAF part 1)
	Cursor domain.DecodedCursor
	Limit  int

	// multiple projections support (OAF part 2)
	InputSRID  domain.SRID // derived from bbox or filter param when available, or WGS84 as default
	OutputSRID domain.SRID // derived from crs param when available, or WGS84 as default

	// filtering by bounding box (OAF part 1)
	Bbox *geom.Bounds

	// filtering by reference date/time (OAF part 1)
	TemporalCriteria TemporalCriteria

	// filtering by properties (OAF part 1)
	PropertyFilters map[string]string

	// filtering by CQL (OAF part 3)
	Filter Part3Filter
}

FeaturesCriteria to select a certain set of Features.

type FeaturesSearchCriteria added in v1.5.0

type FeaturesSearchCriteria struct {
	// the search query after query expansion
	SearchQuery searchdomain.SearchQuery

	// global search settings
	Settings config.SearchSettings

	// search doesn't use pagination, we just return the top N results as indicated by the specified limit
	Limit int

	// multiple projections support (OAF part 2)
	InputSRID  domain.SRID // derived from bbox param when available, or WGS84 as default
	OutputSRID domain.SRID // derived from crs param when available, or WGS84 as default

	// filtering by bounding box (OAF part 1)
	Bbox *geom.Bounds
}

FeaturesSearchCriteria to search features (geocoding).

type Part3Filter added in v1.7.12

type Part3Filter struct {
	// SQL after parsing the provided CQL.
	SQL string

	// Named parameters used in SQL
	Params map[string]any

	// Optional SQL to include/check the RTree index for optimal performance (only for gpkg).
	RtreeSQL string
}

Part3Filter OAF part 3 filter based on CQL (Common Query Language).

type QueryableWithAllowedValues added in v1.9.2

type QueryableWithAllowedValues struct {
	domain.Field

	// static or dynamic values that are allowed to be used in this queryable
	AllowedValues []string
}

QueryableWithAllowedValues a field from the datasource that can be used as a "queryable", optionally enriched with allowed values. A "queryable" is a field that can be used in a filter (part 1 filter or part 3 CQL filter).

type Queryables added in v1.9.2

type Queryables map[string]QueryableWithAllowedValues

Queryables one or more QueryableWithAllowedValues indexed by queryable name.

func (Queryables) Fields added in v1.9.3

func (q Queryables) Fields() []domain.Field

Fields flatten queryables to a slice of fields.

type TemporalCriteria

type TemporalCriteria struct {
	// reference date
	ReferenceDate time.Time

	// startDate and endDate properties
	StartDateProperty string
	EndDateProperty   string
}

TemporalCriteria criteria to filter based on date/time.

Directories

Path Synopsis
encoding
Package encoding based on https://github.com/go-spatial/geom/blob/master/encoding/gpkg/binary_header.go
Package encoding based on https://github.com/go-spatial/geom/blob/master/encoding/gpkg/binary_header.go

Jump to

Keyboard shortcuts

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