geo

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: May 21, 2020 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package geo provides types and functions for geospatial reasoning and indexing purposes.

Index

Constants

View Source
const (
	// DefaultMinimumCellLevel is the default minimum cell level, chosen such
	// that the minimum cell size is ~1km^2.
	DefaultMinimumCellLevel = 13
	// DefaultMaximumCellLevel is the default minimum cell level, chosen such
	// that the maximum cell size is ~1km^2.
	DefaultMaximumCellLevel = 13
)

Variables

View Source
var (

	// RegionCoverer provides an overridable interface to defaultRegionCoverer
	RegionCoverer = defaultRegionCoverer
)

Functions

func AreaToCellIDs

func AreaToCellIDs(area string) (s2.CellUnion, error)

AreaToCellIDs parses "area" in the format 'lat0,lon0,lat1,lon1,...' and returns the resulting s2.CellUnion.

TODO(tvoss):

  • Agree and implement a maximum number of points in area

func Covering

func Covering(points []s2.Point) (s2.CellUnion, error)

Covering calculates the S2 covering of a set of S2 points. Will try the loop in both clockwise and counter clockwise.

func CoveringForLoop

func CoveringForLoop(loop *s2.Loop) (s2.CellUnion, error)

CoveringForLoop calculates an s2 cell covering for loop or returns an area if the area covered by loop is too large.

func DistanceMetersToAngle

func DistanceMetersToAngle(distance float64) s1.Angle

DistanceMetersToAngle converts distance in [m] to an s1.Angle in radians.

Types

type ErrAreaTooLarge

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

ErrAreaTooLarge is the error passed back when the requested Area is larger than maxAllowedAreaKm2

func (*ErrAreaTooLarge) Error

func (e *ErrAreaTooLarge) Error() string

Error returns the error message for ErrAreaTooLarge.

Jump to

Keyboard shortcuts

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