wkt

package
v0.11.1 Latest Latest
Warning

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

Go to latest
Published: Jan 29, 2024 License: MIT Imports: 7 Imported by: 26

README

encoding/wkt Godoc Reference

This package provides encoding and decoding of WKT data. The interface is defined as:

func MarshalString(orb.Geometry) string

func Unmarshal(string) (orb.Geometry, error)
func UnmarshalPoint(string) (orb.Point, err error)
func UnmarshalMultiPoint(string) (orb.MultiPoint, err error)
func UnmarshalLineString(string) (orb.LineString, err error)
func UnmarshalMultiLineString(string) (orb.MultiLineString, err error)
func UnmarshalPolygon(string) (orb.Polygon, err error)
func UnmarshalMultiPolygon(string) (orb.MultiPolygon, err error)
func UnmarshalCollection(string) (orb.Collection, err error)

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrNotWKT is returned when unmarshalling WKT and the data is not valid.
	ErrNotWKT = errors.New("wkt: invalid data")

	// ErrIncorrectGeometry is returned when unmarshalling WKT data into the wrong type.
	// For example, unmarshaling linestring data into a point.
	ErrIncorrectGeometry = errors.New("wkt: incorrect geometry")

	// ErrUnsupportedGeometry is returned when geometry type is not supported by this lib.
	ErrUnsupportedGeometry = errors.New("wkt: unsupported geometry")
)

Functions

func Marshal added in v0.5.0

func Marshal(g orb.Geometry) []byte

Marshal returns a WKT representation of the geometry.

func MarshalString

func MarshalString(g orb.Geometry) string

MarshalString returns a WKT representation of the geometry as a string.

func Unmarshal added in v0.5.0

func Unmarshal(s string) (orb.Geometry, error)

Unmarshal return a geometry by parsing the WKT string.

func UnmarshalCollection added in v0.2.2

func UnmarshalCollection(s string) (orb.Collection, error)

UnmarshalCollection returns the geometry collection represented by the wkt string. Will return ErrIncorrectGeometry if the wkt is not a geometry collection.

func UnmarshalLineString added in v0.2.2

func UnmarshalLineString(s string) (orb.LineString, error)

UnmarshalLineString returns the linestring represented by the wkt string. Will return ErrIncorrectGeometry if the wkt is not a linestring.

func UnmarshalMultiLineString added in v0.2.2

func UnmarshalMultiLineString(s string) (orb.MultiLineString, error)

UnmarshalMultiLineString returns the multi-linestring represented by the wkt string. Will return ErrIncorrectGeometry if the wkt is not a multi-linestring.

func UnmarshalMultiPoint added in v0.2.2

func UnmarshalMultiPoint(s string) (orb.MultiPoint, error)

UnmarshalMultiPoint returns the multi-point represented by the wkt string. Will return ErrIncorrectGeometry if the wkt is not a multi-point.

func UnmarshalMultiPolygon added in v0.2.2

func UnmarshalMultiPolygon(s string) (orb.MultiPolygon, error)

UnmarshalMultiPolygon returns the multi-polygon represented by the wkt string. Will return ErrIncorrectGeometry if the wkt is not a multi-polygon.

func UnmarshalPoint added in v0.2.2

func UnmarshalPoint(s string) (orb.Point, error)

UnmarshalPoint returns the point represented by the wkt string. Will return ErrIncorrectGeometry if the wkt is not a point.

func UnmarshalPolygon added in v0.2.2

func UnmarshalPolygon(s string) (orb.Polygon, error)

UnmarshalPolygon returns the polygon represented by the wkt string. Will return ErrIncorrectGeometry if the wkt is not a polygon.

Types

This section is empty.

Jump to

Keyboard shortcuts

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