flatgeobuf

package module
v0.0.0-...-e4eb1ea Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2024 License: BSD-2-Clause Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Behavior

type Behavior int

Behavior defines the way the flatgeobuf file will be handled.

const (
	// BehaviorUnknown is the default. It has no effect at all when used.
	BehaviorUnknown Behavior = 0

	// BehaviorMMapAll forces all data to be used directly from the mmapped
	// file. Incompatible with BehaviorLoadAll being set.
	BehaviorMMapAll Behavior = 1 << (iota - 1)

	// BehaviorLoadAll forces all data to be loaded into memory. Incompatible
	// with BehaviorMMapAll being set.
	BehaviorLoadAll

	// BehaviorLoadIndex copies the index from the mmaped file to RAM so
	// that it will always be available. Note that this will increase overall
	// memory usage (cached data + in-memory data). Does nothing if
	// BehaviorLoadAll is set.
	BehaviorLoadIndex

	// BehaviorPrefault forces mmapped data to be prefaulted. This will load
	// as much data as possible from the mmaped file into de disk cache memory.
	// Does nothing if BehaviorMMapAll is not set.
	BehaviorPrefault
)

type FlatGeoBuf

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

FlatGeoBuf allows read-only handling of a flatgeobuf file.

func New

func New(path string) (*FlatGeoBuf, error)

New creates a new FlatGeoBuf instance from a file path by memory mapping the file.

func NewWithBehavior

func NewWithBehavior(path string, behavior Behavior) (*FlatGeoBuf, error)

NewWithBehavior creates a new FlatGeoBuf instance from a file path with the given behavior.

func NewWithData

func NewWithData(data []byte) (*FlatGeoBuf, error)

NewWithMockedData creates a new FlatGeoBuf from the given byte slice. The contents of the slice should be the same of a valid flatgeobuf file.

func (*FlatGeoBuf) Header

func (fgb *FlatGeoBuf) Header() *flattypes.Header

Header allows access to the underlying flatgeobuf header in flatbuffer format.

func (*FlatGeoBuf) Search

func (fgb *FlatGeoBuf) Search(minX, minY, maxX, maxY float64) ([]*flattypes.Feature, error)

Search allows searching for data with the index built into the flatgeobuf file. If the file does not include an index, returns a nil Feature slice and a non-nil error. Otherwise returns a slice of the matched Features and a nil error.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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