s2geojson

package
v0.0.0-...-68b92b3 Latest Latest
Warning

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

Go to latest
Published: Jul 29, 2020 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Feature

type Feature struct {
	Type       Type                   `json:"type"`
	Properties map[string]interface{} `json:"properties"`
	ID         string                 `json:"id,omitempty"`
	Geometry   interface{}            `json:"geometry,omitempty"`
}

Feature represents GeoJSON feature.

func NewFeature

func NewFeature(geometry interface{}) *Feature

NewFeature returns GeoJSON Feature instance from the provided geometry.

type FeatureCollection

type FeatureCollection struct {
	Type     Type       `json:"type"`
	Features []*Feature `json:"features,omitempty"`
}

FeatureCollection represents a collection of GeoJSON features.

func NewFeatureCollection

func NewFeatureCollection() *FeatureCollection

NewFeatureCollection returns GeoJSON FeatureCollection instance.

func (*FeatureCollection) Push

Push adds Feature to the collection.

type MultiPolygon

type MultiPolygon []*s2.Loop

MultiPolygon represents GeoJSON MultiPolygon.

func NewMultiPolygon

func NewMultiPolygon() MultiPolygon

NewMultiPolygon returns GeoJSON NewMultiPolygon instance.

func (MultiPolygon) MarshalJSON

func (m MultiPolygon) MarshalJSON() ([]byte, error)

type Point

type Point [2]float64

Point represents GeoJSON Point.

func NewPoint

func NewPoint(lat, lng float64) Point

NewPoint returns GeoJSON Point instance from the provided latitude and longitude.

func (Point) MarshalJSON

func (p Point) MarshalJSON() ([]byte, error)

type Polygon

type Polygon struct {
	*s2.Loop
}

Polygon represents GeoJSON Polygon.

func NewPolygon

func NewPolygon(l *s2.Loop) *Polygon

NewPoint returns GeoJSON Polygon instance from the loop.

func (Polygon) MarshalJSON

func (p Polygon) MarshalJSON() ([]byte, error)

type Type

type Type string
const (
	TypePoint             Type = "Point"
	TypePolygon           Type = "Polygon"
	TypeMultiPolygon      Type = "MultiPolygon"
	TypeFeature           Type = "Feature"
	TypeFeatureCollection Type = "FeatureCollection"
)

Jump to

Keyboard shortcuts

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