All Products
Search
Document Center

Lindorm:Spatial data types

Last Updated:Jul 18, 2023

This topic describes the types and formats of spatial data supported by Lindorm Ganos.

Geometry and its subtypes

The following table describes the geometry data type and its subtypes that are supported by Lindorm Ganos.

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
  • If you set the data type of a spatial column to Geometry, all types of spatial objects can be stored in this column, including point, LineString, Polygon, MultiPoint, MultiPolygon, MultiLineString, and GeometryCollection objects. However, a spatio-temporal index that is specific to a certain subtype is not suitable for this column.

  • If you set the data type of a spatial column to a subtype of Geometry, only data of this subtype can be stored in this column. For example, a column whose data type is Point can store only point objects.

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 Ganos 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.

  • Specify a street that may consist of multiple LineString objects.

  • Specify the trajectory of a vehicle within a specific time range. The trajectory consists of multiple point objects.

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.

  • Specify geofences.

  • Specify polygon objects such as land blocks, forests, and administrative divisions in maps.

  • Specify graphics such as rectangles and circles.

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 Ganos 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 Ganos.

Data type

Syntax

Example

Point

POINT(x y): indicates a point whose longitude is x and latitude is y.

  • POINT(-10.1 3.3): indicates a specific point.

  • POINT EMPTY: indicates an empty point.

LineString

LINESTRING(x1 y1,x2 y2,...,xn yn): indicates a LineString object that is specified by n points. The values of x1 to xn indicate the longitudes of the points, and the values of y1 to yn indicate the latitudes of the points.

  • LINESTRING(3 4,10 50,20 25): indicates a LineString object that is specified by three points.

  • LINESTRING EMPTY: indicates an empty line.

Polygon

POLYGON((x1 y1,x2 y2,...,xn yn),(xa ya,xb b,...,xm ym)): indicates a polygon object that consists of two closed boundaries. The values of x1 to xn and xa to xm indicate the longitudes of points in the boundaries. The values of y1 to yn and ya to ym indicate the latitudes of points in the boundaries.

  • POLYGON((2 2, 2 8, 8 8, 8 2, 2 2)): indicates a polygon with a closed outer boundary.

  • 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)): indicates a polygon that consists of a closed outer boundary and a closed inner boundary.

  • POLYGON EMPTY: indicates an empty polygon.

MultiPoint

MultiPoint(x1 y1, x2 y2, ..., xn yn): indicates a collection of n points. The values of x1 to xn indicate the longitudes of the points, and the values of y1 to yn indicate the latitudes of the points.

MULTIPOINT (10 40, 40 30, 20 20, 30 10): indicates a collection of the following four points: POINT(10 40), POINT(40 30), POINT(20 20), and POINT(30 10).

MultiLineString

MultiLineString ((x11 y11, x12 y12, ..., x1n y1n),(x21 y21, x22 y22, ..., x2m y2m), ...): indicates a collection of multiple LineString objects. The values of x11 to x1n and x21 to x2m indicate the longitudes of the points in the first two LineString objects, and the values of y11 to y1n and y21 to y2m indicate the latitudes of the points in the first two LineString objects.

MULTILINESTRING ((10 10, 20 20, 10 40),(40 40, 30 30, 40 20, 30 10)) : indicates a collection of the following two LineString objects: LINESTRING(10 10, 20 20, 10 40) and LINESTRING(40 40, 30 30, 40 20, 30 10).

MultiPolygon

MultiPolygon (((x11 y11, x12 y12, ..., x1n y1n)),((x21 y21, x22 y22, ..., x2m y2m)),...): indicates a collection of multiple Polygon objects. The values of x11 to x1n and x21 to x2m indicate the longitudes of the points in the first two Polygon objects, and the values of y11 to y1n and y21 to y2m indicate the latitudes of the points in the first two Polygon objects.

  • MULTIPOLYGON (((30 20, 45 40, 10 40, 30 20)), ((15 5, 40 10, 10 20, 5 10, 15 5))): indicates a collection of the following two Polygon objects that have only a closed outer boundary: POLYGON((30 20, 45 40, 10 40, 30 20)) and POLYGON((15 5, 40 10, 10 20, 5 10, 15 5)).

  • 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))) : indicates a collection of the following Polygon objects:

    • A Polygon object with only a closed outer boundary: POLYGON((40 40, 20 45, 45 30, 40 40)).

    • A Polygon object that consists of a closed outer boundary and a closed inner boundary: POLYGON((20 35, 10 30, 10 10, 30 5, 45 20, 20 35),(30 20, 20 15, 20 25, 30 20)).

GeometryCollection

GeometryCollection (Point/LineString/Polygon/MultiPoint/MultiLineString/MultiPolygon)

GEOMETRYCOLLECTION (POINT (40 10),LINESTRING (10 10, 20 20, 10 40),POLYGON ((40 40, 20 45, 45 30, 40 40))) : indicates a collection of the following geometry objects:

  • A Point object: POINT(40 10).

  • A LineString object: LINESTRING(10 10, 20 20, 10 40).

  • A Polygon object: POLYGON((40 40, 20 45, 45 30, 40 40)).

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 Ganos 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.