postgis

package
v1.3.2 Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2019 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package postgis implements Well Known Binary encoding and decoding. If you are encoding geometries in WKB to send to PostgreSQL/PostGIS, then you must specify binary_parameters=yes in the data source name that you pass to sql.Open.

Index

Constants

This section is empty.

Variables

View Source
var (
	// XDR is big endian.
	XDR = wkbcommon.XDR
	// NDR is little endian.
	NDR = wkbcommon.NDR
)

Functions

func Marshal

func Marshal(g geo.Geometry, byteOrder binary.ByteOrder) ([]byte, error)

Marshal marshals an arbitrary geometry to a []byte.

func NewEncoder

func NewEncoder(g geo.Geometry, params ...types.Params) geo.DBEncoder

NewEncoder returns a new encoder

func Read

func Read(r io.Reader) (geo.Geometry, error)

Read reads an arbitrary geometry from r.

func Unmarshal

func Unmarshal(data []byte) (geo.Geometry, error)

Unmarshal unmrshals an arbitrary geometry from a []byte.

func Write

func Write(w io.Writer, byteOrder binary.ByteOrder, g geo.Geometry) error

Write writes an arbitrary geometry to w.

Types

type Encoder

type Encoder struct {
	geo.Geometry
}

Encoder is the ewkb encoder struct

func (*Encoder) Scan

func (m *Encoder) Scan(data interface{}) error

Scan implements the sql.Scanner interface

func (Encoder) Value

func (m Encoder) Value() (driver.Value, error)

Value implements the driver.Valuer interface

type HexEncoder

type HexEncoder struct {
	Encoder
}

HexEncoder is the ewkbhex encoder struct

func (*HexEncoder) Scan

func (m *HexEncoder) Scan(data interface{}) error

Scan implements the sql.Scanner interface

Jump to

Keyboard shortcuts

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