continentsdb

package
v0.22.3 Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2021 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DB

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

DB is a descriptor of the Earth's polygons in GeoJSON format.

For correct operation, DB must be created using the constructor (New) based on the required parameters and optional components. After successful creation, The DB is immediately ready to work through API.

func New

func New(prm Prm, opts ...Option) *DB

New creates a new instance of the DB.

Panics if at least one value of the parameters is invalid.

The created DB does not require additional initialization and is completely ready for work.

func (*DB) PointContinent

func (db *DB) PointContinent(point *locodedb.Point) (*locodedb.Continent, error)

PointContinent goes through all polygons, and returns continent in which point is located.

Returns locodedb.ContinentUnknown if no entry matches.

All GeoJSON feature are parsed from file once and stored in memory.

type Option

type Option func(*options)

Option sets an optional parameter of DB.

type Prm

type Prm struct {
	// Path to polygons of Earth's continents in GeoJSON format.
	//
	// Must not be empty.
	Path string
}

Prm groups the required parameters of the DB's constructor.

All values must comply with the requirements imposed on them. Passing incorrect parameter values will result in constructor failure (error or panic depending on the implementation).

Jump to

Keyboard shortcuts

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