Well-known text representation in an SQL editor

Since the well-known text representation is text, it can be typed into an SQL script or directly into an SQL editor. The text is converted to and from a geometry by a function. Functions that convert text to geometry have the following syntax:
function ('text description',SRID)
Example:
ST_PointFromText('point zm (10.01 20.04 3.2 9.5)', 1)

The spatial reference identifier, SRID—the primary key to the spatial_references table—identifies the possible spatial reference systems within the HCL® OneDB® instance. An SRID is assigned to a spatial column when it is created. Before a geometry can be inserted into a spatial column, its SRID must match the SRID of the spatial column.

The text description is made up of three basic components enclosed in single quotation marks:
'geometry type [coordinate type] [coordinate list]'

The geometry type is defined as one of the following: point, linestring, polygon, multipoint, multilinestring, or multipolygon.

The coordinate type specifies whether the geometry has Z coordinates or measures. Leave this argument blank if the geometry has neither; otherwise, set the coordinate type to Z for geometries containing Z coordinates, M for geometries with measures, and ZM for geometries that have both.

The coordinate list defines the double-precision vertices of the geometry. Coordinate lists are comma-delimited and enclosed by parentheses. Geometries having multiple components require sets of parentheses to enclose each component part. If the geometry is empty, the EMPTY keyword replaces the coordinates.

The following examples provide a complete list of all possible permutations of the text description portion of the text representation.
Geometry type Text description Comment
ST_Point ‘point empty' Empty point
ST_Point ‘point z empty' Empty point with Z coordinate
ST_Point ‘point m empty' Empty point with measure
ST_Point ‘point zm empty' Empty point with Z coordinate and measure
ST_Point ‘point ( 10.05 10.28 )' Point
ST_Point ‘point z ( 10.05 10.28 2.51 )' Point with Z coordinate
ST_Point ‘point m ( 10.05 10.28 4.72 )' Point with measure
ST_Point ‘point zm ( 10.05 10.28 2.51 4.72 )' Point with Z coordinate and measure
ST_LineString ‘linestring empty' Empty linestring
ST_LineString ‘linestring z empty' Empty linestring with Z coordinates
ST_LineString ‘linestring m empty' Empty linestring with measures
ST_LineString ‘linestring zm empty' Empty linestring with Z coordinates and measures
ST_LineString ‘linestring ( 10.05 10.28 , 20.95 20.89 )' Linestring
ST_LineString ‘linestring z ( 10.05 10.28 3.09, 20.95 31.98 4.72, 21.98 29.80 3.51 )' Linestring with Z coordinates
ST_LineString ‘linestring m ( 10.05 10.28 5.84, 20.95 31.98 9.01, 21.98 29.80 12.84 )' Linestring with measures
ST_LineString ‘linestring zm (10.05 10.28 3.09 5.84, 20.95 31.98 4.72 9.01, 21.98 29.80 3.51 12.84)' Linestring with Z coordinates and measures
ST_Polygon ‘polygon empty' Empty polygon
ST_Polygon ‘polygon z empty' Empty polygon with Z coordinates
ST_Polygon ‘polygon m empty Empty polygon with measures
ST_Polygon ‘polygon zm empty' Empty polygon with Z coordinates and measures
ST_Polygon ‘polygon (( 10 10, 10 20, 20 20, 20 15, 10 10))' Polygon
ST_Polygon ‘polygon z ((10 10 3, 10 20 3, 20 20 3, 20 15 4, 10 10 3))' Polygon with Z coordinates
ST_Polygon ‘polygon m (( 10 10 8, 10 20 9, 20 20 9, 20 15 9, 10 10 8 ))' Polygon with measures
ST_Polygon ‘polygon zm (( 10 10 3 8, 10 20 3 9, 20 20 3 9, 20 15 4 9, 10 10 3 8 ))' Polygon with Z coordinates and measures
ST_MultiPoint ‘multipoint empty' Empty multipoint
ST_MultiPoint ‘multipoint z empty' Empty multipoint with Z coordinates
ST_MultiPoint ‘multipoint m empty' Empty multipoint with measures
ST_MultiPoint ‘multipoint zm empty' Empty multipoint with Z coordinates and measures
ST_MultiPoint ‘multipoint (10 10, 20 20)' Multipoint with two points
ST_MultiPoint ‘multipoint z (10 10 2, 20 20 3)' Multipoint with Z coordinates
ST_MultiPoint ‘multipoint m (10 10 4, 20 20 5)' Multipoint with measures
ST_MultiPoint ‘multipoint zm (10 10 2 4, 20 20 3 5)' Multipoint with Z coordinates and measures
ST_MultiLineString ‘multilinestring empty' Empty multilinestring
ST_MultiLineString ‘multilinestring z empty' Empty multilinestring with Z coordinates
ST_MultiLineString ‘multilinestring m empty' Empty multilinestring with measures
ST_MultiLineString ‘multilinestring zm empty' Empty multilinestring with Z coordinates and measures
ST_MultiLineString ‘multilinestring (( 10.05 10.28 , 20.95 20.89 ),( 20.95 20.89, 31.92 21.45))' Multilinestring
ST_MultiLineString ‘multilinestring z ((10.05 10.28 3.4, 20.95 20.89 4.5),( 20.95 20.89 4.5, 31.92 21.45 3.6))' Multilinestring with Z coordinates
ST_MultiLineString ‘multilinestring m ((10.05 10.28 8.4, 20.95 20.89 9.5),( 20.95 20.89 9.5, 31.92 21.45 8.6))' Multilinestring with measures
ST_MultiLineString ‘multilinestring zm ((10.05 10.28 3.4 8.4, 20.95 20.89 4.5 9.5), ( 20.95 20.89 4.5 9.5, 31.92 21.45 3.6 8.6))' Multilinestring with Z coordinates and measures
ST_MultiPolygon ‘multipolygon empty' Empty multipolygon
ST_MultiPolygon ‘multipolygon z empty' Empty multipolygon with Z coordinates
ST_MultiPolygon ‘multipolygon m empty' Empty multipolygon with measures
ST_MultiPolygon ‘multipolygon zm empty' Empty multipolygon with Z coordinates and measures
ST_MultiPolygon ‘multipolygon (((10 10, 10 20, 20 20, 20 15 , 10 10), (50 40, 50 50, 60 50, 60 40, 50 40)))' Multipolygon
ST_MultiPolygon ‘multipolygon z (((10 10 7, 10 20 8, 20 20 7, 20 15 5, 10 10 7), (50 40 6, 50 50 6, 60 50 5, 60 40 6, 50 40 7)))' Multipolygon with Z coordinates
ST_MultiPolygon ‘multipolygon m (((10 10 2, 10 20 3, 20 20 4, 20 15 5, 10 10 2), (50 40 7, 50 50 3, 60 50 4, 60 40 5, 50 40 7)))' Multipolygon with measures
ST_MultiPolygon ‘multipolygon zm (((10 10 7 2, 10 20 8 3, 20 20 7 4, 20 15 5 5, 10 10 7 2), (50 40 6 7, 50 50 6 3, 60 50 5 4, 60 40 6 5, 50 40 7 7)))' Multipolygon with Z coordinates and measures