geojson

package
v0.0.0-...-bc4a3b0 Latest Latest
Warning

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

Go to latest
Published: Sep 20, 2016 License: BSD-2-Clause Imports: 3 Imported by: 0

Documentation

Overview

Package geojson implements GeoJSON encoding and decoding.

Index

Constants

This section is empty.

Variables

View Source
var DefaultLayout = geom.XY

DefaultLayout is the default layout for empty geometries. FIXME This should be Codec-specific, not global

Functions

func Marshal

func Marshal(g geom.T) ([]byte, error)

Marshal marshals an arbitrary geometry to a []byte.

func Unmarshal

func Unmarshal(data []byte, g *geom.T) error

Unmarshal unmarshalls a []byte to an arbitrary geometry.

Types

type ErrDimensionalityTooLow

type ErrDimensionalityTooLow int

ErrDimensionalityTooLow is returned when the dimensionality is too low.

func (ErrDimensionalityTooLow) Error

func (e ErrDimensionalityTooLow) Error() string

type ErrUnsupportedType

type ErrUnsupportedType string

ErrUnsupportedType is returned when the type is unsupported.

func (ErrUnsupportedType) Error

func (e ErrUnsupportedType) Error() string

type Feature

type Feature struct {
	ID         string
	Geometry   geom.T
	Properties map[string]interface{}
}

A Feature is a GeoJSON Feature.

func (*Feature) MarshalJSON

func (f *Feature) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler.MarshalJSON.

func (*Feature) UnmarshalJSON

func (f *Feature) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler.UnmarshalJSON.

type FeatureCollection

type FeatureCollection struct {
	Features []*Feature
}

A FeatureCollection is a GeoJSON FeatureCollection.

func (*FeatureCollection) MarshalJSON

func (fc *FeatureCollection) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler.MarshalJSON.

type Geometry

type Geometry struct {
	Type        string           `json:"type"`
	Coordinates *json.RawMessage `json:"coordinates"`
}

A Geometry is a geometry in GeoJSON format.

func Encode

func Encode(g geom.T) (*Geometry, error)

Encode encodes g as a GeoJSON geometry.

func (*Geometry) Decode

func (g *Geometry) Decode() (geom.T, error)

Decode decodes g to a geometry.

Jump to

Keyboard shortcuts

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