This topic describes the types and formats of spatial data supported by Lindorm GanosBase.
Geometry and its subtypes
The following table describes the geometry data type and its subtypes that are supported by Lindorm GanosBase.
Data type | Description | Examples |
Geometry | The general type of all spatial data. Geometry objects include the following subtypes of objects: point objects, LineString objects, polygon objects, MultiPoint objects, MultiPolygon objects, MultiLineString objects, and GeometryCollection objects. We recommend that you do not set the data type of a spatial column to Geometry. Note
| Specify the data type of spatial columns when you create a spatio-temporal table. |
Point | The data type of point objects. A point object is identified by its coordinates that consists of a longitude x and a latitude y. Note Three-dimensional point objects cannot be used for calculation. Lindorm GanosBase converts three-dimensional point objects into tow-dimensional point objects in calculation. | Specify the GPS coordinates that are received by vehicles and ships. |
LineString | The data type of LineString objects. A LineString object consists of two or more point objects. In a LineString object, the end point of a line segment must be the start point of the next line segment. Note A line segment must consist of two or more point objects. Two line segments can have the same vertex. |
|
Polygon | The data type of polygon objects. The outer boundary of a polygon object is a closed line. The coordinates of the start point and endpoint of the line are the same. Note A polygon object can be identified by at least three point objects. |
|
MultiPoint | A collection of zero or more Point objects. | Specify all ticket offices in an amusement park. |
MultiLineString | A collection of zero or more LineString objects. | Specify a street that consists of multiple LineString objects. |
MultiPolygon | A collection of zero or more Polygon objects. | Specify a city that consists of one or more counties or districts. Each county or district is represented by a Polygon object. |
GeometryCollection | A collection of zero or more geometry objects. | Specify a collection of multiple graphics. |
Construct a geometry object
Construct a geometry object based on point coordinates
You can use the ST_MakePoint
function to construct a point object based on point coordinates or use the ST_LineFromMultiPoint
function to construct a LineString object based on point coordinates. For more information, see Geometry constructors.
Construct a geometry object based on a WKT string
WKT format
WKT is a format defined by the Open Geospatial Consortium (OGC). WKT uses texts to describe spatial objects. For more information about WKT, see Well-Known Text. Lindorm GanosBase allows you to specify geometry objects of the following types in WKT format: Point, LineString, Polygon, MultiPoint, MultiLineString, and MultiPolygon. Spatial information in WKT format cannot contain Spatial Reference IDentifier (SRID).
The following table describes the WKT data types supported by Lindorm GanosBase.
Data type | Syntax | Example |
Point |
|
|
LineString |
|
|
Polygon |
|
|
MultiPoint |
|
|
MultiLineString |
|
|
MultiPolygon |
|
|
GeometryCollection | GeometryCollection (Point/LineString/Polygon/MultiPoint/MultiLineString/MultiPolygon) |
|
Construction method
You can use the ST_GeomFromText
function to construct a geometry object based on a WKT string. For more information, see Geometry constructors.
Output a Geometry object
Output a Geometry object as a WKB string
WKB is a format defined by OGC. WKB uses serializing bytes to describe spatial objects. For more information about WKB, see Well-Known Binary. Lindorm GanosBase allows you to specify geometry objects of the following types in WKB format: Point, LineString, Polygon, MultiPoint, MultiLineString, and MultiPolygon.
A geometry object is output as a hexadecimal WKB string. The following statement provides an example on how to output a geometry object as a WKB string:
SELECT ST_GeomFromText('POINT(-10.1 3.3)') as p;
The following result is returned:
+--------------------------------+
| p |
+--------------------------------+
| 0020000001000010E6C02433333333 |
| 3333400A666666666666 |
+--------------------------------+
Output a geometry object as a WKT string
You can use the ST_AsText
function to output a geometry object as a WKT string. For more information, see Output functions.