Documentation
¶
Overview ¶
Package geojson implements GeoJSON encoding and decoding.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var DefaultLayout = geom.XY
DefaultLayout is the default layout for empty geometries. FIXME This should be Codec-specific, not global.
Functions ¶
Types ¶
type CRS ¶ added in v1.2.0
CRS is a deprecated field but still populated in some programs (e.g. PostGIS). See https://geojson.org/geojson-spec for original specification of CRS.
type EncodeGeometryOption ¶ added in v1.2.0
type EncodeGeometryOption struct {
// contains filtered or unexported fields
}
EncodeGeometryOption applies extra metadata to the Geometry GeoJSON encoding.
func EncodeGeometryWithBBox ¶ added in v1.2.0
func EncodeGeometryWithBBox() EncodeGeometryOption
EncodeGeometryWithBBox adds a bbox field to the Geometry GeoJSON encoding.
func EncodeGeometryWithCRS ¶ added in v1.2.0
func EncodeGeometryWithCRS(crs *CRS) EncodeGeometryOption
EncodeGeometryWithCRS adds the crs field to the Geometry GeoJSON encoding.
func EncodeGeometryWithMaxDecimalDigits ¶ added in v1.2.0
func EncodeGeometryWithMaxDecimalDigits(maxDecimalDigits int) EncodeGeometryOption
EncodeGeometryWithMaxDecimalDigits encodes the Geometry with maximum decimal digits in the JSON representation.
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
BBox *geom.Bounds
Geometry geom.T
Properties map[string]interface{}
}
A Feature is a GeoJSON Feature.
func (*Feature) MarshalJSON ¶
MarshalJSON implements json.Marshaler.MarshalJSON.
func (*Feature) UnmarshalJSON ¶
UnmarshalJSON implements json.Unmarshaler.UnmarshalJSON.
type FeatureCollection ¶
A FeatureCollection is a GeoJSON FeatureCollection.
func (*FeatureCollection) MarshalJSON ¶
func (fc *FeatureCollection) MarshalJSON() ([]byte, error)
MarshalJSON implements json.Marshaler.MarshalJSON.
func (*FeatureCollection) UnmarshalJSON ¶ added in v1.0.5
func (fc *FeatureCollection) UnmarshalJSON(data []byte) error
UnmarshalJSON implements json.Unmarshaler.UnmarshalJSON.
type Geometry ¶
type Geometry struct {
Type string `json:"type"`
BBox *json.RawMessage `json:"bbox,omitempty"`
CRS *CRS `json:"crs,omitempty"`
Coordinates *json.RawMessage `json:"coordinates,omitempty"`
Geometries *json.RawMessage `json:"geometries,omitempty"`
}
A Geometry is a geometry in GeoJSON format.