geojson

package
v0.0.0-...-2c24670 Latest Latest
Warning

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

Go to latest
Published: Feb 23, 2022 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package geojson contains an interface and various structs for 2d and 3d geometry that correspond to the geojson(http://geojson.org/) format.

Index

Constants

View Source
const (
	PointType   = "Point"
	PolygonType = "Polygon"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Geometry

type Geometry interface {
	bson.Getter
	Type() string
	Coordinates() string
	GeoJSON() []byte
}

type Point

type Point [2]float64

func NewPoint

func NewPoint(lat float64, lng float64) Point

GeoJson stores points as [lng, lat], everywhere else we use lat, lng

func (*Point) Coordinates

func (p *Point) Coordinates() string

Coordinates is the coordinates.

func (*Point) GeoJSON

func (p *Point) GeoJSON() []byte

GeoJSON formats to GeoJSON: {type : "point", coordinates : [lat, lng]}

func (*Point) GetBSON

func (p *Point) GetBSON() (interface{}, error)

func (Point) Lat

func (p Point) Lat() float64

func (Point) Lng

func (p Point) Lng() float64

func (*Point) String

func (p *Point) String() string

func (*Point) Type

func (p *Point) Type() string

Type is the type.

type Polygon

type Polygon []Point

func (Polygon) Coordinates

func (poly Polygon) Coordinates() string

func (Polygon) GeoJSON

func (poly Polygon) GeoJSON() []byte

func (Polygon) GetBSON

func (poly Polygon) GetBSON() (interface{}, error)

func (Polygon) Type

func (poly Polygon) Type() string

Jump to

Keyboard shortcuts

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