geojson

package
v0.0.0-...-663df1f Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2018 License: MIT Imports: 3 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 {
	ID          string                 `jsonapi:"primary,features" json:"id"`
	Type        string                 `jsonapi:"attr,type" json:"type"`
	BoundingBox []float64              `json:"bbox,omitempty"`
	Geometry    *geojson.Geometry      `json:"geometry,omitempty"`
	Properties  map[string]interface{} `jsonapi:"attr,properties" json:"properties"`
	CRS         map[string]interface{} `json:"crs,omitempty"` // Coordinate Reference System Objects are not currently supported
}

A Feature corresponds to GeoJSON feature object

func UnmarshalFeature

func UnmarshalFeature(data []byte) (*Feature, error)

UnmarshalFeature decodes the data into a GeoJSON feature.

func (*Feature) MarshalJSON

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

MarshalJSON converts the feature object into the proper JSON. It will handle the encoding of all the child geometries.

type FeatureCollection

type FeatureCollection struct {
	Type        string                 `json:"type"`
	BoundingBox []float64              `json:"bbox,omitempty"`
	Features    []*Feature             `json:"features"`
	CRS         map[string]interface{} `json:"crs,omitempty"`
	Links       *jsonapi.Links         `json:"links,omitempty"`
}

A FeatureCollection correlates to a GeoJSON feature collection.

func NewFeatureCollection

func NewFeatureCollection() *FeatureCollection

NewFeatureCollection creates and initializes a new feature collection.

func (*FeatureCollection) AddFeature

func (fc *FeatureCollection) AddFeature(feature *Feature) *FeatureCollection

AddFeature appends a feature to the collection.

func (fc *FeatureCollection) Link(links jsonapi.Links)

Link add links to the FeatureCollection

func (*FeatureCollection) MarshalJSON

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

MarshalJSON converts the feature collection object into the proper JSON. It will handle the encoding of all the child features and geometries. Alternately one can call json.Marshal(fc) directly for the same result.

Jump to

Keyboard shortcuts

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