Documentation ¶
Index ¶
- Constants
- Variables
- func DeduplicateTerms(terms []string) []string
- func FilterGeoShapesOnRelation(shape index.GeoJSON, targetShapeBytes []byte, relation string, ...) (bool, error)
- func NewGeoCircle(points []float64, radius string) index.GeoJSON
- func NewGeoEnvelope(points [][]float64) index.GeoJSON
- func NewGeoJsonLinestring(points [][]float64) index.GeoJSON
- func NewGeoJsonMultiPoint(v [][]float64) index.GeoJSON
- func NewGeoJsonMultiPolygon(points [][][][]float64) index.GeoJSON
- func NewGeoJsonMultilinestring(points [][][]float64) index.GeoJSON
- func NewGeoJsonPoint(v []float64) index.GeoJSON
- func NewGeoJsonPolygon(points [][][]float64) index.GeoJSON
- func NewGeoJsonShape(coordinates [][][][]float64, typ string) (index.GeoJSON, []byte, error)
- func NewGeometryCollection(coordinates [][][][][]float64, typs []string) (index.GeoJSON, []byte, error)
- func ParseDistance(d string) (float64, error)
- func ParseGeoJSONShape(input []byte) (index.GeoJSON, error)
- func StripCoveringTerms(terms []string) []string
- type Circle
- func (c *Circle) Contains(other index.GeoJSON) (bool, error)
- func (c *Circle) IndexTokens(s *s2.RegionTermIndexer) []string
- func (c *Circle) Intersects(other index.GeoJSON) (bool, error)
- func (c *Circle) Marshal() ([]byte, error)
- func (c *Circle) QueryTokens(s *s2.RegionTermIndexer) []string
- func (c *Circle) Type() string
- func (c *Circle) UnmarshalJSON(data []byte) error
- func (c *Circle) Value() ([]byte, error)
- type Envelope
- func (e *Envelope) Contains(other index.GeoJSON) (bool, error)
- func (e *Envelope) IndexTokens(s *s2.RegionTermIndexer) []string
- func (e *Envelope) Intersects(other index.GeoJSON) (bool, error)
- func (e *Envelope) Marshal() ([]byte, error)
- func (e *Envelope) QueryTokens(s *s2.RegionTermIndexer) []string
- func (e *Envelope) Type() string
- func (e *Envelope) Value() ([]byte, error)
- type GeometryCollection
- func (gc *GeometryCollection) Contains(other index.GeoJSON) (bool, error)
- func (gc *GeometryCollection) Intersects(other index.GeoJSON) (bool, error)
- func (gc *GeometryCollection) Marshal() ([]byte, error)
- func (gc *GeometryCollection) Members() []index.GeoJSON
- func (gc *GeometryCollection) Type() string
- func (gc *GeometryCollection) UnmarshalJSON(data []byte) error
- func (gc *GeometryCollection) Value() ([]byte, error)
- type LineString
- func (ls *LineString) Contains(other index.GeoJSON) (bool, error)
- func (ls *LineString) Coordinates() [][]float64
- func (ls *LineString) IndexTokens(s *s2.RegionTermIndexer) []string
- func (ls *LineString) Intersects(other index.GeoJSON) (bool, error)
- func (ls *LineString) Marshal() ([]byte, error)
- func (ls *LineString) QueryTokens(s *s2.RegionTermIndexer) []string
- func (ls *LineString) Type() string
- func (ls *LineString) Value() ([]byte, error)
- type MultiLineString
- func (p *MultiLineString) Contains(other index.GeoJSON) (bool, error)
- func (p *MultiLineString) Coordinates() [][][]float64
- func (mls *MultiLineString) IndexTokens(s *s2.RegionTermIndexer) []string
- func (p *MultiLineString) Intersects(other index.GeoJSON) (bool, error)
- func (mls *MultiLineString) Marshal() ([]byte, error)
- func (p *MultiLineString) Members() []index.GeoJSON
- func (mls *MultiLineString) QueryTokens(s *s2.RegionTermIndexer) []string
- func (mls *MultiLineString) Type() string
- func (mls *MultiLineString) Value() ([]byte, error)
- type MultiPoint
- func (p *MultiPoint) Contains(other index.GeoJSON) (bool, error)
- func (p *MultiPoint) Coordinates() [][]float64
- func (mp *MultiPoint) IndexTokens(s *s2.RegionTermIndexer) []string
- func (p *MultiPoint) Intersects(other index.GeoJSON) (bool, error)
- func (p *MultiPoint) Marshal() ([]byte, error)
- func (p *MultiPoint) Members() []index.GeoJSON
- func (mp *MultiPoint) QueryTokens(s *s2.RegionTermIndexer) []string
- func (p *MultiPoint) Type() string
- func (mp *MultiPoint) Value() ([]byte, error)
- type MultiPolygon
- func (p *MultiPolygon) Contains(other index.GeoJSON) (bool, error)
- func (p *MultiPolygon) Coordinates() [][][][]float64
- func (mp *MultiPolygon) IndexTokens(s *s2.RegionTermIndexer) []string
- func (p *MultiPolygon) Intersects(other index.GeoJSON) (bool, error)
- func (p *MultiPolygon) Marshal() ([]byte, error)
- func (p *MultiPolygon) Members() []index.GeoJSON
- func (mp *MultiPolygon) QueryTokens(s *s2.RegionTermIndexer) []string
- func (p *MultiPolygon) Type() string
- func (p *MultiPolygon) Value() ([]byte, error)
- type Point
- func (p *Point) Contains(other index.GeoJSON) (bool, error)
- func (p *Point) Coordinates() []float64
- func (p *Point) IndexTokens(s *s2.RegionTermIndexer) []string
- func (p *Point) Intersects(other index.GeoJSON) (bool, error)
- func (p *Point) Marshal() ([]byte, error)
- func (p *Point) QueryTokens(s *s2.RegionTermIndexer) []string
- func (p *Point) Type() string
- func (p *Point) Value() ([]byte, error)
- type Polygon
- func (p *Polygon) Contains(other index.GeoJSON) (bool, error)
- func (p *Polygon) Coordinates() [][][]float64
- func (pgn *Polygon) IndexTokens(s *s2.RegionTermIndexer) []string
- func (p *Polygon) Intersects(other index.GeoJSON) (bool, error)
- func (p *Polygon) Marshal() ([]byte, error)
- func (pgn *Polygon) QueryTokens(s *s2.RegionTermIndexer) []string
- func (p *Polygon) Type() string
- func (p *Polygon) Value() ([]byte, error)
Constants ¶
const ( PointType = "point" MultiPointType = "multipoint" LineStringType = "linestring" MultiLineStringType = "multilinestring" PolygonType = "polygon" MultiPolygonType = "multipolygon" GeometryCollectionType = "geometrycollection" CircleType = "circle" EnvelopeType = "envelope" )
const ( PointTypePrefix = byte(1) MultiPointTypePrefix = byte(2) LineStringTypePrefix = byte(3) MultiLineStringTypePrefix = byte(4) PolygonTypePrefix = byte(5) MultiPolygonTypePrefix = byte(6) GeometryCollectionTypePrefix = byte(7) CircleTypePrefix = byte(8) EnvelopeTypePrefix = byte(9) )
These are the byte prefixes for identifying the shape contained within the doc values byte slice while decoding the contents during the query filtering phase.
Variables ¶
var GlueBytes = []byte("##")
GlueBytes primarily for quicker filtering of docvalues during the filtering phase.
Functions ¶
func DeduplicateTerms ¶
func FilterGeoShapesOnRelation ¶
func FilterGeoShapesOnRelation(shape index.GeoJSON, targetShapeBytes []byte, relation string, reader **bytes.Reader, bufPool *s2.GeoBufferPool) (bool, error)
FilterGeoShapesOnRelation extracts the shapes in the document, apply the `relation` filter and confirms whether the shape in the document
satisfies the given relation.
func NewGeoEnvelope ¶
func NewGeoJsonLinestring ¶
func NewGeoJsonMultiPoint ¶
func NewGeoJsonMultiPolygon ¶
func NewGeoJsonPoint ¶
func NewGeoJsonPolygon ¶
func NewGeoJsonShape ¶
NewGeoJsonShape instantiate a geojson shape/circle or an envelope from the given coordinates and type.
func NewGeometryCollection ¶
func NewGeometryCollection(coordinates [][][][][]float64, typs []string) (index.GeoJSON, []byte, error)
NewGeometryCollection instantiate a geometrycollection and prefix the byte contents with certain glue bytes that can be used later while filering the doc values.
func ParseDistance ¶
ParseDistance attempts to parse a distance string and return distance in meters. Example formats supported: "5in" "5inch" "7yd" "7yards" "9ft" "9feet" "11km" "11kilometers" "3nm" "3nauticalmiles" "13mm" "13millimeters" "15cm" "15centimeters" "17mi" "17miles" "19m" "19meters" If the unit cannot be determined, the entire string is parsed and the unit of meters is assumed. If the number portion cannot be parsed, 0 and the parse error are returned.
func ParseGeoJSONShape ¶
ParseGeoJSONShape unmarshals the geojson/circle/envelope shape embedded in the given bytes.
func StripCoveringTerms ¶
Types ¶
type Circle ¶
type Circle struct { Typ string `json:"type"` Vertices []float64 `json:"coordinates"` Radius string `json:"radius"` // contains filtered or unexported fields }
-------------------------------------------------------- Circle represents a custom circle type and it implements the index.GeoJSON interface.
func NewGeoCircleShape ¶
NewGeoCircleShape instantiate a circle shape and prefix the byte contents with certain glue bytes that can be used later while filering the doc values.
func (*Circle) IndexTokens ¶
func (c *Circle) IndexTokens(s *s2.RegionTermIndexer) []string
func (*Circle) QueryTokens ¶
func (c *Circle) QueryTokens(s *s2.RegionTermIndexer) []string
func (*Circle) UnmarshalJSON ¶
type Envelope ¶
type Envelope struct { Typ string `json:"type"` Vertices [][]float64 `json:"coordinates"` // contains filtered or unexported fields }
-------------------------------------------------------- Envelope represents the envelope/bounding box type and it implements the index.GeoJSON interface.
func (*Envelope) IndexTokens ¶
func (e *Envelope) IndexTokens(s *s2.RegionTermIndexer) []string
func (*Envelope) QueryTokens ¶
func (e *Envelope) QueryTokens(s *s2.RegionTermIndexer) []string
type GeometryCollection ¶
type GeometryCollection struct { Typ string `json:"type"` Shapes []index.GeoJSON `json:"geometries"` }
-------------------------------------------------------- GeometryCollection represents the geoJSON geometryCollection type and it implements the index.GeoJSON interface as well as the compositeShap interface.
func (*GeometryCollection) Contains ¶
func (gc *GeometryCollection) Contains(other index.GeoJSON) (bool, error)
func (*GeometryCollection) Intersects ¶
func (gc *GeometryCollection) Intersects(other index.GeoJSON) (bool, error)
func (*GeometryCollection) Marshal ¶
func (gc *GeometryCollection) Marshal() ([]byte, error)
func (*GeometryCollection) Members ¶
func (gc *GeometryCollection) Members() []index.GeoJSON
func (*GeometryCollection) Type ¶
func (gc *GeometryCollection) Type() string
func (*GeometryCollection) UnmarshalJSON ¶
func (gc *GeometryCollection) UnmarshalJSON(data []byte) error
func (*GeometryCollection) Value ¶ added in v0.1.13
func (gc *GeometryCollection) Value() ([]byte, error)
type LineString ¶
type LineString struct { Typ string `json:"type"` Vertices [][]float64 `json:"coordinates"` // contains filtered or unexported fields }
-------------------------------------------------------- LineString represents the geoJSON linestring type and it implements the index.GeoJSON interface.
func (*LineString) Coordinates ¶
func (ls *LineString) Coordinates() [][]float64
func (*LineString) IndexTokens ¶
func (ls *LineString) IndexTokens(s *s2.RegionTermIndexer) []string
func (*LineString) Intersects ¶
func (ls *LineString) Intersects(other index.GeoJSON) (bool, error)
func (*LineString) Marshal ¶
func (ls *LineString) Marshal() ([]byte, error)
func (*LineString) QueryTokens ¶
func (ls *LineString) QueryTokens(s *s2.RegionTermIndexer) []string
func (*LineString) Type ¶
func (ls *LineString) Type() string
func (*LineString) Value ¶ added in v0.1.13
func (ls *LineString) Value() ([]byte, error)
type MultiLineString ¶
type MultiLineString struct { Typ string `json:"type"` Vertices [][][]float64 `json:"coordinates"` // contains filtered or unexported fields }
-------------------------------------------------------- MultiLineString represents the geoJSON multilinestring type and it implements the index.GeoJSON interface as well as the compositeShap interface.
func (*MultiLineString) Contains ¶
func (p *MultiLineString) Contains(other index.GeoJSON) (bool, error)
func (*MultiLineString) Coordinates ¶
func (p *MultiLineString) Coordinates() [][][]float64
func (*MultiLineString) IndexTokens ¶
func (mls *MultiLineString) IndexTokens(s *s2.RegionTermIndexer) []string
func (*MultiLineString) Intersects ¶
func (p *MultiLineString) Intersects(other index.GeoJSON) (bool, error)
func (*MultiLineString) Marshal ¶
func (mls *MultiLineString) Marshal() ([]byte, error)
func (*MultiLineString) Members ¶
func (p *MultiLineString) Members() []index.GeoJSON
func (*MultiLineString) QueryTokens ¶
func (mls *MultiLineString) QueryTokens(s *s2.RegionTermIndexer) []string
func (*MultiLineString) Type ¶
func (mls *MultiLineString) Type() string
func (*MultiLineString) Value ¶ added in v0.1.13
func (mls *MultiLineString) Value() ([]byte, error)
type MultiPoint ¶
type MultiPoint struct { Typ string `json:"type"` Vertices [][]float64 `json:"coordinates"` // contains filtered or unexported fields }
-------------------------------------------------------- MultiPoint represents the geoJSON multipoint type and it implements the index.GeoJSON interface as well as the compositeShap interface.
func (*MultiPoint) Coordinates ¶
func (p *MultiPoint) Coordinates() [][]float64
func (*MultiPoint) IndexTokens ¶
func (mp *MultiPoint) IndexTokens(s *s2.RegionTermIndexer) []string
func (*MultiPoint) Intersects ¶
func (p *MultiPoint) Intersects(other index.GeoJSON) (bool, error)
func (*MultiPoint) Marshal ¶
func (p *MultiPoint) Marshal() ([]byte, error)
func (*MultiPoint) Members ¶
func (p *MultiPoint) Members() []index.GeoJSON
func (*MultiPoint) QueryTokens ¶
func (mp *MultiPoint) QueryTokens(s *s2.RegionTermIndexer) []string
func (*MultiPoint) Type ¶
func (p *MultiPoint) Type() string
func (*MultiPoint) Value ¶ added in v0.1.13
func (mp *MultiPoint) Value() ([]byte, error)
type MultiPolygon ¶
type MultiPolygon struct { Typ string `json:"type"` Vertices [][][][]float64 `json:"coordinates"` // contains filtered or unexported fields }
-------------------------------------------------------- MultiPolygon represents the geoJSON multipolygon type and it implements the index.GeoJSON interface as well as the compositeShap interface.
func (*MultiPolygon) Coordinates ¶
func (p *MultiPolygon) Coordinates() [][][][]float64
func (*MultiPolygon) IndexTokens ¶
func (mp *MultiPolygon) IndexTokens(s *s2.RegionTermIndexer) []string
func (*MultiPolygon) Intersects ¶
func (p *MultiPolygon) Intersects(other index.GeoJSON) (bool, error)
func (*MultiPolygon) Marshal ¶
func (p *MultiPolygon) Marshal() ([]byte, error)
func (*MultiPolygon) Members ¶
func (p *MultiPolygon) Members() []index.GeoJSON
func (*MultiPolygon) QueryTokens ¶
func (mp *MultiPolygon) QueryTokens(s *s2.RegionTermIndexer) []string
func (*MultiPolygon) Type ¶
func (p *MultiPolygon) Type() string
func (*MultiPolygon) Value ¶ added in v0.1.13
func (p *MultiPolygon) Value() ([]byte, error)
type Point ¶
type Point struct { Typ string `json:"type"` Vertices []float64 `json:"coordinates"` // contains filtered or unexported fields }
-------------------------------------------------------- Point represents the geoJSON point type and it implements the index.GeoJSON interface.
func (*Point) Coordinates ¶
func (*Point) IndexTokens ¶
func (p *Point) IndexTokens(s *s2.RegionTermIndexer) []string
func (*Point) QueryTokens ¶
func (p *Point) QueryTokens(s *s2.RegionTermIndexer) []string
type Polygon ¶
type Polygon struct { Typ string `json:"type"` Vertices [][][]float64 `json:"coordinates"` // contains filtered or unexported fields }
-------------------------------------------------------- Polygon represents the geoJSON polygon type and it implements the index.GeoJSON interface.
func (*Polygon) Coordinates ¶
func (*Polygon) IndexTokens ¶
func (pgn *Polygon) IndexTokens(s *s2.RegionTermIndexer) []string
func (*Polygon) QueryTokens ¶
func (pgn *Polygon) QueryTokens(s *s2.RegionTermIndexer) []string