Documentation ¶
Index ¶
- Constants
- func MapRowsToFeatures(rows *sqlx.Rows, fidColumn string, externalFidColumn string, geomColumn string, ...) ([]*Feature, *PrevNextFID, error)
- type ContentCrs
- type Cursors
- type DecodedCursor
- type EncodedCursor
- type Feature
- type FeatureCollection
- type JSONFGFeature
- type JSONFGFeatureCollection
- type Link
- type MapGeom
- type MapRelation
- type PrevNextFID
- type Profile
- type ProfileName
- type SRID
Constants ¶
const ( CrsURIPrefix = "http://www.opengis.net/def/crs/" UndefinedSRID = 0 WGS84SRID = 100000 // We use the SRID for CRS84 (WGS84) as defined in the GeoPackage, instead of EPSG:4326 (due to axis order). In time, we may need to read this value dynamically from the GeoPackage. WGS84CodeOGC = "CRS84" WGS84CrsURI = CrsURIPrefix + "OGC/1.3/" + WGS84CodeOGC )
const (
ConformanceJSONFGCore = "http://www.opengis.net/spec/json-fg-1/0.2/conf/core"
)
Variables ¶
This section is empty.
Functions ¶
func MapRowsToFeatures ¶
func MapRowsToFeatures(rows *sqlx.Rows, fidColumn string, externalFidColumn string, geomColumn string, mapGeom MapGeom, mapRel MapRelation) ([]*Feature, *PrevNextFID, error)
MapRowsToFeatures datasource agnostic mapper from SQL rows/result set to Features domain model
Types ¶
type ContentCrs ¶ added in v0.52.2
type ContentCrs string
ContentCrs the coordinate reference system (represented as a URI) of the content/output to return.
func (ContentCrs) IsWGS84 ¶ added in v0.52.2
func (c ContentCrs) IsWGS84() bool
func (ContentCrs) ToLink ¶ added in v0.52.2
func (c ContentCrs) ToLink() string
ToLink returns link target conforming to RFC 8288
type Cursors ¶
type Cursors struct { Prev EncodedCursor Next EncodedCursor HasPrev bool HasNext bool }
Cursors holds next and previous cursor. Note that we use 'cursor-based pagination' as opposed to 'offset-based pagination'
func NewCursors ¶
func NewCursors(fid PrevNextFID, filtersChecksum []byte) Cursors
NewCursors create Cursors based on the prev/next feature ids from the datasource and the provided filters (captured in a hash).
type DecodedCursor ¶
DecodedCursor the cursor values after decoding EncodedCursor
type EncodedCursor ¶
type EncodedCursor string
EncodedCursor is a scrambled string representation of the fields defined in DecodedCursor
func (EncodedCursor) Decode ¶
func (c EncodedCursor) Decode(filtersChecksum []byte) DecodedCursor
Decode turns encoded cursor into DecodedCursor and verifies that the checksum of query params that act as filters hasn't changed
func (EncodedCursor) String ¶
func (c EncodedCursor) String() string
type Feature ¶
type Feature struct { geojson.Feature // we overwrite ID since we want to make it a required attribute. We also expect feature ids to be // auto-incrementing integers (which is the default in geopackages) since we use it for cursor-based pagination. ID string `json:"id"` Links []Link `json:"links,omitempty"` }
Feature is a GeoJSON Feature with extras such as links
type FeatureCollection ¶
type FeatureCollection struct { Type featureCollectionType `json:"type"` Timestamp string `json:"timeStamp,omitempty"` Links []Link `json:"links,omitempty"` Features []*Feature `json:"features"` NumberReturned int `json:"numberReturned"` }
FeatureCollection is a GeoJSON FeatureCollection with extras such as links
type JSONFGFeature ¶
type JSONFGFeature struct { // We expect feature ids to be auto-incrementing integers (which is the default in geopackages) // since we use it for cursor-based pagination. ID string `json:"id"` Type featureType `json:"type"` Time any `json:"time"` // we don't implement the JSON-FG "3D" conformance class. So Place only // supports simple/2D geometries, no 3D geometries like Polyhedron, Prism, etc. Place geom.Geometry `json:"place"` // may only contain non-WGS84 geometries Geometry geom.Geometry `json:"geometry"` // may only contain WGS84 geometries Properties map[string]any `json:"properties"` CoordRefSys string `json:"coordRefSys,omitempty"` Links []Link `json:"links,omitempty"` ConformsTo []string `json:"conformsTo,omitempty"` }
type JSONFGFeatureCollection ¶
type JSONFGFeatureCollection struct { Type featureCollectionType `json:"type"` Timestamp string `json:"timeStamp,omitempty"` CoordRefSys string `json:"coordRefSys"` Links []Link `json:"links,omitempty"` ConformsTo []string `json:"conformsTo"` Features []*JSONFGFeature `json:"features"` NumberReturned int `json:"numberReturned"` }
type Link ¶
type Link struct { Rel string `json:"rel"` Title string `json:"title,omitempty"` Type string `json:"type,omitempty"` Href string `json:"href"` Hreflang string `json:"hreflang,omitempty"` Length int64 `json:"length,omitempty"` Templated bool `json:"templated,omitempty"` }
Link according to RFC 8288, https://datatracker.ietf.org/doc/html/rfc8288
type MapGeom ¶ added in v0.53.0
MapGeom abstract function type to map geometry from bytes to Geometry
type MapRelation ¶ added in v0.53.0
type MapRelation func(columnName string, columnValue any, externalFidColumn string) (newColumnName string, newColumnValue any)
MapRelation abstract function type to map feature relations
type PrevNextFID ¶
PrevNextFID previous and next feature id (fid) to encode in cursor.
func MapRowsToFeatureIDs ¶
func MapRowsToFeatureIDs(rows *sqlx.Rows) (featureIDs []int64, prevNextID *PrevNextFID, err error)
MapRowsToFeatureIDs datasource agnostic mapper from SQL rows set feature IDs, including prev/next feature ID
type Profile ¶ added in v0.53.0
type Profile struct {
// contains filtered or unexported fields
}
Profile from OAF Part 5, used to express relations between features
func NewProfile ¶ added in v0.53.0
func NewProfile(profileName ProfileName, baseURL url.URL, collectionNames []string) Profile
type ProfileName ¶ added in v0.53.0
type ProfileName string
const ( RelAsKey ProfileName = "rel-as-key" // RelAsKey a feature reference in the response SHALL be represented by: The featureId RelAsURI ProfileName = "rel-as-uri" // RelAsURI a feature reference in the response SHALL be represented by: an HTTP(S) URI. RelAsLink ProfileName = "rel-as-link" // RelAsLink a feature reference in the response SHALL be represented by: an object with the property "href" and, optionally a "title" )
Profiles from OAF Part 5 as specified in https://docs.ogc.org/DRAFTS/23-058r1.html#rc_profile-parameter
type SRID ¶ added in v0.52.2
type SRID int
SRID Spatial Reference System Identifier: a unique value to unambiguously identify a spatial coordinate system. For example '28992' in https://www.opengis.net/def/crs/EPSG/0/28992