forked from ravendb/ravendb-go-client
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathspatial_options.go
36 lines (32 loc) · 1.22 KB
/
spatial_options.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
package ravendb
const (
//about 4.78 meters at equator, should be good enough (see: http://unterbahn.com/2009/11/metric-dimensions-of-geohash-partitions-at-the-equator/)
SpatialOptionsDefaultGeohashLevel = 9
//about 4.78 meters at equator, should be good enough
SpatialOptionsDefaultQuadTreeLevel = 23
)
/// SpatialOptions describes spatial options
type SpatialOptions struct {
Type SpatialFieldType `json:"Type"`
Strategy SpatialSearchStrategy `json:"Strategy"`
MaxTreeLevel int `json:"MaxTreeLevel"`
MinX float64 `json:"MinX"`
MaxX float64 `json:"MaxX"`
MinY float64 `json:"MinY"`
MaxY float64 `json:"MaxY"`
// Circle radius units, only used for geography indexes
Units SpatialUnits `json:"Units"`
}
// NewSpatialOptions returns new SpatialOptions with default values
func NewSpatialOptions() *SpatialOptions {
return &SpatialOptions{
Type: SpatialFieldGeography,
Strategy: SpatialSearchStrategyGeohashPrefixTree,
MaxTreeLevel: SpatialOptionsDefaultGeohashLevel,
MinX: -180,
MaxX: 180,
MinY: -90,
MaxY: 90,
Units: SpatialUnitsKilometers,
}
}