geopb

package
v0.23.2 Latest Latest
Warning

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

Go to latest
Published: Feb 12, 2024 License: Apache-2.0 Imports: 8 Imported by: 1

Documentation

Index

Constants

View Source
const (
	// UnknownSRID is the default SRID if none is provided.
	UnknownSRID = SRID(0)
	// DefaultGeometrySRID is the same as being unknown.
	DefaultGeometrySRID = UnknownSRID
	// DefaultGeographySRID (aka 4326) is the GPS lat/lng we all know and love.
	// In this system, (long, lat) corresponds to (X, Y), bounded by
	// ([-180, 180], [-90 90]).
	DefaultGeographySRID = SRID(4326)
)

The following are the common standard SRIDs that we support.

View Source
const (
	// ZShapeTypeFlag indicates a Z dimension on the ShapeType.
	ZShapeTypeFlag = 1 << 30
	// MShapeTypeFlag indicates a M dimension on the ShapeType.
	MShapeTypeFlag = 1 << 29
)

Variables

View Source
var (
	ErrInvalidLengthGeopb        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowGeopb          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupGeopb = fmt.Errorf("proto: unexpected end of group")
)
View Source
var ShapeType_name = map[int32]string{
	0:          "Unset",
	1:          "Point",
	2:          "LineString",
	3:          "Polygon",
	4:          "MultiPoint",
	5:          "MultiLineString",
	6:          "MultiPolygon",
	7:          "Geometry",
	8:          "GeometryCollection",
	536870913:  "PointM",
	536870914:  "LineStringM",
	536870915:  "PolygonM",
	536870916:  "MultiPointM",
	536870917:  "MultiLineStringM",
	536870918:  "MultiPolygonM",
	536870919:  "GeometryM",
	536870920:  "GeometryCollectionM",
	1073741825: "PointZ",
	1073741826: "LineStringZ",
	1073741827: "PolygonZ",
	1073741828: "MultiPointZ",
	1073741829: "MultiLineStringZ",
	1073741830: "MultiPolygonZ",
	1073741831: "GeometryZ",
	1073741832: "GeometryCollectionZ",
	1610612737: "PointZM",
	1610612738: "LineStringZM",
	1610612739: "PolygonZM",
	1610612740: "MultiPointZM",
	1610612741: "MultiLineStringZM",
	1610612742: "MultiPolygonZM",
	1610612743: "GeometryZM",
	1610612744: "GeometryCollectionZM",
}
View Source
var ShapeType_value = map[string]int32{
	"Unset":                0,
	"Point":                1,
	"LineString":           2,
	"Polygon":              3,
	"MultiPoint":           4,
	"MultiLineString":      5,
	"MultiPolygon":         6,
	"Geometry":             7,
	"GeometryCollection":   8,
	"PointM":               536870913,
	"LineStringM":          536870914,
	"PolygonM":             536870915,
	"MultiPointM":          536870916,
	"MultiLineStringM":     536870917,
	"MultiPolygonM":        536870918,
	"GeometryM":            536870919,
	"GeometryCollectionM":  536870920,
	"PointZ":               1073741825,
	"LineStringZ":          1073741826,
	"PolygonZ":             1073741827,
	"MultiPointZ":          1073741828,
	"MultiLineStringZ":     1073741829,
	"MultiPolygonZ":        1073741830,
	"GeometryZ":            1073741831,
	"GeometryCollectionZ":  1073741832,
	"PointZM":              1610612737,
	"LineStringZM":         1610612738,
	"PolygonZM":            1610612739,
	"MultiPointZM":         1610612740,
	"MultiLineStringZM":    1610612741,
	"MultiPolygonZM":       1610612742,
	"GeometryZM":           1610612743,
	"GeometryCollectionZM": 1610612744,
}
View Source
var SpatialObjectType_name = map[int32]string{
	0: "Unknown",
	1: "GeographyType",
	2: "GeometryType",
}
View Source
var SpatialObjectType_value = map[string]int32{
	"Unknown":       0,
	"GeographyType": 1,
	"GeometryType":  2,
}

Functions

This section is empty.

Types

type BoundingBox

type BoundingBox struct {
	LoX float64 `protobuf:"fixed64,1,opt,name=lo_x,json=loX,proto3" json:"lo_x,omitempty"`
	HiX float64 `protobuf:"fixed64,2,opt,name=hi_x,json=hiX,proto3" json:"hi_x,omitempty"`
	LoY float64 `protobuf:"fixed64,3,opt,name=lo_y,json=loY,proto3" json:"lo_y,omitempty"`
	HiY float64 `protobuf:"fixed64,4,opt,name=hi_y,json=hiY,proto3" json:"hi_y,omitempty"`
}

BoundingBox represents the bounding box of a Geospatial type. Note the lo coordinates can be higher in value than the hi coordinates for spherical geometries. NOTE: Do not use these to compare bounding boxes. Use the library functions provided in the geo package to perform these calculations.

func (*BoundingBox) Descriptor

func (*BoundingBox) Descriptor() ([]byte, []int)

func (*BoundingBox) Marshal

func (m *BoundingBox) Marshal() (dAtA []byte, err error)

func (*BoundingBox) MarshalTo

func (m *BoundingBox) MarshalTo(dAtA []byte) (int, error)

func (*BoundingBox) MarshalToSizedBuffer

func (m *BoundingBox) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*BoundingBox) ProtoMessage

func (*BoundingBox) ProtoMessage()

func (*BoundingBox) Reset

func (m *BoundingBox) Reset()

func (*BoundingBox) Size

func (m *BoundingBox) Size() (n int)

func (*BoundingBox) String

func (m *BoundingBox) String() string

func (*BoundingBox) Unmarshal

func (m *BoundingBox) Unmarshal(dAtA []byte) error

func (*BoundingBox) XXX_DiscardUnknown

func (m *BoundingBox) XXX_DiscardUnknown()

func (*BoundingBox) XXX_Marshal

func (m *BoundingBox) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*BoundingBox) XXX_Merge

func (m *BoundingBox) XXX_Merge(src proto.Message)

func (*BoundingBox) XXX_Size

func (m *BoundingBox) XXX_Size() int

func (*BoundingBox) XXX_Unmarshal

func (m *BoundingBox) XXX_Unmarshal(b []byte) error

type EWKB

type EWKB []byte

EWKB is the Extended Well Known Bytes form of a spatial object.

type EWKT

type EWKT string

EWKT is the Extended Well Known Text form of a spatial object.

type SRID

type SRID int32

SRID is a Spatial Reference Identifer. All geometry and geography shapes are stored and represented as using coordinates that are bare floats. SRIDs tie these floats to the planar or spherical coordinate system, allowing them to be interpreted and compared.

The zero value is special and means an unknown coordinate system.

type ShapeType

type ShapeType int32

ShapeType is the type of a spatial shape. Each of these corresponds to a different representation and serialization format. For example, a Point is a pair of doubles (or more than that for geometries with Z or N), a LineString is an ordered series of Points, etc.

const (
	ShapeType_Unset           ShapeType = 0
	ShapeType_Point           ShapeType = 1
	ShapeType_LineString      ShapeType = 2
	ShapeType_Polygon         ShapeType = 3
	ShapeType_MultiPoint      ShapeType = 4
	ShapeType_MultiLineString ShapeType = 5
	ShapeType_MultiPolygon    ShapeType = 6
	// Geometry can contain any type.
	ShapeType_Geometry ShapeType = 7
	// GeometryCollection can contain a list of any above type except for Geometry.
	ShapeType_GeometryCollection   ShapeType = 8
	ShapeType_PointM               ShapeType = 536870913
	ShapeType_LineStringM          ShapeType = 536870914
	ShapeType_PolygonM             ShapeType = 536870915
	ShapeType_MultiPointM          ShapeType = 536870916
	ShapeType_MultiLineStringM     ShapeType = 536870917
	ShapeType_MultiPolygonM        ShapeType = 536870918
	ShapeType_GeometryM            ShapeType = 536870919
	ShapeType_GeometryCollectionM  ShapeType = 536870920
	ShapeType_PointZ               ShapeType = 1073741825
	ShapeType_LineStringZ          ShapeType = 1073741826
	ShapeType_PolygonZ             ShapeType = 1073741827
	ShapeType_MultiPointZ          ShapeType = 1073741828
	ShapeType_MultiLineStringZ     ShapeType = 1073741829
	ShapeType_MultiPolygonZ        ShapeType = 1073741830
	ShapeType_GeometryZ            ShapeType = 1073741831
	ShapeType_GeometryCollectionZ  ShapeType = 1073741832
	ShapeType_PointZM              ShapeType = 1610612737
	ShapeType_LineStringZM         ShapeType = 1610612738
	ShapeType_PolygonZM            ShapeType = 1610612739
	ShapeType_MultiPointZM         ShapeType = 1610612740
	ShapeType_MultiLineStringZM    ShapeType = 1610612741
	ShapeType_MultiPolygonZM       ShapeType = 1610612742
	ShapeType_GeometryZM           ShapeType = 1610612743
	ShapeType_GeometryCollectionZM ShapeType = 1610612744
)

func (ShapeType) EnumDescriptor

func (ShapeType) EnumDescriptor() ([]byte, []int)

func (ShapeType) MultiType

func (s ShapeType) MultiType() ShapeType

MultiType returns the corresponding multi-type for a shape type, or unset if there is no multi-type.

func (ShapeType) String

func (x ShapeType) String() string

func (ShapeType) To2D

func (s ShapeType) To2D() ShapeType

To2D returns the ShapeType for the corresponding 2D geometry type.

type SpatialObject

type SpatialObject struct {
	// Type is the type of the SpatialObject.
	Type SpatialObjectType `protobuf:"varint,1,opt,name=type,proto3,enum=cockroach.geopb.SpatialObjectType" json:"type,omitempty"`
	// EWKB is the EWKB representation of the spatial object.
	EWKB EWKB `protobuf:"bytes,2,opt,name=ewkb,proto3,casttype=EWKB" json:"ewkb,omitempty"`
	// SRID is the denormalized SRID derived from the EWKB.
	SRID SRID `protobuf:"varint,3,opt,name=srid,proto3,casttype=SRID" json:"srid,omitempty"`
	// ShapeType is denormalized ShapeType derived from the EWKB.
	ShapeType ShapeType `protobuf:"varint,4,opt,name=shape_type,json=shapeType,proto3,enum=cockroach.geopb.ShapeType" json:"shape_type,omitempty"`
	// BoundingBox is the bounding box of the SpatialObject.
	BoundingBox *BoundingBox `protobuf:"bytes,5,opt,name=bounding_box,json=boundingBox,proto3" json:"bounding_box,omitempty"`
}

SpatialObject represents a serialization of a Geospatial type.

func (*SpatialObject) Descriptor

func (*SpatialObject) Descriptor() ([]byte, []int)

func (*SpatialObject) EWKBHex

func (b *SpatialObject) EWKBHex() string

EWKBHex returns the EWKB-hex version of this data type

func (*SpatialObject) Marshal

func (m *SpatialObject) Marshal() (dAtA []byte, err error)

func (*SpatialObject) MarshalTo

func (m *SpatialObject) MarshalTo(dAtA []byte) (int, error)

func (*SpatialObject) MarshalToSizedBuffer

func (m *SpatialObject) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*SpatialObject) MemSize

func (b *SpatialObject) MemSize() uintptr

MemSize returns the size of the spatial object in memory.

func (*SpatialObject) ProtoMessage

func (*SpatialObject) ProtoMessage()

func (*SpatialObject) Reset

func (m *SpatialObject) Reset()

func (*SpatialObject) Size

func (m *SpatialObject) Size() (n int)

func (*SpatialObject) String

func (m *SpatialObject) String() string

func (*SpatialObject) Unmarshal

func (m *SpatialObject) Unmarshal(dAtA []byte) error

func (*SpatialObject) XXX_DiscardUnknown

func (m *SpatialObject) XXX_DiscardUnknown()

func (*SpatialObject) XXX_Marshal

func (m *SpatialObject) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*SpatialObject) XXX_Merge

func (m *SpatialObject) XXX_Merge(src proto.Message)

func (*SpatialObject) XXX_Size

func (m *SpatialObject) XXX_Size() int

func (*SpatialObject) XXX_Unmarshal

func (m *SpatialObject) XXX_Unmarshal(b []byte) error

type SpatialObjectType

type SpatialObjectType int32

SpatialObjectType represents the type of the SpatialObject.

const (
	SpatialObjectType_Unknown       SpatialObjectType = 0
	SpatialObjectType_GeographyType SpatialObjectType = 1
	SpatialObjectType_GeometryType  SpatialObjectType = 2
)

func (SpatialObjectType) EnumDescriptor

func (SpatialObjectType) EnumDescriptor() ([]byte, []int)

func (SpatialObjectType) String

func (x SpatialObjectType) String() string

type WKB

type WKB []byte

WKB is the Well Known Bytes form of a spatial object.

type WKT

type WKT string

WKT is the Well Known Text form of a spatial object.

Jump to

Keyboard shortcuts

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