ewkb

package module
v0.0.0-...-fd35c7f Latest Latest
Warning

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

Go to latest
Published: Feb 18, 2019 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	XDR byte = 0x00 // Big endian
	NDR byte = 0x01 // Little endian
)

Byte orders

View Source
const (
	PointType uint32 = 1 + iota
	LineType
	PolygonType
	MultiPointType
	MultiLineType
	MultiPolygonType
	CollectionType
)

Available types of geometry objects

Variables

This section is empty.

Functions

This section is empty.

Types

type Base

type Base interface {
	// ByteOrder returns byte order of geometry
	ByteOrder() byte
	// HasZ checks if geometry has Z dimension
	HasZ() bool
	// HasM checks if geometry has M dimension
	HasM() bool
	// HasSRID checks if geometry contains SRID
	HasSRID() bool
	// SRID returns SRID, or zero, if there is no SRID
	SRID() int32
}

Base presents interface of base of geometry

func NewBase

func NewBase(byteOrder byte, hasZ, hasM, hasSRID bool, srid int32) Base

NewBase returns new base of geometry

type Geometry

type Geometry interface {
	// Type returns type of geometry
	Type() uint32
	Base
	fmt.Stringer
	sql.Scanner
	driver.Valuer
	encoding.BinaryUnmarshaler
	encoding.BinaryMarshaler
}

Geometry presents interface of geometry object

type GeometryCollection

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

GeometryCollection presents collection of geometry objects

func NewGeometryCollection

func NewGeometryCollection(b Base, geoms []Geometry) GeometryCollection

NewGeometryCollection returns new GeometryCollection, created from geometry base and coords data

func (*GeometryCollection) ByteOrder

func (h *GeometryCollection) ByteOrder() byte

ByteOrder returns byte order of geometry

func (*GeometryCollection) Geometry

func (c *GeometryCollection) Geometry(idx int) Geometry

Geometry returns geometry with specified index

func (*GeometryCollection) HasM

func (h *GeometryCollection) HasM() bool

HasM checks if geometry has M dimension

func (*GeometryCollection) HasSRID

func (h *GeometryCollection) HasSRID() bool

HasSRID checks if geometry contains SRID

func (*GeometryCollection) HasZ

func (h *GeometryCollection) HasZ() bool

HasZ checks if geometry has Z dimension

func (*GeometryCollection) Len

func (c *GeometryCollection) Len() int

Len returns length of collection (count of geometry objects)

func (*GeometryCollection) MarshalBinary

func (c *GeometryCollection) MarshalBinary() ([]byte, error)

MarshalBinary implements encoding.BinaryMarshaler interface

func (*GeometryCollection) SRID

func (h *GeometryCollection) SRID() int32

SRID returns SRID, or zero, if there is no SRID

func (*GeometryCollection) Scan

func (c *GeometryCollection) Scan(src interface{}) error

Scan implements sql.Scanner interface

func (*GeometryCollection) String

func (c *GeometryCollection) String() string

String returns WKT/EWKT geometry representation

func (*GeometryCollection) Type

func (h *GeometryCollection) Type() uint32

Type returns type of geometry

func (*GeometryCollection) UnmarshalBinary

func (c *GeometryCollection) UnmarshalBinary(data []byte) error

UnmarshalBinary implements encoding.BinaryUnmarshaler interface

func (*GeometryCollection) Value

func (c *GeometryCollection) Value() (driver.Value, error)

Value implements sql driver.Valuer interface

type LineString

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

LineString presents LineString geometry object

func NewLineString

func NewLineString(b Base, mp geo.MultiPoint) LineString

NewLineString returns new LineString, created from geometry base and coords data

func (*LineString) ByteOrder

func (h *LineString) ByteOrder() byte

ByteOrder returns byte order of geometry

func (*LineString) HasM

func (h *LineString) HasM() bool

HasM checks if geometry has M dimension

func (*LineString) HasSRID

func (h *LineString) HasSRID() bool

HasSRID checks if geometry contains SRID

func (*LineString) HasZ

func (h *LineString) HasZ() bool

HasZ checks if geometry has Z dimension

func (*LineString) Len

func (l *LineString) Len() int

Len returns length of LineString (count of points)

func (*LineString) MarshalBinary

func (l *LineString) MarshalBinary() ([]byte, error)

MarshalBinary implements encoding.BinaryMarshaler interface

func (*LineString) Point

func (l *LineString) Point(idx int) geo.Point

Point returns point of LineString with specified index

func (*LineString) SRID

func (h *LineString) SRID() int32

SRID returns SRID, or zero, if there is no SRID

func (*LineString) Scan

func (l *LineString) Scan(src interface{}) error

Scan implements sql.Scanner interface

func (*LineString) String

func (l *LineString) String() string

String returns WKT/EWKT geometry representation

func (*LineString) Type

func (h *LineString) Type() uint32

Type returns type of geometry

func (*LineString) UnmarshalBinary

func (l *LineString) UnmarshalBinary(data []byte) error

UnmarshalBinary implements encoding.BinaryUnmarshaler interface

func (*LineString) Value

func (l *LineString) Value() (driver.Value, error)

Value implements sql driver.Valuer interface

type MultiLineString

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

MultiLineString presents MultiLineString geometry object

func NewMultiLineString

func NewMultiLineString(b Base, ml geo.MultiLine) MultiLineString

NewMultiLineString returns new MultiLineString, created from geometry base and coords data

func (*MultiLineString) ByteOrder

func (h *MultiLineString) ByteOrder() byte

ByteOrder returns byte order of geometry

func (*MultiLineString) HasM

func (h *MultiLineString) HasM() bool

HasM checks if geometry has M dimension

func (*MultiLineString) HasSRID

func (h *MultiLineString) HasSRID() bool

HasSRID checks if geometry contains SRID

func (*MultiLineString) HasZ

func (h *MultiLineString) HasZ() bool

HasZ checks if geometry has Z dimension

func (*MultiLineString) Len

func (l *MultiLineString) Len() int

Len returns count of lines

func (*MultiLineString) Line

func (l *MultiLineString) Line(idx int) geo.MultiPoint

Line returns line with specified index

func (*MultiLineString) MarshalBinary

func (l *MultiLineString) MarshalBinary() ([]byte, error)

MarshalBinary implements encoding.BinaryMarshaler interface

func (*MultiLineString) SRID

func (h *MultiLineString) SRID() int32

SRID returns SRID, or zero, if there is no SRID

func (*MultiLineString) Scan

func (l *MultiLineString) Scan(src interface{}) error

Scan implements sql.Scanner interface

func (*MultiLineString) String

func (l *MultiLineString) String() string

String returns WKT/EWKT geometry representation

func (*MultiLineString) Type

func (h *MultiLineString) Type() uint32

Type returns type of geometry

func (*MultiLineString) UnmarshalBinary

func (l *MultiLineString) UnmarshalBinary(data []byte) error

UnmarshalBinary implements encoding.BinaryUnmarshaler interface

func (*MultiLineString) Value

func (l *MultiLineString) Value() (driver.Value, error)

Value implements sql driver.Valuer interface

type MultiPoint

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

MultiPoint presents MultiPoint geometry object

func NewMultiPoint

func NewMultiPoint(b Base, mp geo.MultiPoint) MultiPoint

NewMultiPoint returns new MultiPoint, created from geometry base and coords data

func (*MultiPoint) ByteOrder

func (h *MultiPoint) ByteOrder() byte

ByteOrder returns byte order of geometry

func (*MultiPoint) HasM

func (h *MultiPoint) HasM() bool

HasM checks if geometry has M dimension

func (*MultiPoint) HasSRID

func (h *MultiPoint) HasSRID() bool

HasSRID checks if geometry contains SRID

func (*MultiPoint) HasZ

func (h *MultiPoint) HasZ() bool

HasZ checks if geometry has Z dimension

func (*MultiPoint) Len

func (p *MultiPoint) Len() int

Len returns length of MultiPoint (count of points)

func (*MultiPoint) MarshalBinary

func (p *MultiPoint) MarshalBinary() ([]byte, error)

MarshalBinary implements encoding.BinaryMarshaler interface

func (*MultiPoint) Point

func (p *MultiPoint) Point(idx int) geo.Point

Point returns point with specified index

func (*MultiPoint) SRID

func (h *MultiPoint) SRID() int32

SRID returns SRID, or zero, if there is no SRID

func (*MultiPoint) Scan

func (p *MultiPoint) Scan(src interface{}) error

Scan implements sql.Scanner interface

func (*MultiPoint) String

func (p *MultiPoint) String() string

String returns WKT/EWKT geometry representation

func (*MultiPoint) Type

func (h *MultiPoint) Type() uint32

Type returns type of geometry

func (*MultiPoint) UnmarshalBinary

func (p *MultiPoint) UnmarshalBinary(data []byte) error

UnmarshalBinary implements encoding.BinaryUnmarshaler interface

func (*MultiPoint) Value

func (p *MultiPoint) Value() (driver.Value, error)

Value implements sql driver.Valuer interface

type MultiPolygon

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

MultiPolygon presents MultiPolygon geometry object

func NewMultiPolygon

func NewMultiPolygon(b Base, mp geo.MultiPolygon) MultiPolygon

NewMultiPolygon returns new MultiPolygon, created from geometry base and coords data

func (*MultiPolygon) ByteOrder

func (h *MultiPolygon) ByteOrder() byte

ByteOrder returns byte order of geometry

func (*MultiPolygon) HasM

func (h *MultiPolygon) HasM() bool

HasM checks if geometry has M dimension

func (*MultiPolygon) HasSRID

func (h *MultiPolygon) HasSRID() bool

HasSRID checks if geometry contains SRID

func (*MultiPolygon) HasZ

func (h *MultiPolygon) HasZ() bool

HasZ checks if geometry has Z dimension

func (*MultiPolygon) Len

func (p *MultiPolygon) Len() int

Len returns count of polygons

func (*MultiPolygon) MarshalBinary

func (p *MultiPolygon) MarshalBinary() ([]byte, error)

MarshalBinary implements encoding.BinaryMarshaler interface

func (*MultiPolygon) Polygon

func (p *MultiPolygon) Polygon(idx int) geo.Polygon

Polygon returns polygon with specified index

func (*MultiPolygon) SRID

func (h *MultiPolygon) SRID() int32

SRID returns SRID, or zero, if there is no SRID

func (*MultiPolygon) Scan

func (p *MultiPolygon) Scan(src interface{}) error

Scan implements sql.Scanner interface

func (*MultiPolygon) String

func (p *MultiPolygon) String() string

String returns WKT/EWKT geometry representation

func (*MultiPolygon) Type

func (h *MultiPolygon) Type() uint32

Type returns type of geometry

func (*MultiPolygon) UnmarshalBinary

func (p *MultiPolygon) UnmarshalBinary(data []byte) error

UnmarshalBinary implements encoding.BinaryUnmarshaler interface

func (*MultiPolygon) Value

func (p *MultiPolygon) Value() (driver.Value, error)

Value implements sql driver.Valuer interface

type Point

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

Point presents 2, 3 or 4 dimensions point

func NewPoint

func NewPoint(b Base, p geo.Point) Point

NewPoint returns new point, created from geometry base and coords data

func (*Point) ByteOrder

func (h *Point) ByteOrder() byte

ByteOrder returns byte order of geometry

func (*Point) HasM

func (h *Point) HasM() bool

HasM checks if geometry has M dimension

func (*Point) HasSRID

func (h *Point) HasSRID() bool

HasSRID checks if geometry contains SRID

func (*Point) HasZ

func (h *Point) HasZ() bool

HasZ checks if geometry has Z dimension

func (*Point) M

func (p *Point) M() float64

M returns value of M dimension

func (*Point) MarshalBinary

func (p *Point) MarshalBinary() ([]byte, error)

MarshalBinary implements encoding.BinaryMarshaler interface

func (*Point) SRID

func (h *Point) SRID() int32

SRID returns SRID, or zero, if there is no SRID

func (*Point) Scan

func (p *Point) Scan(src interface{}) error

Scan implements sql.Scanner interface

func (*Point) String

func (p *Point) String() string

String returns WKT/EWKT geometry representation

func (*Point) Type

func (h *Point) Type() uint32

Type returns type of geometry

func (*Point) UnmarshalBinary

func (p *Point) UnmarshalBinary(data []byte) error

UnmarshalBinary implements encoding.BinaryUnmarshaler interface

func (*Point) Value

func (p *Point) Value() (driver.Value, error)

Value implements sql driver.Valuer interface

func (*Point) X

func (p *Point) X() float64

X returns value of X dimension

func (*Point) Y

func (p *Point) Y() float64

Y returns value of Y dimension

func (*Point) Z

func (p *Point) Z() float64

Z returns value of Z dimension

type Polygon

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

Polygon presents Polygon geometry object

func NewPolygon

func NewPolygon(b Base, poly geo.Polygon) Polygon

NewPolygon returns new Polygon, created from geometry base and coords data

func (*Polygon) ByteOrder

func (h *Polygon) ByteOrder() byte

ByteOrder returns byte order of geometry

func (*Polygon) HasM

func (h *Polygon) HasM() bool

HasM checks if geometry has M dimension

func (*Polygon) HasSRID

func (h *Polygon) HasSRID() bool

HasSRID checks if geometry contains SRID

func (*Polygon) HasZ

func (h *Polygon) HasZ() bool

HasZ checks if geometry has Z dimension

func (*Polygon) Len

func (p *Polygon) Len() int

Len returns count of rings

func (*Polygon) MarshalBinary

func (p *Polygon) MarshalBinary() ([]byte, error)

MarshalBinary implements encoding.BinaryMarshaler interface

func (*Polygon) Ring

func (p *Polygon) Ring(idx int) geo.MultiPoint

Ring returns ring with specified index

func (*Polygon) SRID

func (h *Polygon) SRID() int32

SRID returns SRID, or zero, if there is no SRID

func (*Polygon) Scan

func (p *Polygon) Scan(src interface{}) error

Scan implements sql.Scanner interface

func (*Polygon) String

func (p *Polygon) String() string

String returns WKT/EWKT geometry representation

func (*Polygon) Type

func (h *Polygon) Type() uint32

Type returns type of geometry

func (*Polygon) UnmarshalBinary

func (p *Polygon) UnmarshalBinary(data []byte) error

UnmarshalBinary implements encoding.BinaryUnmarshaler interface

func (*Polygon) Value

func (p *Polygon) Value() (driver.Value, error)

Value implements sql driver.Valuer interface

type Wrapper

type Wrapper struct {
	Geometry Geometry
}

Wrapper prensents wrapper for geometry objects. Can be used for reading from and writing to DB all types of geometry, supported by package. Also support null values and may be useful for nullable columns

func (*Wrapper) MarshalBinary

func (w *Wrapper) MarshalBinary() ([]byte, error)

MarshalBinary implements encoding.BinaryMarshaler interface

func (*Wrapper) Scan

func (w *Wrapper) Scan(src interface{}) error

Scan implements sql.Scanner interface

func (*Wrapper) UnmarshalBinary

func (w *Wrapper) UnmarshalBinary(data []byte) error

UnmarshalBinary implements encoding.BinaryUnmarshaler interface

func (*Wrapper) Value

func (w *Wrapper) Value() (driver.Value, error)

Value implements sql driver.Valuer interface

Directories

Path Synopsis
Package geo contains interfaces of simple geometry objects, and their creation methods
Package geo contains interfaces of simple geometry objects, and their creation methods

Jump to

Keyboard shortcuts

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