wkbcommon

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Dec 25, 2023 License: BSD-2-Clause Imports: 4 Imported by: 0

Documentation

Overview

Package wkbcommon contains code common to WKB and EWKB encoding.

Package wkbcommon contains code common to WKB and EWKB encoding.

Index

Constants

View Source
const (
	XDRID = 0
	NDRID = 1
)

Byte order IDs.

View Source
const (
	PointID              = 1
	LineStringID         = 2
	PolygonID            = 3
	MultiPointID         = 4
	MultiLineStringID    = 5
	MultiPolygonID       = 6
	GeometryCollectionID = 7
	PolyhedralSurfaceID  = 15
	TINID                = 16
	TriangleID           = 17
)

Geometry type IDs.

Variables

Byte orders.

View Source
var MaxGeometryElements = [4]uint32{
	0,
	1 << 20,
	1 << 15,
	1 << 10,
}

MaxGeometryElements is the maximum number of elements that will be decoded at different levels. Its primary purpose is to prevent corrupt inputs from causing excessive memory allocations (which could be used as a denial of service attack). FIXME This should be Codec-specific, not global FIXME Consider overall per-geometry limit rather than per-level limit

Functions

func ReadByte

func ReadByte(r io.Reader) (byte, error)

ReadByte reads a byte from r.

func ReadFlatCoords0

func ReadFlatCoords0(r io.Reader, byteOrder binary.ByteOrder, stride int) ([]float64, error)

ReadFlatCoords0 reads flat coordinates 0.

func ReadFlatCoords1

func ReadFlatCoords1(r io.Reader, byteOrder binary.ByteOrder, stride int) ([]float64, error)

ReadFlatCoords1 reads flat coordinates 1.

func ReadFlatCoords2

func ReadFlatCoords2(r io.Reader, byteOrder binary.ByteOrder, stride int) ([]float64, []int, error)

ReadFlatCoords2 reads flat coordinates 2.

func ReadFloatArray

func ReadFloatArray(r io.Reader, byteOrder binary.ByteOrder, array []float64) error

ReadFloatArray reads a []float64 from r.

func ReadUInt32

func ReadUInt32(r io.Reader, byteOrder binary.ByteOrder) (uint32, error)

ReadUInt32 reads a uint32 from r.

func WriteByte

func WriteByte(w io.Writer, value byte) error

WriteByte wrties a byte to w.

func WriteFlatCoords0

func WriteFlatCoords0(w io.Writer, byteOrder binary.ByteOrder, coord []float64) error

WriteFlatCoords0 writes flat coordinates 0.

func WriteFlatCoords1

func WriteFlatCoords1(w io.Writer, byteOrder binary.ByteOrder, coords []float64, stride int) error

WriteFlatCoords1 writes flat coordinates 1.

func WriteFlatCoords2

func WriteFlatCoords2(w io.Writer, byteOrder binary.ByteOrder, flatCoords []float64, ends []int, stride int) error

WriteFlatCoords2 writes flat coordinates 2.

func WriteFloatArray

func WriteFloatArray(w io.Writer, byteOrder binary.ByteOrder, array []float64) error

WriteFloatArray writes a []float64 to w.

func WriteUInt32

func WriteUInt32(w io.Writer, byteOrder binary.ByteOrder, value uint32) error

WriteUInt32 writes a uint32 to w.

Types

type ErrGeometryTooLarge

type ErrGeometryTooLarge struct {
	Level int
	N     uint32
	Limit uint32
}

An ErrGeometryTooLarge is returned when the geometry is too large.

func (ErrGeometryTooLarge) Error

func (e ErrGeometryTooLarge) Error() string

type ErrUnexpectedType

type ErrUnexpectedType struct {
	Got  interface{}
	Want interface{}
}

An ErrUnexpectedType is returned when an unexpected type is encountered.

func (ErrUnexpectedType) Error

func (e ErrUnexpectedType) Error() string

type ErrUnknownByteOrder

type ErrUnknownByteOrder byte

An ErrUnknownByteOrder is returned when an unknown byte order is encountered.

func (ErrUnknownByteOrder) Error

func (e ErrUnknownByteOrder) Error() string

type ErrUnknownType

type ErrUnknownType Type

An ErrUnknownType is returned when an unknown type is encountered.

func (ErrUnknownType) Error

func (e ErrUnknownType) Error() string

type ErrUnsupportedByteOrder

type ErrUnsupportedByteOrder struct{}

An ErrUnsupportedByteOrder is returned when an unsupported byte order is encountered.

func (ErrUnsupportedByteOrder) Error

func (e ErrUnsupportedByteOrder) Error() string

type ErrUnsupportedType

type ErrUnsupportedType Type

An ErrUnsupportedType is returned when an unsupported type is encountered.

func (ErrUnsupportedType) Error

func (e ErrUnsupportedType) Error() string

type Type

type Type uint32

A Type is a WKB code.

Jump to

Keyboard shortcuts

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