database

package
v0.16.0 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2025 License: BSD-3-Clause Imports: 35 Imported by: 25

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IndexDatabaseWithFS added in v0.6.0

func IndexDatabaseWithFS(ctx context.Context, db SpatialDatabase, index_fs fs.FS) error

IndexDatabaseWithFS will walk the files contained in 'index_fs' indexing each in 'db'

func IndexDatabaseWithIterator added in v0.1.1

func IndexDatabaseWithIterator(ctx context.Context, db SpatialDatabase, iterator_uri string, iterator_sources ...string) error

IndexDatabaseWithIterator is a general-purpose method for indexing a `database.Spatial.Database` instance with a whosonfirst/go-whosonfirst-iterate/v2 iterator. Only records whose geometry type are 'Polygon' or 'MultiPolygon' will be indexed.

func IndexDatabaseWithIterators added in v0.13.1

func IndexDatabaseWithIterators(ctx context.Context, db SpatialDatabase, sources map[string][]string) error

func IndexDatabaseWithReader added in v0.7.2

func IndexDatabaseWithReader(ctx context.Context, db SpatialDatabase, r io.Reader) error

IndexDatabaseWithReader will index the data contained in 'r' in 'db'.

func RegisterSpatialDatabase

func RegisterSpatialDatabase(ctx context.Context, scheme string, f SpatialDatabaseInitializeFunc) error

func Schemes added in v0.0.6

func Schemes() []string

Types

type RTreeCache added in v0.9.0

type RTreeCache struct {
	Geometry *geojson.Geometry        `json:"geometry"`
	SPR      spr.StandardPlacesResult `json:"properties"`
}

type RTreeResults added in v0.9.0

type RTreeResults struct {
	spr.StandardPlacesResults `json:",omitempty"`
	Places                    []spr.StandardPlacesResult `json:"places"`
}

func (*RTreeResults) Results added in v0.9.0

func (r *RTreeResults) Results() []spr.StandardPlacesResult

type RTreeSpatialDatabase added in v0.9.0

type RTreeSpatialDatabase struct {
	SpatialDatabase
	// contains filtered or unexported fields
}

func (*RTreeSpatialDatabase) Disconnect added in v0.9.0

func (r *RTreeSpatialDatabase) Disconnect(ctx context.Context) error

func (*RTreeSpatialDatabase) Flush added in v0.9.0

func (r *RTreeSpatialDatabase) Flush(ctx context.Context) error

func (*RTreeSpatialDatabase) IndexFeature added in v0.9.0

func (r *RTreeSpatialDatabase) IndexFeature(ctx context.Context, body []byte) error

func (*RTreeSpatialDatabase) Intersects added in v0.13.0

func (db *RTreeSpatialDatabase) Intersects(ctx context.Context, geom orb.Geometry, filters ...spatial.Filter) (spr.StandardPlacesResults, error)

func (*RTreeSpatialDatabase) IntersectsWithIterator added in v0.13.0

func (db *RTreeSpatialDatabase) IntersectsWithIterator(ctx context.Context, geom orb.Geometry, filters ...spatial.Filter) iter.Seq2[spr.StandardPlacesResult, error]

func (*RTreeSpatialDatabase) PointInPolygon added in v0.9.0

func (db *RTreeSpatialDatabase) PointInPolygon(ctx context.Context, coord *orb.Point, filters ...spatial.Filter) (spr.StandardPlacesResults, error)

func (*RTreeSpatialDatabase) PointInPolygonWithIterator added in v0.13.0

func (db *RTreeSpatialDatabase) PointInPolygonWithIterator(ctx context.Context, coord *orb.Point, filters ...spatial.Filter) iter.Seq2[spr.StandardPlacesResult, error]

func (*RTreeSpatialDatabase) Read added in v0.9.0

func (*RTreeSpatialDatabase) ReaderURI added in v0.9.0

func (r *RTreeSpatialDatabase) ReaderURI(ctx context.Context, str_uri string) string

func (*RTreeSpatialDatabase) RemoveFeature added in v0.9.0

func (r *RTreeSpatialDatabase) RemoveFeature(ctx context.Context, id string) error

func (*RTreeSpatialDatabase) SetLogger added in v0.9.0

func (r *RTreeSpatialDatabase) SetLogger(ctx context.Context, logger *log.Logger) error

func (*RTreeSpatialDatabase) Write added in v0.9.0

func (r *RTreeSpatialDatabase) Write(ctx context.Context, key string, fh io.ReadSeeker) (int64, error)

func (*RTreeSpatialDatabase) WriterURI added in v0.9.0

func (r *RTreeSpatialDatabase) WriterURI(ctx context.Context, str_uri string) string

type RTreeSpatialIndex added in v0.9.0

type RTreeSpatialIndex struct {
	Rect      *rtreego.Rect
	Id        string
	FeatureId string
	IsAlt     bool
	AltLabel  string
}

func (*RTreeSpatialIndex) Bounds added in v0.9.0

func (i *RTreeSpatialIndex) Bounds() rtreego.Rect

type SpatialDatabase

type SpatialDatabase interface {
	reader.Reader
	writer.Writer
	spatial.SpatialIndex
}

SpatialDatabase is an interface for databases of Who's On First records. It defines no methods of its own but wrap three other interfaces: `whosonfirst/go-reader.Reader`, `whosonfirst/go-writer.Writer` and `whosonfirst/go-whosonfirst-spatial.SpatialIndex`.`

func NewRTreeSpatialDatabase added in v0.9.0

func NewRTreeSpatialDatabase(ctx context.Context, uri string) (SpatialDatabase, error)

func NewSpatialDatabase

func NewSpatialDatabase(ctx context.Context, uri string) (SpatialDatabase, error)

type SpatialDatabaseInitializeFunc

type SpatialDatabaseInitializeFunc func(ctx context.Context, uri string) (SpatialDatabase, error)

Jump to

Keyboard shortcuts

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