Documentation ¶
Overview ¶
Package wkbcommon contains code common to WKB and EWKB encoding.
Package wkbcommon contains code common to WKB and EWKB encoding.
Index ¶
- Constants
- Variables
- func ReadByte(r io.Reader) (byte, error)
- func ReadFlatCoords0(r io.Reader, byteOrder binary.ByteOrder, stride int) ([]float64, error)
- func ReadFlatCoords1(r io.Reader, byteOrder binary.ByteOrder, stride int) ([]float64, error)
- func ReadFlatCoords2(r io.Reader, byteOrder binary.ByteOrder, stride int) ([]float64, []int, error)
- func ReadFloatArray(r io.Reader, byteOrder binary.ByteOrder, array []float64) error
- func ReadUInt32(r io.Reader, byteOrder binary.ByteOrder) (uint32, error)
- func WriteByte(w io.Writer, value byte) error
- func WriteFlatCoords0(w io.Writer, byteOrder binary.ByteOrder, coord []float64) error
- func WriteFlatCoords1(w io.Writer, byteOrder binary.ByteOrder, coords []float64, stride int) error
- func WriteFlatCoords2(w io.Writer, byteOrder binary.ByteOrder, flatCoords []float64, ends []int, ...) error
- func WriteFloatArray(w io.Writer, byteOrder binary.ByteOrder, array []float64) error
- func WriteUInt32(w io.Writer, byteOrder binary.ByteOrder, value uint32) error
- type ErrGeometryTooLarge
- type ErrUnexpectedType
- type ErrUnknownByteOrder
- type ErrUnknownType
- type ErrUnsupportedByteOrder
- type ErrUnsupportedType
- type Type
Constants ¶
const ( XDRID = 0 NDRID = 1 )
Byte order IDs.
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 ¶
var ( XDR = binary.BigEndian NDR = binary.LittleEndian )
Byte orders.
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 ReadFlatCoords0 ¶
ReadFlatCoords0 reads flat coordinates 0.
func ReadFlatCoords1 ¶
ReadFlatCoords1 reads flat coordinates 1.
func ReadFlatCoords2 ¶
ReadFlatCoords2 reads flat coordinates 2.
func ReadFloatArray ¶
ReadFloatArray reads a []float64 from r.
func ReadUInt32 ¶
ReadUInt32 reads a uint32 from r.
func WriteFlatCoords0 ¶
WriteFlatCoords0 writes flat coordinates 0.
func WriteFlatCoords1 ¶
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 ¶
WriteFloatArray writes a []float64 to w.
Types ¶
type ErrGeometryTooLarge ¶
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