WKT
Returns a WKT (Well Known Text) geometric object from various Geo Data Types. Supported WKT objects are:- POINT
- MULTIPOINT
- POLYGON
- MULTIPOLYGON
- LINESTRING
- MULTILINESTRING
geo_data can be one of the following Geo Data Types or their underlying primitive types:
Returned value
- WKT geometric object
POINTis returned for a Point. - WKT geometric object
MULTIPOINTis returned for a MultiPoint. - WKT geometric object
POLYGONis returned for a Polygon - WKT geometric object
MULTIPOLYGONis returned for a MultiPolygon. - WKT geometric object
LINESTRINGis returned for a LineString. - WKT geometric object
MULTILINESTRINGis returned for a MultiLineString.
readWKTMultiPolygon
Converts a WKT (Well Known Text) MultiPolygon into a MultiPolygon type.Example
Input parameters
String starting withMULTIPOLYGON
Returned value
MultiPolygonreadWKTPolygon
Converts a WKT (Well Known Text) MultiPolygon into a Polygon type.Example
Input parameters
String starting withPOLYGON
Returned value
PolygonreadWKTPoint
ThereadWKTPoint function in ClickHouse parses a Well-Known Text (WKT) representation of a Point geometry and returns a point in the internal ClickHouse format.
Syntax
Arguments
wkt_string: The input WKT string representing a Point geometry.
Returned value
The function returns a ClickHouse internal representation of the Point geometry.Example
readWKTLineString
Parses a Well-Known Text (WKT) representation of a LineString geometry and returns it in the internal ClickHouse format.Syntax
Arguments
wkt_string: The input WKT string representing a LineString geometry.
Returned value
The function returns a ClickHouse internal representation of the linestring geometry.Example
readWKTMultiLineString
Parses a Well-Known Text (WKT) representation of a MultiLineString geometry and returns it in the internal ClickHouse format.Syntax
Arguments
wkt_string: The input WKT string representing a MultiLineString geometry.
Returned value
The function returns a ClickHouse internal representation of the multilinestring geometry.Example
readWKTMultiPoint
Parses a Well-Known Text (WKT) representation of a MultiPoint geometry and returns it in the internal ClickHouse format.Syntax
Arguments
wkt_string: The input WKT string representing a MultiPoint geometry.
Returned value
The function returns a ClickHouse internal representation of the multipoint geometry.Example
readWKTRing
Parses a Well-Known Text (WKT) representation of a Polygon geometry and returns a ring (closed linestring) in the internal ClickHouse format.Syntax
Arguments
wkt_string: The input WKT string representing a Polygon geometry.
Returned value
The function returns a ClickHouse internal representation of the ring (closed linestring) geometry.Example
polygonsWithinSpherical
Returns true or false depending on whether or not one polygon lies completely inside another polygon. Reference https://www.boost.org/doc/libs/1_62_0/libs/geometry/doc/html/geometry/reference/algorithms/within/within_2.htmlExample
readWKBMultiPolygon
Converts a WKB (Well Known Binary) MultiPolygon into a MultiPolygon type.Example
Input parameters
String starting withMULTIPOLYGON
Returned value
MultiPolygonreadWKBPolygon
Converts a WKB (Well Known Binary) MultiPolygon into a Polygon type.Example
Input parameters
String starting withPOLYGON
Returned value
PolygonreadWKBPoint
ThereadWKBPoint function in ClickHouse parses a Well-Known Binary (WKB) representation of a Point geometry and returns a point in the internal ClickHouse format.
Syntax
Arguments
wkb_string: The input WKB string representing a Point geometry.
Returned value
The function returns a ClickHouse internal representation of the Point geometry.Example
readWKBLineString
Parses a Well-Known Binary (WKB) representation of a LineString geometry and returns it in the internal ClickHouse format.Syntax
Arguments
wkb_string: The input WKB string representing a LineString geometry.
Returned value
The function returns a ClickHouse internal representation of the linestring geometry.Example
readWKBMultiLineString
Parses a Well-Known Binary (WKB) representation of a MultiLineString geometry and returns it in the internal ClickHouse format.Syntax
Arguments
wkb_string: The input WKB string representing a MultiLineString geometry.
Returned value
The function returns a ClickHouse internal representation of the multilinestring geometry.Example
Input parameters
Returned value
UInt8, 0 for false, 1 for truereadWKBMultiPoint
Parses a Well-Known Binary (WKB) representation of a MultiPoint geometry and returns it in the internal ClickHouse format.Syntax
Arguments
wkb_string: The input WKB string representing a MultiPoint geometry.
Returned value
The function returns a ClickHouse internal representation of the multipoint geometry.Example
polygonsDistanceSpherical
Calculates the minimal distance between two points where one point belongs to the first polygon and the second to another polygon. Spherical means that coordinates are interpreted as coordinates on a pure and ideal sphere, which is not true for the Earth. Using this type of coordinate system speeds up execution, but of course is not precise.Example
Input parameters
Two polygonsReturned value
Float64polygonsDistanceCartesian
Calculates distance between two polygonsExample
Input parameters
Two polygonsReturned value
Float64polygonsEqualsCartesian
Returns true if two polygons are equalExample
Input parameters
Two polygonsReturned value
UInt8, 0 for false, 1 for truepolygonsSymDifferenceSpherical
Calculates the spatial set theoretic symmetric difference (XOR) between two polygonsExample
Input parameters
PolygonsReturned value
MultiPolygonpolygonsSymDifferenceCartesian
The same aspolygonsSymDifferenceSpherical, but the coordinates are in the Cartesian coordinate system; which is more close to the model of the real Earth.
Example
Input parameters
PolygonsReturned value
MultiPolygonpolygonsIntersectionSpherical
Calculates the intersection (AND) between polygons, coordinates are spherical.Example
Input parameters
PolygonsReturned value
MultiPolygonpolygonsWithinCartesian
Returns true if the second polygon is within the first polygon.Example
Input parameters
Two polygonsReturned value
UInt8, 0 for false, 1 for truepolygonsIntersectCartesian
Returns true if the two polygons intersect (share any common area or boundary).Example
Input parameters
Two polygonsReturned value
UInt8, 0 for false, 1 for truepolygonsIntersectSpherical
Returns true if the two polygons intersect (share any common area or boundary). Reference https://www.boost.org/doc/libs/1_62_0/libs/geometry/doc/html/geometry/reference/algorithms/intersects.htmlExample
Input parameters
Two polygonsReturned value
UInt8, 0 for false, 1 for truegeometryIntersectCartesian
Returns true if two geometries intersect (share any common point, line or area). UnlikepolygonsIntersectCartesian, it accepts any geometry data type
(Point, MultiPoint, LineString, MultiLineString, Ring, Polygon, MultiPolygon), including the common
Geometry type, and the two arguments may be of different types.
Coordinates are in the Cartesian coordinate system.
Example
Input parameters
Two geometries of any geometry data type (orGeometry).
Returned value
UInt8, 0 for false, 1 for truegeometryIntersectSpherical
Returns true if two geometries intersect (share any common point, line or area). UnlikepolygonsIntersectSpherical, it accepts any geometry data type
(Point, MultiPoint, LineString, MultiLineString, Ring, Polygon, MultiPolygon), including the common
Geometry type, and the two arguments may be of different types.
Coordinates are interpreted as being on an ideal sphere.
Example
Input parameters
Two geometries of any geometry data type (orGeometry).
Returned value
UInt8, 0 for false, 1 for truepolygonConvexHullCartesian
Calculates a convex hull. Reference Coordinates are in Cartesian coordinate system.Example
Input parameters
MultiPolygonReturned value
PolygonpolygonMinimumRotatedRectangleCartesian
Returns the rectangle of the smallest area that contains a geometry, which can be rotated (the oriented envelope), likeST_OrientedEnvelope in PostGIS and ST_MinimumRotatedRectangle in DuckDB.
It is found with rotating calipers over the convex hull, so the function takes the same arguments as polygonConvexHullCartesian.
For collinear points the rectangle has zero width, for a single point all its corners are that point, and without points the ring is empty.
Coordinates are in Cartesian coordinate system.
Example
Input parameters
A geometry other than a point:MultiPolygon, Polygon, Ring, MultiLineString, LineString, MultiPoint or Geometry.
Returned value
Polygon with one ring: the four corners clockwise, and the first corner again.exteriorRing
Returns the exterior ring of a polygon, which is the first ring of aPolygon, like ST_ExteriorRing.
For a Geometry argument the result is Geometry, which is NULL if the row is not a Polygon or has no rings, as in PostGIS.
For a Polygon without rings, the result is an empty Ring.
Syntax
ST_ExteriorRing.
Arguments
Returned value
Ring, or Geometry for aGeometry argument.
Example
interiorRingN
Returns then-th interior ring (hole) of a polygon, like ST_InteriorRingN.
n counts from 1, and a negative n counts from the last hole.
For a Geometry argument the result is Geometry, which is NULL if the row is not a Polygon or has no such hole, as in PostGIS.
For a Polygon without such a hole, the result is an empty Ring, as arrayElement returns the default value.
Syntax
ST_InteriorRingN.
Arguments
Returned value
Ring, or Geometry for aGeometry argument.
Example
pointN
Returns then-th point of a line or a ring, like ST_PointN.
n counts from 1, and a negative n counts from the last point.
For a Geometry argument the result is Geometry, which is NULL if the row is not a LineString or a Ring or has no such point, as in PostGIS.
For a LineString or a Ring without such a point, the result is (0, 0), as arrayElement returns the default value.
Syntax
ST_PointN.
Arguments
line— LineString, Ring or Geometry.n— The number of the point. (U)Int*.
Returned value
Point, or Geometry for aGeometry argument.