diff --git a/docs/functions.md b/docs/functions.md index e1245ed9..6afc5886 100644 --- a/docs/functions.md +++ b/docs/functions.md @@ -47,7 +47,7 @@ | [`ST_GeomFromHEXWKB`](#st_geomfromhexwkb) | Creates a GEOMETRY from a HEXWKB string | | [`ST_GeomFromText`](#st_geomfromtext) | Deserializes a GEOMETRY from a WKT string, optionally ignoring invalid geometries | | [`ST_GeomFromWKB`](#st_geomfromwkb) | Deserializes a GEOMETRY from a WKB encoded blob | -| [`ST_GeometryType`](#st_geometrytype) | Returns a 'GEOMETRY_TYPE' enum identifying the input geometry type. | +| [`ST_GeometryType`](#st_geometrytype) | Returns a 'GEOMETRY_TYPE' enum identifying the input geometry type. Possible enum return types are: `POINT`, `LINESTRING`, `POLYGON`, `MULTIPOINT`, `MULTILINESTRING`, `MULTIPOLYGON`, and `GEOMETRYCOLLECTION`. | | [`ST_HasM`](#st_hasm) | Check if the input geometry has M values. | | [`ST_HasZ`](#st_hasz) | Check if the input geometry has Z values. | | [`ST_Hilbert`](#st_hilbert) | Encodes the X and Y values as the hilbert curve index for a curve covering the given bounding box. | @@ -610,14 +610,14 @@ Returns if two geometries are within a target distance of each-other #### Signature ```sql -DOUBLE ST_DWithin_Spheroid (col0 POINT_2D, col1 POINT_2D, col2 DOUBLE) +BOOLEAN ST_DWithin_Spheroid (col0 POINT_2D, col1 POINT_2D, col2 DOUBLE) ``` #### Description Returns if two POINT_2D's are within a target distance in meters, using an ellipsoidal model of the earths surface -The input geometry is assumed to be in the [EPSG:4326](https://en.wikipedia.org/wiki/World_Geodetic_System) coordinate system (WGS84), with [latitude, longitude] axis order and the distance is returned in meters. This function uses the [GeographicLib](https://geographiclib.sourceforge.io/) library to solve the [inverse geodesic problem](https://en.wikipedia.org/wiki/Geodesics_on_an_ellipsoid#Solution_of_the_direct_and_inverse_problems), calculating the distance between two points using an ellipsoidal model of the earth. This is a highly accurate method for calculating the distance between two arbitrary points taking the curvature of the earths surface into account, but is also the slowest. + The input geometry is assumed to be in the [EPSG:4326](https://en.wikipedia.org/wiki/World_Geodetic_System) coordinate system (WGS84), with [latitude, longitude] axis order and the distance is returned in meters. This function uses the [GeographicLib](https://geographiclib.sourceforge.io/) library to solve the [inverse geodesic problem](https://en.wikipedia.org/wiki/Geodesics_on_an_ellipsoid#Solution_of_the_direct_and_inverse_problems), calculating the distance between two points using an ellipsoidal model of the earth. This is a highly accurate method for calculating the distance between two arbitrary points taking the curvature of the earths surface into account, but is also the slowest. ---- @@ -1059,7 +1059,15 @@ ANY ST_GeometryType (col0 WKB_BLOB) #### Description -Returns a 'GEOMETRY_TYPE' enum identifying the input geometry type. +Returns a 'GEOMETRY_TYPE' enum identifying the input geometry type. Possible enum return types are: `POINT`, `LINESTRING`, `POLYGON`, `MULTIPOINT`, `MULTILINESTRING`, `MULTIPOLYGON`, and `GEOMETRYCOLLECTION`. + +#### Example + +```sql +SELECT DISTINCT ST_GeometryType(ST_GeomFromText('POINT(1 1)')); +---- +POINT +``` ---- @@ -2342,7 +2350,7 @@ SELECT * FROM ST_Drivers(); #### Signature ```sql -ST_Read (col0 VARCHAR, keep_wkb BOOLEAN, max_batch_size INTEGER, sequential_layer_scan BOOLEAN, layer VARCHAR, sibling_files VARCHAR[], spatial_filter WKB_BLOB, spatial_filter_box BOX_2D, allowed_drivers VARCHAR[], open_options VARCHAR[]) +ST_Read (col0 VARCHAR, keep_wkb BOOLEAN, max_batch_size INTEGER, sequential_layer_scan BOOLEAN, layer VARCHAR, spatial_filter WKB_BLOB, spatial_filter_box BOX_2D, sibling_files VARCHAR[], allowed_drivers VARCHAR[], open_options VARCHAR[]) ``` #### Description diff --git a/spatial/src/spatial/core/functions/scalar/st_geometrytype.cpp b/spatial/src/spatial/core/functions/scalar/st_geometrytype.cpp index 9b7c0b5c..2acfe200 100644 --- a/spatial/src/spatial/core/functions/scalar/st_geometrytype.cpp +++ b/spatial/src/spatial/core/functions/scalar/st_geometrytype.cpp @@ -84,10 +84,14 @@ static void WKBTypeFunction(DataChunk &args, ExpressionState &state, Vector &res // Documentation //------------------------------------------------------------------------------ static constexpr const char *DOC_DESCRIPTION = R"( - Returns a 'GEOMETRY_TYPE' enum identifying the input geometry type. + Returns a 'GEOMETRY_TYPE' enum identifying the input geometry type. Possible enum return types are: `POINT`, `LINESTRING`, `POLYGON`, `MULTIPOINT`, `MULTILINESTRING`, `MULTIPOLYGON`, and `GEOMETRYCOLLECTION`. )"; -static constexpr const char *DOC_EXAMPLE = R"()"; +static constexpr const char *DOC_EXAMPLE = R"( +SELECT DISTINCT ST_GeometryType(ST_GeomFromText('POINT(1 1)')); +---- +POINT +)"; static constexpr DocTag DOC_TAGS[] = {{"ext", "spatial"}, {"category", "property"}}; //------------------------------------------------------------------------------