wkt

package
v1.0.5 Latest Latest
Warning

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

Go to latest
Published: Jan 8, 2024 License: BSD-2-Clause Imports: 6 Imported by: 0

Documentation

Overview

Package wkt implements Well Known Text encoding and decoding.

Index

Constants

View Source
const (
	POINT                = 57346
	POINTM               = 57347
	POINTZ               = 57348
	POINTZM              = 57349
	LINESTRING           = 57350
	LINESTRINGM          = 57351
	LINESTRINGZ          = 57352
	LINESTRINGZM         = 57353
	POLYGON              = 57354
	POLYGONM             = 57355
	POLYGONZ             = 57356
	POLYGONZM            = 57357
	MULTIPOINT           = 57358
	MULTIPOINTM          = 57359
	MULTIPOINTZ          = 57360
	MULTIPOINTZM         = 57361
	MULTILINESTRING      = 57362
	MULTILINESTRINGM     = 57363
	MULTILINESTRINGZ     = 57364
	MULTILINESTRINGZM    = 57365
	MULTIPOLYGON         = 57366
	MULTIPOLYGONM        = 57367
	MULTIPOLYGONZ        = 57368
	MULTIPOLYGONZM       = 57369
	GEOMETRYCOLLECTION   = 57370
	GEOMETRYCOLLECTIONM  = 57371
	GEOMETRYCOLLECTIONZ  = 57372
	GEOMETRYCOLLECTIONZM = 57373
	EMPTY                = 57374
	NUM                  = 57375
)

Variables

View Source
var ErrBraceMismatch = errors.New("wkt: brace mismatch")

ErrBraceMismatch is returned when braces do not match.

Functions

func Marshal

func Marshal(g geom.T, applyOptFns ...EncodeOption) (string, error)

Marshal translates a geometry to the corresponding WKT.

func Unmarshal

func Unmarshal(wkt string) (geom.T, error)

Unmarshal translates a WKT to the corresponding geometry.

Types

type EncodeOption

type EncodeOption func(*Encoder)

An EncodeOption is an encoder option.

func EncodeOptionWithMaxDecimalDigits

func EncodeOptionWithMaxDecimalDigits(maxDecimalDigits int) EncodeOption

EncodeOptionWithMaxDecimalDigits sets the maximum decimal digits to encode.

type Encoder

type Encoder struct {
	// contains filtered or unexported fields
}

Encoder encodes WKT based on specified parameters.

func NewEncoder

func NewEncoder(applyOptFns ...EncodeOption) *Encoder

NewEncoder returns a new encoder with the given options set.

func (*Encoder) Encode

func (e *Encoder) Encode(g geom.T) (string, error)

Encode translates a geometry to the corresponding WKT.

type SyntaxError

type SyntaxError struct {
	// contains filtered or unexported fields
}

SyntaxError is an error that occurs during parsing of a WKT string.

func (*SyntaxError) Error

func (e *SyntaxError) Error() string

Error generates a detailed syntax error message with line and pos numbers as well as a snippet of the erroneous input.

Jump to

Keyboard shortcuts

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