Documentation ¶
Overview ¶
Package wkb is for decoding ESRI's Well Known Binary (WKB) format sepcification at http://edndoc.esri.com/arcsde/9.1/general_topics/wkb_representation.htm
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // ErrUnsupportedDataType is returned by Scan methods when asked to scan // non []byte data from the database. This should never happen // if the driver is acting appropriately. ErrUnsupportedDataType = errors.New("wkb: scan value must be []byte") // ErrNotWKB is returned when unmarshalling WKB and the data is not valid. ErrNotWKB = errors.New("wkb: invalid data") // ErrIncorrectGeometry is returned when unmarshalling WKB data into the wrong type. // For example, unmarshaling linestring data into a point. ErrIncorrectGeometry = errors.New("wkb: incorrect geometry") // ErrUnsupportedGeometry is returned when geometry type is not supported by this lib. ErrUnsupportedGeometry = errors.New("wkb: unsupported geometry") )
var DefaultByteOrder binary.ByteOrder = binary.LittleEndian
DefaultByteOrder is the order used form marshalling or encoding is none is specified.
Functions ¶
func MustMarshal ¶
MustMarshal will encode the geometry and panic on error. Currently there is no reason to error during geometry marshalling.
Types ¶
type Decoder ¶
type Decoder struct {
// contains filtered or unexported fields
}
Decoder can decoder WKB geometry off of the stream.
type Encoder ¶
type Encoder struct {
// contains filtered or unexported fields
}
An Encoder will encode a geometry as WKB to the writer given at creation time.
func NewEncoder ¶
NewEncoder creates a new Encoder for the given writer
func (*Encoder) SetByteOrder ¶
SetByteOrder will override the default byte order set when the encoder was created.
type GeometryScanner ¶
GeometryScanner is a thing that can scan in sql query results.
func Scanner ¶
func Scanner(g interface{}) *GeometryScanner
Scanner will return a GeometryScanner that can scan sql query results. The geometryScanner.Geometry attribute will be set to the value. If g is non-nil, it MUST be a pointer to an orb.Geometry type like a Point or LineString. In that case the value will be written to g.
func (*GeometryScanner) Scan ¶
func (s *GeometryScanner) Scan(d interface{}) error
Scan will scan the input []byte data into a geometry. This could be into the orb geometry type pointer or, if nil, the scanner.Geometry attribute.