github.com/PDOK/gokoala@v0.50.6/internal/ogc/features/domain/jsonfg.go (about) 1 package domain 2 3 import ( 4 "github.com/go-spatial/geom" 5 ) 6 7 const ( 8 ConformanceJSONFGCore = "http://www.opengis.net/spec/json-fg-1/0.2/conf/core" 9 ) 10 11 // featureType allows the type for Feature to be automatically set during json Marshalling 12 type featureType struct{} 13 14 func (ft *featureType) MarshalJSON() ([]byte, error) { 15 return []byte(`"Feature"`), nil 16 } 17 18 type JSONFGFeatureCollection struct { 19 Type featureCollectionType `json:"type"` 20 Timestamp string `json:"timeStamp,omitempty"` 21 CoordRefSys string `json:"coordRefSys"` 22 Links []Link `json:"links,omitempty"` 23 ConformsTo []string `json:"conformsTo"` 24 Features []*JSONFGFeature `json:"features"` 25 NumberReturned int `json:"numberReturned"` 26 } 27 28 type JSONFGFeature struct { 29 Type featureType `json:"type"` 30 Time any `json:"time"` 31 // we don't implement the JSON-FG "3D" conformance class. So Place only 32 // supports simple/2D geometries, no 3D geometries like Polyhedron, Prism, etc. 33 Place geom.Geometry `json:"place"` // may only contain non-WGS84 geometries 34 Geometry geom.Geometry `json:"geometry"` // may only contain WGS84 geometries 35 Properties map[string]any `json:"properties"` 36 CoordRefSys string `json:"coordRefSys,omitempty"` 37 Links []Link `json:"links,omitempty"` 38 ConformsTo []string `json:"conformsTo,omitempty"` 39 // We expect feature ids to be auto-incrementing integers (which is the default in geopackages) 40 // since we use it for cursor-based pagination. 41 ID int64 `json:"id"` 42 }