collection

package
v0.0.0-...-0108d89 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 25, 2021 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Collection

type Collection struct {
	// contains filtered or unexported fields
}

Collection represents a collection of geojson objects.

func New

func New() *Collection

New creates an empty collection

func (*Collection) Bounds

func (c *Collection) Bounds() (minX, minY, maxX, maxY float64)

Bounds returns the bounds of all the items in the collection.

func (*Collection) Count

func (c *Collection) Count() int

Count returns the number of objects in collection.

func (*Collection) FieldArr

func (c *Collection) FieldArr() []string

FieldArr return an array representation of the field names.

func (*Collection) FieldMap

func (c *Collection) FieldMap() map[string]int

FieldMap return a maps of the field names.

func (*Collection) Get

func (c *Collection) Get(id string) (obj geojson.Object, fields []float64, ok bool)

Get returns an object. If the object does not exist then the 'ok' return value will be false.

func (*Collection) Intersects

func (c *Collection) Intersects(sparse uint8, obj geojson.Object, minLat, minLon, maxLat, maxLon, lat, lon, meters, minZ, maxZ float64, iterator func(id string, obj geojson.Object, fields []float64) bool) bool

Intersects returns all object that are intersect an object or bounding box. Set obj to nil in order to use the bounding box.

func (*Collection) Nearby

func (c *Collection) Nearby(sparse uint8, lat, lon, meters, minZ, maxZ float64, iterator func(id string, obj geojson.Object, fields []float64) bool) bool

Nearby returns all object that are nearby a point.

func (*Collection) NearestNeighbors

func (c *Collection) NearestNeighbors(lat, lon float64, iterator func(id string, obj geojson.Object, fields []float64) bool) bool

func (*Collection) PointCount

func (c *Collection) PointCount() int

PointCount returns the number of points (lat/lon coordinates) in collection.

func (*Collection) Remove

func (c *Collection) Remove(id string) (obj geojson.Object, fields []float64, ok bool)

Remove removes an object and returns it. If the object does not exist then the 'ok' return value will be false.

func (*Collection) ReplaceOrInsert

func (c *Collection) ReplaceOrInsert(id string, obj geojson.Object, fields []string, values []float64) (oldObject geojson.Object, oldFields []float64, newFields []float64)

ReplaceOrInsert adds or replaces an object in the collection and returns the fields array. If an item with the same id is already in the collection then the new item will adopt the old item's fields. The fields argument is optional. The return values are the old object, the old fields, and the new fields

func (*Collection) Scan

func (c *Collection) Scan(desc bool,
	iterator func(id string, obj geojson.Object, fields []float64) bool,
) bool

Scan iterates though the collection ids.

func (*Collection) ScanGreaterOrEqual

func (c *Collection) ScanGreaterOrEqual(id string, desc bool,
	iterator func(id string, obj geojson.Object, fields []float64) bool,
) bool

ScanGreaterOrEqual iterates though the collection starting with specified id.

func (*Collection) ScanRange

func (c *Collection) ScanRange(start, end string, desc bool,
	iterator func(id string, obj geojson.Object, fields []float64) bool,
) bool

ScanGreaterOrEqual iterates though the collection starting with specified id.

func (*Collection) SearchValues

func (c *Collection) SearchValues(desc bool,
	iterator func(id string, obj geojson.Object, fields []float64) bool,
) bool

SearchValues iterates though the collection values.

func (*Collection) SearchValuesRange

func (c *Collection) SearchValuesRange(start, end string, desc bool,
	iterator func(id string, obj geojson.Object, fields []float64) bool,
) bool

SearchValuesRange iterates though the collection values.

func (*Collection) SetField

func (c *Collection) SetField(id, field string, value float64) (obj geojson.Object, fields []float64, updated bool, ok bool)

SetField set a field value for an object and returns that object. If the object does not exist then the 'ok' return value will be false.

func (*Collection) SetFields

func (c *Collection) SetFields(id string, in_fields []string, in_values []float64) (
	obj geojson.Object, fields []float64, updated_count int, ok bool,
)

SetFields is similar to SetField, just setting multiple fields at once

func (*Collection) StringCount

func (c *Collection) StringCount() int

StringCount returns the number of string values.

func (*Collection) TotalWeight

func (c *Collection) TotalWeight() int

TotalWeight calculates the in-memory cost of the collection in bytes.

func (*Collection) Within

func (c *Collection) Within(sparse uint8, obj geojson.Object, minLat, minLon, maxLat, maxLon, lat, lon, meters, minZ, maxZ float64, iterator func(id string, obj geojson.Object, fields []float64) bool) bool

Within returns all object that are fully contained within an object or bounding box. Set obj to nil in order to use the bounding box.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL