Version: v0.0.0-...-a30afd5 Latest Latest Go to latest
Published: Apr 20, 2017 License: BSD-2-Clause

## README ¶

### wkt

Package wkt implements a simplified parser for Well Known Text. It supports Point, MultiPoint, LineString, Polygon and MultiPolygon with both z and m coordinate parsing

``````http://en.wikipedia.org/wiki/Well-known_text
``````

#### Install

``````go get github.com/mb0/wkt
``````

#### Basic Usage

You can find the online documentation at http://godoc.org/github.com/mb0/wkt

Example:

``````geom, err := wkt.Parse([]byte(`POINT ZM(1.0 2.0 3.0 4.0)`))
``````

## Documentation ¶

### Overview ¶

Package wkt implements a simplified parser for Well Known Text http://en.wikipedia.org/wiki/Well-known_text

### Constants ¶

This section is empty.

### Variables ¶

This section is empty.

### Functions ¶

This section is empty.

### Types ¶

#### type Coord ¶

```type Coord struct {
X, Y, Z, M float64
}```

Coord represents a single location in a coordinate space

#### type Geom ¶

```type Geom interface {
IsMeasured() bool
Is3d() bool
Equal(Geom) bool
}```

Geom is one of the supported geometry types in this package

#### func Parse ¶

`func Parse(data []byte) (Geom, error)`

Parse returns the parsed geometry or an error

#### type LineString ¶

```type LineString struct {
Coords []Coord
Opt
}```

LineString is a list of connected points

#### func (*LineString) Equal ¶

`func (l *LineString) Equal(g Geom) bool`

Equal returns whether this linestring equals g

#### type MultiPoint ¶

```type MultiPoint struct {
Coords []Coord
Opt
}```

MultiPoint is a list of unconnected points

#### func (*MultiPoint) Equal ¶

`func (m *MultiPoint) Equal(g Geom) bool`

Equal returns whether this multipoint equals g

#### type MultiPolygon ¶

```type MultiPolygon struct {
Polygons [][][]Coord
Opt
}```

MultiPolygon is a list of multiple polygon ring lists

#### func (*MultiPolygon) Equal ¶

`func (m *MultiPolygon) Equal(g Geom) bool`

Equal returns whether this multipolygon equals g

#### type Opt ¶

`type Opt uint`

Opt indicates which additional coordinate options are used for this geometry

```const (
Z Opt
M
ZM
)```

Indicators for declared use of either z or m coordinates or both

#### func (Opt) Is3d ¶

`func (o Opt) Is3d() bool`

Is3d returns whether the z-coordinate is declared to be used as in "POINT Z(1 2 3)" or "POINT ZM(1 2 3 4)"

#### func (Opt) IsMeasured ¶

`func (o Opt) IsMeasured() bool`

IsMeasured returns whether the m-coordinate is declared to be used as in "POINT M(1 2 4)" or "POINT ZM(1 2 3 4)"

#### type Point ¶

```type Point struct {
Coord
Opt
}```

Point reprsents a point in 2 or 3 dimensions with or without measure

#### func (*Point) Equal ¶

`func (p *Point) Equal(g Geom) bool`

Equal returns whether this point equals g

#### type Polygon ¶

```type Polygon struct {
Rings [][]Coord
Opt
}```

Polygon is a list of rings where the first ring is the exterior (outline) and following are interior rings (holes)

#### func (*Polygon) Equal ¶

`func (p *Polygon) Equal(g Geom) bool`

Equal returns whether this polygon equals g