application

package
v0.19.0 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2025 License: BSD-3-Clause Imports: 13 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type SpatialApplication

type SpatialApplication struct {
	SpatialDatabase  database.SpatialDatabase
	PropertiesReader reader.Reader
	Timings          []*timings.SinceResponse
	Monitor          timings.Monitor
	// contains filtered or unexported fields
}

SpatialApplication a bunch of different operations related to indexing and querying spatial data in to a single "container" struct with pointers to underlying instances (like a SpatialDatabase) as well as a handful of methods for automating common operations (like indexing records). To be honest, I am kind of ambivalent about this but it is handy for creating spatial "applications" (like point-in-polygon operations) when the underlying spatial database is an in-memory RTree and everything needs to be indexed before the operation in question can occur. When you create a new SpatialApplication instance (by calling `NewSpatialApplication`) here's what happens:

  • A new `database.SpatialDatabase` instance is created and made available as a public 'SpatialDatabase' property .
  • A new `reader.Reader` instance is created and made available a public 'PropertiesReader' property. This reader is intended for use by methods like `PropertiesResponseResultsWithStandardPlacesResults` which is what appends custom properties to SPR responses (for example, in a point-in-polygon result set).
  • If custom placetypes are defined these will be loaded an appended to the default `whosonfirst/go-whosonfirst-placetype` specification. This can be useful if you are working with non-standard Who's On First style records that define their own placetypes.

func NewSpatialApplication

func NewSpatialApplication(ctx context.Context, opts *SpatialApplicationOptions) (*SpatialApplication, error)

NewSpatialApplication returns a new `SpatialApplication` instance.

func (*SpatialApplication) Close

func (p *SpatialApplication) Close(ctx context.Context) error

Close() will terminate an spatial database connections and stop any internal timing monitors.

func (*SpatialApplication) IndexDatabaseWithIterators added in v0.11.0

func (p *SpatialApplication) IndexDatabaseWithIterators(ctx context.Context, sources map[string][]string) error

func (*SpatialApplication) Indexed added in v0.11.0

func (p *SpatialApplication) Indexed() int64

func (*SpatialApplication) IsIndexing added in v0.11.0

func (p *SpatialApplication) IsIndexing() bool

type SpatialApplicationOptions

type SpatialApplicationOptions struct {
	// A valid `whosonfirst/go-whosonfirst-spatial/database` URI.
	SpatialDatabaseURI string
	// A valid `whosonfirst/go-reader` URI.
	PropertiesReaderURI string
	// EnableCustomPlacetypes signals that custom placetypes should be appended to the default placetype specification.
	EnableCustomPlacetypes bool
	// A JSON-encoded `whosonfirst/go-whosonfirst-placetypes.WOFPlacetypeSpecification` definition with custom placetypes.
	CustomPlacetypes string
}

SpatialApplicationOptions defines properties used to instantiate a new `SpatialApplication` instance.

Jump to

Keyboard shortcuts

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