Documentation ¶
Index ¶
- func Decode(r io.Reader) (geo geom.Geometry, err error)
- func DecodeBytes(b []byte) (geo geom.Geometry, err error)
- func DecodeString(s string) (geo geom.Geometry, err error)
- func Encode(w io.Writer, geo geom.Geometry) error
- func EncodeBytes(geo geom.Geometry) ([]byte, error)
- func EncodeString(geo geom.Geometry) (string, error)
- func MustDecode(geo geom.Geometry, err error) geom.Geometry
- func MustEncode(geo geom.Geometry) string
- type Decoder
- type Encoder
- type ErrSyntax
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MustEncode ¶
MustEncode will use the default encoder to encode the provided Geometry if there is an error encoding the geometry, the function will panic.
Types ¶
type Encoder ¶
type Encoder struct {
// contains filtered or unexported fields
}
Encoder holds the necessary configurations and state for a WKT Encoder
func NewDefaultEncoder ¶
NewDefaultEncoder creates a new encoder that writes to w using the defaults of strict = false, precision = 10, and fmt = 'g'.
func NewEncoder ¶
NewEncoder creates a new encoder that writes to w
strict causes the encoder to return errors if the geometries have empty sub geometries where not allowed by the wkt spec. When Strict false, empty geometries are ignored.
Point: can be empty MultiPoint: can have empty points LineString: cannot have empty points MultiLineString: can have empty line strings non-empty line strings cannot have empty points Polygon: cannot have empty line strings, non-empty line strings cannot have empty points MultiPolygon: can have empty polygons, polygons cannot have empty linestrings, line strings cannot have empty points Collection: can have empty geometries
The precision and fmt are passed into strconv.FormatFloat https://golang.org/pkg/strconv/#FormatFloat
func (Encoder) Encode ¶
Encode traverses the geometry and writes its WKT representation to the encoder's io.Writer and returns the first error it may have gotten.
func (Encoder) EncodeString ¶
EncodeString is like Encode except it will return a string instead of encode to the internal io.Writer
func (Encoder) MustEncode ¶
MustEncode is like Encode except it will panic if there is an error
Directories ¶
Path | Synopsis |
---|---|
internal
|
|
cmd/fuzz/fuzz
Package fuzz provides primitives to generate random geom geometry types.
|
Package fuzz provides primitives to generate random geom geometry types. |