Attribute Functions
attribute functions return descriptive information on the specified data set.
Alias for ST_NDIMS or ST_NDIMENSION.
Returns an INTEGER of the coordinate dimension of the specified geography.
Syntax
Parameter | Data Type | Description |
---|---|---|
geo | POINT, LINESTRING, or POLYGON | The geospatial object used to calculate the dimensions. |
Example
Output: 2
Returns an INTEGER that represents the dimension of the specified geography. This table describes the result values of the ST_DIMENSION function.
ST_DIMENSION Result Value | Dimension Type |
---|---|
-1 | Empty geography value |
0 | POINT |
1 | LINESTRING |
2 | POLYGON |
The ST_DIMENSION function always returns 0 for non-empty POINT objects.
For non-empty LINESTRING and POLYGON objects, the ST_DIMENSION function returns the dimension value equal to the greatest dimension represented by their bounding points. For example, a LINESTRING or POLYGON object that contains only a single point returns 0. Similarly, a POLYGON object can return 1 if it contains insufficient points to represent a closed polygon.
Syntax
Parameter | Data Type | Description |
---|---|---|
geo | POINT, LINESTRING, or POLYGON | The geospatial object used to calculate the dimensions. |
Examples
In this example, the function evaluates a LINESTRING with an empty POINT value.
Output: -1
In this example, the function evaluates a LINESTRING with a single POINT value.
Output: 0
This example evaluates an empty LINESTRING.
Output: -1
In this example, the function again evaluates a LINESTRING with a single POINT value.
Output: 0
In this example, the function evaluates a LINESTRING with multiple POINT values.
Output: 1
This example evaluates an empty POLYGON.
Output: -1
This example evaluates a POLYGON with a single POINT.
Output: 0
This example evaluates a POLYGON with two POINT values.
Output: 1
This example evaluates a POLYGON with multiple POINT values, enough to close the POLYGON.
Output: 2
Returns a string representing the geometry type of the input value. Recognized values include ST_POINT, ST_LINESTRING, and ST_POLYGON and NULL.
Syntax
Parameter | Data Type | Description |
---|---|---|
geo | POINT, LINESTRING, POLYGON | A geospatial value to be identified by its geometry type. |
Example
Output: ST_POINT
Returns TRUE if the specified geography value is empty, such as 'POLYGON EMPTY'. A NULL input value returns NULL.
Syntax
Parameter | Data Type | Description |
---|---|---|
geo | POINT, LINESTRING, POLYGON | A geospatial value to be examined if it is empty. |
Example
Output: TRUE
Returns an INTEGER representing the number of bytes in memory required to store the specified geography.
Syntax
Parameter | Data Type | Description |
---|---|---|
geo | POINT, LINESTRING, POLYGON | A geospatial value to be measured by its data memory. |
Example
Output: 16
Alias for ST_COORDDIM.
Returns an INTEGER representing the number of POINT values in a specified geography.
If the specified value is a POLYGON, this function counts the number of POINT values in both the exterior and any holes.
Syntax
Parameter | Data Type | Description |
---|---|---|
geo | POINT, LINESTRING, POLYGON | A geospatial value to be examined for its count of POINT values. |
Example
Output: 3
Returns the EPSG code of the spatial reference identifier (SRID) of the input geography. All geographies are of type GCS WGS 84, which is identified by the value 4326. There is no way to set a different SRID.
Syntax
Parameter | Data Type | Description |
---|---|---|
geo | POINT, LINESTRING, POLYGON | A geospatial value to be analyzed for its EPSG code. |
Example
Output: 4326
Returns the x value of the given POINT. The returned value is a DOUBLE type.
Syntax
Parameter | Data Type | Description |
---|---|---|
point | POINT | A geospatial point to be analyzed for its x value. |
Example
Output: 3
Returns the maximum x value of the specified geography. The returned value is a DOUBLE type.
Syntax
Parameter | Data Type | Description |
---|---|---|
geo | POINT, LINESTRING, POLYGON | One or more geospatial points to be analyzed for the maximum x value. |
Example
In this example, the ST_XMAX function returns 2 because it is the largest x value of the specified points.
Output: 2
Returns the minimum x value of the specified geography.
Syntax
Parameter | Data Type | Description |
---|---|---|
geo | POINT, LINESTRING, POLYGON | One or more geospatial points to be analyzed for the minimum x value. |
Example
In this example, the ST_XMIN function returns 0 because it is the smallest x value of the specified points.
Output: 0
Returns the y value of the specified POINT. The returned value is a DOUBLE type.
Syntax
Parameter | Data Type | Description |
---|---|---|
point | POINT | A geospatial point to be analyzed for its y value. |
Example
Output: 5
Returns the maximum y value of specified geography.
Syntax
Parameter | Data Type | Description |
---|---|---|
geo | POINT, LINESTRING, POLYGON | One or more geospatial points to be analyzed for the maximum y value. |
Example
In this example, the ST_YMAX function returns 5 because it is the largest y value of the specified points.
Output: 5
Returns the minimum y value of specified geography.
Syntax
Parameter | Data Type | Description |
---|---|---|
geo | POINT, LINESTRING, POLYGON | One or more geospatial points to be analyzed for the minimum y value. |
Example
In this example, the ST_YMIN function returns 2 because it is the smallest y value of the specified points.
Output: 2