geojson

package
v0.0.0-...-0b43983 Latest Latest
Warning

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

Go to latest
Published: May 9, 2022 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ContentType            string = "application/geo+json"
	ContentTypeWithCharset string = "application/geo+json;charset=utf-8"
)

Variables

This section is empty.

Functions

func NewEntityConverter

func NewEntityConverter(property string, simplified bool, collection *GeoJSONFeatureCollection) func(interface{}) interface{}

func UnpackGeoJSONToCallback

func UnpackGeoJSONToCallback(bytes []byte, callback func(GeoJSONFeature) error) error

Types

type GeoJSONFeature

type GeoJSONFeature interface {
	SetProperty(name string, value interface{})
}

func NewGeoJSONFeature

func NewGeoJSONFeature(id, typ string, geom GeoJSONGeometry) GeoJSONFeature

type GeoJSONFeatureCollection

type GeoJSONFeatureCollection struct {
	Type     string           `json:"type"`
	Features []GeoJSONFeature `json:"features"`
	Context  *[]string        `json:"@context,omitempty"`
}

func NewGeoJSONFeatureCollection

func NewGeoJSONFeatureCollection(features []GeoJSONFeature, includeContext bool) *GeoJSONFeatureCollection

func (*GeoJSONFeatureCollection) UnmarshalJSON

func (gjfc *GeoJSONFeatureCollection) UnmarshalJSON(data []byte) error

type GeoJSONFeatureProperty

type GeoJSONFeatureProperty struct {
}

type GeoJSONGeometry

type GeoJSONGeometry interface {
	GeoPropertyType() string
	GeoPropertyValue() GeoJSONGeometry
	GetAsPoint() GeoJSONPropertyPoint
}

type GeoJSONProperty

type GeoJSONProperty struct {
	Property
	Value GeoJSONGeometry `json:"value"`
}

GeoJSONProperty is used to encapsulate different GeoJSONGeometry types

func CreateGeoJSONPropertyFromJSON

func CreateGeoJSONPropertyFromJSON(data []byte) *GeoJSONProperty

func CreateGeoJSONPropertyFromLineString

func CreateGeoJSONPropertyFromLineString(coordinates [][]float64) *GeoJSONProperty

CreateGeoJSONPropertyFromLineString creates a GeoJSONProperty from an array of line coordinate arrays

func CreateGeoJSONPropertyFromMultiPolygon

func CreateGeoJSONPropertyFromMultiPolygon(coordinates [][][][]float64) *GeoJSONProperty

CreateGeoJSONPropertyFromMultiPolygon creates a GeoJSONProperty from an array of polygon coordinate arrays

func CreateGeoJSONPropertyFromWGS84

func CreateGeoJSONPropertyFromWGS84(longitude, latitude float64) *GeoJSONProperty

CreateGeoJSONPropertyFromWGS84 creates a GeoJSONProperty from a WGS84 coordinate

func (*GeoJSONProperty) GeoPropertyType

func (gjp *GeoJSONProperty) GeoPropertyType() string

func (*GeoJSONProperty) GeoPropertyValue

func (gjp *GeoJSONProperty) GeoPropertyValue() GeoJSONGeometry

func (*GeoJSONProperty) GetAsPoint

func (gjp *GeoJSONProperty) GetAsPoint() GeoJSONPropertyPoint

type GeoJSONPropertyLineString

type GeoJSONPropertyLineString struct {
	Type        string      `json:"type"`
	Coordinates [][]float64 `json:"coordinates"`
}

GeoJSONPropertyLineString is used as the value object for a GeoJSONPropertyLineString

func (*GeoJSONPropertyLineString) GeoPropertyType

func (gjpls *GeoJSONPropertyLineString) GeoPropertyType() string

func (*GeoJSONPropertyLineString) GeoPropertyValue

func (gjpls *GeoJSONPropertyLineString) GeoPropertyValue() GeoJSONGeometry

func (*GeoJSONPropertyLineString) GetAsPoint

func (gjpls *GeoJSONPropertyLineString) GetAsPoint() GeoJSONPropertyPoint

type GeoJSONPropertyMultiPolygon

type GeoJSONPropertyMultiPolygon struct {
	Type        string          `json:"type"`
	Coordinates [][][][]float64 `json:"coordinates"`
}

GeoJSONPropertyMultiPolygon is used as the value object for a GeoJSONPropertyMultiPolygon

func (*GeoJSONPropertyMultiPolygon) GeoPropertyType

func (gjpmp *GeoJSONPropertyMultiPolygon) GeoPropertyType() string

func (*GeoJSONPropertyMultiPolygon) GeoPropertyValue

func (gjpmp *GeoJSONPropertyMultiPolygon) GeoPropertyValue() GeoJSONGeometry

func (*GeoJSONPropertyMultiPolygon) GetAsPoint

type GeoJSONPropertyPoint

type GeoJSONPropertyPoint struct {
	Type        string     `json:"type"`
	Coordinates [2]float64 `json:"coordinates"`
}

GeoJSONPropertyPoint is used as the value object for a GeoJSONPropertyPoint

func (*GeoJSONPropertyPoint) GeoPropertyType

func (gjpp *GeoJSONPropertyPoint) GeoPropertyType() string

func (*GeoJSONPropertyPoint) GeoPropertyValue

func (gjpp *GeoJSONPropertyPoint) GeoPropertyValue() GeoJSONGeometry

func (*GeoJSONPropertyPoint) GetAsPoint

func (gjpp *GeoJSONPropertyPoint) GetAsPoint() GeoJSONPropertyPoint

func (GeoJSONPropertyPoint) Latitude

func (gjpp GeoJSONPropertyPoint) Latitude() float64

func (GeoJSONPropertyPoint) Longitude

func (gjpp GeoJSONPropertyPoint) Longitude() float64

type Property

type Property struct {
	Type string `json:"type"`
}

type SpatialEntity

type SpatialEntity interface {
	ToGeoJSONFeature(propertyName string, simplified bool) (GeoJSONFeature, error)
}

Jump to

Keyboard shortcuts

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