Documentation ¶
Index ¶
- Constants
- func CellKey(id uint32) []byte
- func CellPrefix() byte
- func CellUnionToToken(cu s2.CellUnion) string
- func CellUnionToTokens(cu s2.CellUnion) []string
- func CoordinatesFromLoops(l *s2.Loop) []float64
- func FeatureKey(id uint32) []byte
- func FeaturePrefix() byte
- func GeoJSONCoverCellUnion(f *geojson.Feature, coverer *s2.RegionCoverer, interior bool) ([]s2.CellUnion, error)
- func GeoJSONEncodeLoops(f *geojson.Feature) ([][]byte, error)
- func InfoKey() []byte
- func InsideKey(c s2.CellID) []byte
- func InsideRangeKeys(c s2.CellID) ([]byte, []byte)
- func LoopFromCoordinates(c []float64) *s2.Loop
- func MapKey() []byte
- func OutsideKey(c s2.CellID) []byte
- func OutsideRangeKeys(c s2.CellID) ([]byte, []byte)
- func PropertiesToValues(f *Feature) (map[string]*spb.Value, error)
- func ValueToProperties(src map[string]*spb.Value) map[string]interface{}
- type CellsStorage
- type Feature
- type FeatureIndexResponse
- type FeatureStorage
- type Index
- type IndexInfos
- type IndexResponse
- type MapInfos
- type Store
Constants ¶
const ( // reserved T & t for tiles TilesURLPrefix byte = 't' TilesPrefix byte = 'T' InsideTreeStrategy = "insidetree" DBStrategy = "db" ShapeIndexStrategy = "shapeindex" PostgisIndexStrategy = "postgis" )
Variables ¶
This section is empty.
Functions ¶
func CellUnionToToken ¶
CellUnionToToken return a comma separated list of tokens
func CellUnionToTokens ¶
CellUnionToTokens a cell union to a token string list
func CoordinatesFromLoops ¶
CoordinatesFromLoops returns []float64 as lng lat adding 1st as last suitable for GeoJSON
func FeaturePrefix ¶
func FeaturePrefix() byte
FeaturePrefix returns the key prefix for features entry
func GeoJSONCoverCellUnion ¶
func GeoJSONCoverCellUnion(f *geojson.Feature, coverer *s2.RegionCoverer, interior bool) ([]s2.CellUnion, error)
GeoJSONCoverCellUnion generates an s2 cover normalized
func GeoJSONEncodeLoops ¶
GeoJSONEncodeLoops encodes all MultiPolygons and Polygons as loops []byte
func InsideRangeKeys ¶
InsideRangeKeys returns the min and max range keys for c
func LoopFromCoordinates ¶
LoopFromCoordinates creates a LoopFence from a list of lng lat
func OutsideKey ¶
func OutsideRangeKeys ¶
OutsideRangeKeys returns the min and max range keys for c
func PropertiesToValues ¶
PropertiesToValues converts feature's properties to protobuf Value
Types ¶
type CellsStorage ¶
type CellsStorage struct { // Cells inside cover CellsIn []s2.CellUnion // Cells outside cover CellsOut []s2.CellUnion }
CellsStorage are used to store indexed cells for use with the treeindex
type FeatureIndexResponse ¶
type FeatureIndexResponse struct { // id of the feature ID uint32 // index of the polygon (in case of multipolygon) Pos uint16 }
FeatureIndexResponse a feature response to find back a feature from an index.
type FeatureStorage ¶
type FeatureStorage struct { Properties map[string]interface{} // Next entries are arrays since a multipolygon may contains multiple loop // LoopsBytes encoded with s2 Loop encoder LoopsBytes [][]byte }
FeatureStorage on disk storage of the feature
type Index ¶
type Index interface { // Stab returns ids of polygon we are inside and polygons we may be inside Stab(lat, lng float64) (IndexResponse, error) }
Index offers different strategy indexers to speed up queries.
type IndexInfos ¶
type IndexInfos struct { Filename string IndexTime time.Time IndexerVersion string FeatureCount uint32 MinCoverLevel int }
IndexInfos used to store information about the index in DB
func (*IndexInfos) String ¶
func (infos *IndexInfos) String() string
type IndexResponse ¶
type IndexResponse struct { IDsInside []FeatureIndexResponse IDsMayBeInside []FeatureIndexResponse }
IndexResponse a response to find back a feature from an index.
type Store ¶
type Store interface { LoadFeature(id uint32) (*Feature, error) LoadAllFeatures(add func(*FeatureStorage, uint32) error) error LoadFeaturesCells(add func([]s2.CellUnion, []s2.CellUnion, uint32)) error LoadCellStorage(id uint32) (*CellsStorage, error) LoadIndexInfos() (*IndexInfos, error) LoadMapInfos() (*MapInfos, bool, error) StabDB(lat, lng float64, StopOnInsideFound bool) (IndexResponse, error) Index(fc geojson.FeatureCollection, icoverer *s2.RegionCoverer, ocoverer *s2.RegionCoverer, warningCellsCover int, fileName, version string) error }