wkb

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Dec 22, 2017 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package wkb is for decoding ESRI's Well Known Binary (WKB) format for OGC geometry (WKBGeometry)

sepcification at http://edndoc.esri.com/arcsde/9.1/general_topics/wkb_representation.htm

There are a few types supported by the specification. Each general type is in it's own file. So, to find the implementation of Point (and MultiPoint) it will be located in the point.go file. Each of the basic type here adhere to the tegola.Geometry interface. So, a wkb point is, also, a tegola.Point

Index

Constants

View Source
const (
	GeoPoint              uint32 = 1
	GeoLineString                = 2
	GeoPolygon                   = 3
	GeoMultiPoint                = 4
	GeoMultiLineString           = 5
	GeoMultiPolygon              = 6
	GeoGeometryCollection        = 7
)
geometry types

http://edndoc.esri.com/arcsde/9.1/general_topics/wkb_representation.htm

Variables

This section is empty.

Functions

func Encode

func Encode(w io.Writer, bom binary.ByteOrder, geometry tegola.Geometry) error

Encode will encode the given Geometry as a binary representation with the given byte order, and write it to the provided io.Writer.

func WKT

func WKT(geo tegola.Geometry) string

WKT returns a WKT representation of the Geometry if possible. the Error will be non-nil if geometry is unknown.

Types

type Collection

type Collection []Geometry

Collection is a collection of geometries.

func (*Collection) Decode

func (col *Collection) Decode(bom binary.ByteOrder, r io.Reader) error

Decode decodes the geometry from a binary representation.

func (*Collection) String

func (col *Collection) String() string

func (Collection) Type

func (Collection) Type() uint32

Type returns the type number of this geometry, by the spec it's 7.

type Geometry

type Geometry interface {
	Decode(bom binary.ByteOrder, r io.Reader) error
	Type() uint32
}

Geometry describes a basic Geometry type that can decode it's self.

func Decode

func Decode(r io.Reader) (geo Geometry, err error)

Decode is the main function that given a io.Reader will attempt to decode the Geometry from the byte stream.

func DecodeBytes

func DecodeBytes(b []byte) (geo Geometry, err error)

DecodeBytes will decode the type into a Geometry

func WKB

func WKB(geometry tegola.Geometry) (geo Geometry, err error)

WKB casts a tegola.Geometry to a wkb.Geometry type. NOTE: Not sure if this is needed. I'm actually wondering if wkb types are even needed, It seems like they could just be aliases to basic types, with additional methods on them. -gdey

type LineString

type LineString []Point

LineString describes a line, that is made up of two or more points

func (*LineString) Decode

func (ls *LineString) Decode(bom binary.ByteOrder, r io.Reader) error

Decode will decode the binary representation into a LineString Object.

func (*LineString) String

func (ls *LineString) String() string

String returns the WKT representation of the Geometry

func (*LineString) Subpoints

func (ls *LineString) Subpoints() (pts []tegola.Point)

Subpoints returns a copy of the points that make up the Line.

func (LineString) Type

func (LineString) Type() uint32

Type returns the type constant for a LineString

type MultiLineString

type MultiLineString []LineString

MultiLineString represents one or more independent lines.

func (*MultiLineString) Decode

func (ml *MultiLineString) Decode(bom binary.ByteOrder, r io.Reader) error

Decode takes a byteOrder and an io.Reader, to decode the stream.

func (*MultiLineString) Lines

func (ml *MultiLineString) Lines() (lns []tegola.LineString)

Lines return the indivual lines in the grouping.

func (*MultiLineString) String

func (ml *MultiLineString) String() string

String returns the WKT representation of the Geometry.

func (MultiLineString) Type

func (MultiLineString) Type() uint32

Type returns the Type constant for a Multiline String.

type MultiPoint

type MultiPoint []Point

MultiPoint holds one or more independent points in a group

func (*MultiPoint) Decode

func (mp *MultiPoint) Decode(bom binary.ByteOrder, r io.Reader) error

Decode decodes the byte stream in the a grouping of points.

func (MultiPoint) Points

func (mp MultiPoint) Points() (pts []tegola.Point)

Points returns a copy of the points in the group.

func (MultiPoint) String

func (mp MultiPoint) String() string

String returns the WTK version of the geometry.

func (MultiPoint) Type

func (MultiPoint) Type() uint32

Type returns the type constant for a Mulipoint geometry

type MultiPolygon

type MultiPolygon []Polygon

MultiPolygon holds multiple polygons.

func (*MultiPolygon) Decode

func (mp *MultiPolygon) Decode(bom binary.ByteOrder, r io.Reader) error

Decode decodes the binary representation of a Multipolygon and decodes it into a Multipolygon object.

func (*MultiPolygon) Polygons

func (mp *MultiPolygon) Polygons() (pls []tegola.Polygon)

Polygons return the sub polygons of a Multipolygon.

func (*MultiPolygon) String

func (mp *MultiPolygon) String() string

func (MultiPolygon) Type

func (MultiPolygon) Type() uint32

Type of the Geometry

type Point

type Point struct {
	basic.Point
}

Point is a basic type, this describes a 2D point.

func NewPoint

func NewPoint(x, y float64) Point

NewPoint creates a new point structure.

func (*Point) Decode

func (p *Point) Decode(bom binary.ByteOrder, r io.Reader) error

Decode decodes the byte stream into the object.

func (Point) GoString added in v0.4.0

func (p Point) GoString() string

func (Point) String

func (p Point) String() string

func (Point) Type

func (Point) Type() uint32

Type returns the type constant for this Geometry.

type Polygon

type Polygon []LineString

Polygon is a Geometry of one or more rings. The first ring is assumed to be the outer bounding ringer, and traversed in a clockwise manner. The remaining rings should be within the bounding area of the first ring, and is traversed in a counterclockwise manner, these represent holes in the polygon.

func (*Polygon) Decode

func (p *Polygon) Decode(bom binary.ByteOrder, r io.Reader) error

Decode decodes the byte stream into the Geometry.

func (*Polygon) String

func (p *Polygon) String() string

String returns a WKT representation of the Geometry

func (*Polygon) Sublines

func (p *Polygon) Sublines() (lns []tegola.LineString)

Sublines returns a copy of the rings that make up the polygon.

func (Polygon) Type

func (Polygon) Type() uint32

Type returns the type constant for this Geometry

Jump to

Keyboard shortcuts

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