Lindorm GanosBase supports geometry data types based on the Open Geospatial Consortium (OGC) standard. Use these types to define spatial columns in spatio-temporal tables and to read and write geometry objects in Well-Known Text (WKT) or Well-Known Binary (WKB) format.
Type hierarchy
Geometry is the abstract parent type. All geometry values belong to one of its concrete subtypes, which fall into two categories:
Atomic types — represent a single shape: Point, LineString, Polygon
Collection types — represent a set of shapes: MultiPoint, MultiLineString, MultiPolygon, GeometryCollection
Use a specific subtype when defining a spatial column. A column typed as Geometry can store any subtype, but a spatio-temporal index built for a specific subtype cannot be applied to a Geometry column.
Geometry types
| Type | Description | Use cases |
|---|---|---|
| Geometry | Abstract parent type. Stores any subtype, but spatio-temporal indexing is not available at the subtype level. Avoid using Geometry as the column type; use a specific subtype instead. | — |
| Point | A single location identified by longitude (x) and latitude (y). Three-dimensional point objects cannot be used for calculation; Lindorm GanosBase converts them to two-dimensional during calculation. | GPS coordinates for vehicles and ships |
| LineString | An ordered sequence of two or more points where each line segment's endpoint is the next segment's start point. Two segments can share a vertex. | Streets, vehicle trajectories |
| Polygon | A closed shape whose outer boundary is a closed line (start point equals endpoint). Requires at least three points. Can contain an inner boundary (hole). | Geofences, land blocks, administrative divisions, rectangles, circles |
| MultiPoint | A collection of zero or more Point objects. | Ticket office locations in an amusement park |
| MultiLineString | A collection of zero or more LineString objects. | A street made up of multiple line segments |
| MultiPolygon | A collection of zero or more Polygon objects. | A city made up of multiple counties or districts |
| GeometryCollection | A collection of zero or more geometry objects of any type. | Mixed-geometry datasets |
Choose a subtype
| If your data represents... | Use |
|---|---|
| A single location (GPS fix, landmark) | Point |
| A path or trajectory (road segment, vehicle route) | LineString |
| A closed area (boundary, region, zone) | Polygon |
| Multiple discrete locations | MultiPoint |
| Multiple paths | MultiLineString |
| Multiple areas | MultiPolygon |
| A mix of shapes | GeometryCollection |
WKT format
Well-Known Text (WKT) is the OGC-defined text format for describing geometry objects. For more information, see Well-Known Text.
WKT strings cannot contain a Spatial Reference IDentifier (SRID).
GanosBase supports WKT for the following types: Point, LineString, Polygon, MultiPoint, MultiLineString, and MultiPolygon.
Syntax reference
| Type | Syntax |
|---|---|
| Point | POINT(x y) — x is longitude, y is latitude |
| LineString | LINESTRING(x1 y1, x2 y2, ..., xn yn) — sequence of n points |
| Polygon | POLYGON((x1 y1, ..., xn yn), (xa ya, ..., xm ym)) — outer boundary followed by optional inner boundary |
| MultiPoint | MULTIPOINT(x1 y1, x2 y2, ..., xn yn) — collection of n points |
| MultiLineString | MULTILINESTRING((x11 y11, ..., x1n y1n), (x21 y21, ..., x2m y2m), ...) — collection of LineString objects |
| MultiPolygon | MULTIPOLYGON(((x11 y11, ..., x1n y1n)), ((x21 y21, ..., x2m y2m)), ...) — collection of Polygon objects |
| GeometryCollection | GEOMETRYCOLLECTION(Point/LineString/Polygon/MultiPoint/MultiLineString/MultiPolygon) — mixed collection |
WKT examples
-- Point
POINT(-10.1 3.3)
POINT EMPTY
-- LineString
LINESTRING(3 4, 10 50, 20 25)
LINESTRING EMPTY
-- Polygon: outer boundary only
POLYGON((2 2, 2 8, 8 8, 8 2, 2 2))
-- Polygon: outer boundary + inner boundary (hole)
POLYGON((0.5 0.5, 5 0, 5 5, 0 5, 0.5 0.5), (1.5 1, 4 3, 4 1, 1.5 1))
POLYGON EMPTY
-- MultiPoint
MULTIPOINT(10 40, 40 30, 20 20, 30 10)
-- Equivalent to: POINT(10 40), POINT(40 30), POINT(20 20), POINT(30 10)
-- MultiLineString
MULTILINESTRING((10 10, 20 20, 10 40), (40 40, 30 30, 40 20, 30 10))
-- Equivalent to: LINESTRING(10 10, 20 20, 10 40) and LINESTRING(40 40, 30 30, 40 20, 30 10)
-- MultiPolygon: two polygons with outer boundary only
MULTIPOLYGON(((30 20, 45 40, 10 40, 30 20)), ((15 5, 40 10, 10 20, 5 10, 15 5)))
-- MultiPolygon: one polygon with outer boundary only + one polygon with outer and inner boundary
MULTIPOLYGON(((40 40, 20 45, 45 30, 40 40)), ((20 35, 10 30, 10 10, 30 5, 45 20, 20 35), (30 20, 20 15, 20 25, 30 20)))
-- GeometryCollection
GEOMETRYCOLLECTION(POINT(40 10), LINESTRING(10 10, 20 20, 10 40), POLYGON((40 40, 20 45, 45 30, 40 40)))Construct a geometry object from WKT
Use ST_GeomFromText to construct a geometry object from a WKT string. For more information, see Geometry constructors.
Construct a geometry object from coordinates
Use ST_MakePoint to construct a Point object from coordinates, or ST_LineFromMultiPoint to construct a LineString from multiple point coordinates. For more information, see Geometry constructors.
WKB format
Well-Known Binary (WKB) is the OGC-defined binary format for describing geometry objects. For more information, see Well-Known Binary.
GanosBase supports WKB for the following types: Point, LineString, Polygon, MultiPoint, MultiLineString, and MultiPolygon.
Geometry objects are output as hexadecimal WKB strings. The following example shows a query that returns a WKB result:
SELECT ST_GeomFromText('POINT(-10.1 3.3)') as p;Output:
+--------------------------------+
| p |
+--------------------------------+
| 0020000001000010E6C02433333333 |
| 3333400A666666666666 |
+--------------------------------+Use ST_AsText to output a geometry object as a WKT string. For more information, see Output functions.