geopb

package
v0.15.0 Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

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.

Variables

View Source
var (
	ErrInvalidLengthGeopb = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowGeopb   = fmt.Errorf("proto: integer overflow")
)
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",
}
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,
}
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) 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 (dst *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
)

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

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) 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 (dst *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