github.com/cockroachdb/cockroachdb-parser@v0.23.3-0.20240213214944-911057d40c9a/pkg/geo/geopb/geopb.proto (about) 1 // Copyright 2020 The Cockroach Authors. 2 // 3 // Use of this software is governed by the Business Source License 4 // included in the file licenses/BSL.txt. 5 // 6 // As of the Change Date specified in that file, in accordance with 7 // the Business Source License, use of this software will be governed 8 // by the Apache License, Version 2.0, included in the file 9 // licenses/APL.txt. 10 11 syntax = "proto3"; 12 package cockroach.geopb; 13 option go_package = "github.com/cockroachdb/cockroach/pkg/geo/geopb"; 14 15 import "gogoproto/gogo.proto"; 16 17 // ShapeType is the type of a spatial shape. Each of these corresponds to a 18 // different representation and serialization format. For example, a Point is a 19 // pair of doubles (or more than that for geometries with Z or N), a LineString 20 // is an ordered series of Points, etc. 21 enum ShapeType { 22 Unset = 0; 23 24 Point = 1; 25 LineString = 2; 26 Polygon = 3; 27 MultiPoint = 4; 28 MultiLineString = 5; 29 MultiPolygon = 6; 30 // Geometry can contain any type. 31 Geometry = 7; 32 // GeometryCollection can contain a list of any above type except for Geometry. 33 GeometryCollection = 8; 34 35 // Reserve (1 << 29) as M flag. 36 reserved 536870912; 37 38 // Reserve (1 << 30) as Z flag. 39 reserved 1073741824; 40 41 PointM = 536870913; 42 LineStringM = 536870914; 43 PolygonM = 536870915; 44 MultiPointM = 536870916; 45 MultiLineStringM = 536870917; 46 MultiPolygonM = 536870918; 47 GeometryM = 536870919; 48 GeometryCollectionM = 536870920; 49 50 PointZ = 1073741825; 51 LineStringZ = 1073741826; 52 PolygonZ = 1073741827; 53 MultiPointZ = 1073741828; 54 MultiLineStringZ = 1073741829; 55 MultiPolygonZ = 1073741830; 56 GeometryZ = 1073741831; 57 GeometryCollectionZ = 1073741832; 58 59 PointZM = 1610612737; 60 LineStringZM = 1610612738; 61 PolygonZM = 1610612739; 62 MultiPointZM = 1610612740; 63 MultiLineStringZM = 1610612741; 64 MultiPolygonZM = 1610612742; 65 GeometryZM = 1610612743; 66 GeometryCollectionZM = 1610612744; 67 } 68 69 // SpatialObjectType represents the type of the SpatialObject. 70 enum SpatialObjectType { 71 Unknown = 0; 72 73 GeographyType = 1; 74 GeometryType = 2; 75 } 76 77 // SpatialObject represents a serialization of a Geospatial type. 78 message SpatialObject { 79 // Type is the type of the SpatialObject. 80 SpatialObjectType type = 1; 81 // EWKB is the EWKB representation of the spatial object. 82 bytes ewkb = 2 [(gogoproto.customname)="EWKB",(gogoproto.casttype)="EWKB"]; 83 // SRID is the denormalized SRID derived from the EWKB. 84 int32 srid = 3 [(gogoproto.customname)="SRID",(gogoproto.casttype)="SRID"]; 85 // ShapeType is denormalized ShapeType derived from the EWKB. 86 ShapeType shape_type = 4; 87 // BoundingBox is the bounding box of the SpatialObject. 88 BoundingBox bounding_box = 5; 89 } 90 91 // BoundingBox represents the bounding box of a Geospatial type. 92 // Note the lo coordinates can be higher in value than the hi coordinates 93 // for spherical geometries. 94 // NOTE: Do not use these to compare bounding boxes. Use the library functions 95 // provided in the geo package to perform these calculations. 96 message BoundingBox { 97 double lo_x = 1; 98 double hi_x = 2; 99 double lo_y = 3; 100 double hi_y = 4; 101 }