---
title: Attribute Functions
slug: fP9fjf1F0zP60C-AL2X0b
description: Use attribute functions in OcientGeo to manage and analyze geospatial data entries.
docTags: 
createdAt: Wed Jan 11 2023 18:33:50 GMT+0000 (Coordinated Universal Time)
updatedAt: Mon Mar 30 2026 18:52:46 GMT+0000 (Coordinated Universal Time)
---

OcientGeo™ attribute functions return descriptive information on the specified data set.

# ST\_COORDDIM

Alias for ST\_NDIMS or ST\_NDIMENSION.&#x20;

Returns an `INTEGER` of the coordinate dimension of the specified geography.

**Syntax**

```sql
ST_COORDDIM(geo)
```

| **Argument** | **Data** **Type**                   | **Description**                                          |
| ------------ | ----------------------------------- | -------------------------------------------------------- |
| `geo`        | `POINT`, `LINESTRING`, or `POLYGON` | The geospatial object used to calculate the dimensions.  |

**Example**

```sql
SELECT ST_COORDDIM(ST_POLYGON('POLYGON((1 1, 2 1, 2 2, 1 1))'));
```

*Output*: `2`

# ST\_DIMENSION

Returns an `INTEGER` that represents the dimension of the specified geography. This table describes the result values of the `ST_DIMENSION` function.&#x20;

| **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. &#x20;

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.&#x20;

**Syntax**

```sql
ST_DIMENSION(geo)
```

| **Argument** | **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.

```sql
SELECT ST_DIMENSION(ST_LINESTRING('POINT EMPTY'));
```

*Output*: `-1`&#x20;

In this example, the function evaluates a `LINESTRING` with a single `POINT` value.

```sql
SELECT ST_DIMENSION(ST_LINESTRING('ST_POINT(0 0)'));
```

*Output*: `0`&#x20;

This example evaluates an empty `LINESTRING`.

```sql
SELECT ST_DIMENSION(ST_LINESTRING('LINESTRING EMPTY'));
```

*Output*: `-1`&#x20;

In this example, the function again evaluates a `LINESTRING` with a single `POINT` value.

```sql
SELECT ST_DIMENSION(ST_LINESTRING('LINESTRING(0 0)'));
```

*Output*: `0`&#x20;

In this example, the function evaluates a `LINESTRING` with multiple `POINT` values.

```sql
SELECT ST_DIMENSION(ST_LINESTRING('LINESTRING(0 0, 1 1)'));
```

*Output*: `1`&#x20;

This example evaluates an empty `POLYGON`.

```sql
SELECT ST_DIMENSION(ST_POLYGON('POLYGON EMPTY'));
```

*Output*: `-1`&#x20;

This example evaluates a `POLYGON` with a single `POINT`.

```sql
SELECT ST_DIMENSION(ST_POLYGON('POLYGON((1 1))'));
```

*Output*: `0`

This example evaluates a `POLYGON` with two `POINT` values.

```sql
SELECT ST_DIMENSION(ST_POLYGON('POLYGON((0 0, 1 1))'));
```

*Output*: `1`

This example evaluates a `POLYGON` with multiple `POINT` values, enough to close the `POLYGON`.

```sql
SELECT ST_DIMENSION(ST_POLYGON('POLYGON((0 0, 1 0, 1 1, 0 0))'));
```

*Output*:  `2`

# ST\_GEOMETRYTYPE

Returns a `STRING` that represents the geometry of the input geospatial value. Supported values are `ST_POINT`, `ST_LINESTRING`, and `ST_POLYGON`. This function enforces the same strict dimension types as the [ST\_DIMENSION](./#stdimension) function. If `geo` is NULL, then the function returns NULL.

**Syntax**

```sql
ST_GEOMETRYTYPE(geo)
```

| **Argument** | **Data** **Type**                | **Description**                                            |
| ------------ | -------------------------------- | ---------------------------------------------------------- |
| `geo`        | `POINT`, `LINESTRING`, `POLYGON` | A geospatial value to be identified by its dimension type. |

**Example**&#x20;

```sql
SELECT ST_GEOMETRYTYPE(ST_POINT(1, 2));
```

*Output*: `ST_POINT`

# ST\_ISEMPTY

Returns `TRUE` if the specified geography value is empty, such as `'POLYGON EMPTY'`. A NULL input value returns NULL.

**Syntax**

```sql
ST_ISEMPTY(geo)
```

| **Argument** | **Data** **Type**                | **Description**                                    |
| ------------ | -------------------------------- | -------------------------------------------------- |
| `geo`        | `POINT`, `LINESTRING`, `POLYGON` | A geospatial value to be examined if it is empty.  |

**Example**

```sql
SELECT ST_ISEMPTY(ST_POLYGON('POLYGON EMPTY'));
```

*Output*: `TRUE`

# ST\_MEMSIZE

Returns an `INTEGER` representing the number of bytes in memory required to store the specified geography.

**Syntax**

```sql
ST_MEMSIZE(geo)
```

| **Argument** | **Data** **Type**                | **Description**                                        |
| ------------ | -------------------------------- | ------------------------------------------------------ |
| `geo`        | `POINT`, `LINESTRING`, `POLYGON` | A geospatial value to be measured by its data memory.  |

**Example**

```sql
SELECT ST_MEMSIZE(ST_POINT(1,1));
```

*Output*: `16`

# ST\_NDIMS or ST\_NDIMENSION

Alias for [ST\_COORDDIM](./#stcoorddim).

# ST\_NPOINTS or ST\_NUMPOINTS

Returns an `INTEGER` representing the number of `POINT` values in a specified geography.&#x20;

If the specified value is a `POLYGON`, this function counts the number of `POINT` values in both the exterior and any holes.

**Syntax**

```sql
ST_NPOINTS(geo)
```

```sql
ST_NUMPOINTS(geo)
```

| **Argument** | **Data** **Type**                | **Description**                                                       |
| ------------ | -------------------------------- | --------------------------------------------------------------------- |
| `geo`        | `POINT`, `LINESTRING`, `POLYGON` | A geospatial value to be examined for its count of `POINT` values.    |

**Example**

```sql
SELECT ST_NPOINTS(
   ST_POLYGON(
      'POLYGON((1 2, 1 3, 1 2))'));
```

*Output*: `3`

# ST\_SRID

Returns the EPSG code of the spatial reference identifier (SRID) of the input geography. All Ocient® geographies are of type GCS WGS 84, which is identified by the value 4326. There is no way to set a different SRID.

**Syntax**

```sql
ST_SRID(geo)
```

| **Argument** | **Data** **Type**                | **Description**                                       |
| ------------ | -------------------------------- | ----------------------------------------------------- |
| `geo`        | `POINT`, `LINESTRING`, `POLYGON` | A geospatial value to be analyzed for its EPSG code.  |

**Example**

```sql
SELECT ST_SRID(ST_MAKEPOINT(1.1, 3.11));
```

*Output*: `4326`

# ST\_X

Returns the x value, or longitude, of the specified `POINT`. The returned value is a `DOUBLE` type.

**Syntax**

```sql
ST_X(point)
```

| **Argument** | **Data** **Type** | **Description**                                                    |
| ------------ | ----------------- | ------------------------------------------------------------------ |
| `point`      | `POINT`           | A geospatial point to be analyzed for its x value, the longitude.  |

**Example**

```sql
SELECT ST_X(ST_POINT(3, 5));
```

*Output*: `3`

# ST\_XMAX

Returns the maximum x value of the specified geography. The returned value is a `DOUBLE` type.

**Syntax**

```sql
ST_XMAX(geo)
```

| **Argument** | **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.&#x20;

```sql
SELECT ST_XMAX(
        ST_POLYGON(ST_LINESTRING('LINESTRING(2 5, 1 2, 1 4, 0 3)')));
```

*Output*: `2`

# ST\_XMIN

Returns the minimum x value of the specified geography.

**Syntax**

```sql
ST_XMIN(geo)
```

| **Argument** | **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.&#x20;

```sql
SELECT ST_XMIN(
        ST_POLYGON(ST_LINESTRING('LINESTRING(2 5, 1 2, 1 4, 0 3)')));
```

*Output*: `0`

# ST\_Y

Returns the y value, or latitude, of the specified `POINT`. The returned value is a `DOUBLE` type.

**Syntax**

```sql
ST_Y(point)
```

| **Argument** | **Data** **Type** | **Description**                                                   |
| ------------ | ----------------- | ----------------------------------------------------------------- |
| `point`      | `POINT`           | A geospatial point to be analyzed for its y value, the latitude.  |

**Example**

```sql
SELECT ST_Y(ST_POINT(3, 5));
```

*Output*: `5`

# ST\_YMAX

Returns the maximum y value of the specified geography.

**Syntax**

```sql
ST_YMAX(geo)
```

| **Argument** | **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.&#x20;

```sql
SELECT ST_YMAX(
        ST_POLYGON(ST_LINESTRING('LINESTRING(2 5, 1 2, 1 4, 0 3)')));
```

*Output*: `5`

# ST\_YMIN

Returns the minimum y value of the specified geography.

**Syntax**

```sql
ST_YMIN(geo)
```

| **Argument** | **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.&#x20;

```sql
SELECT ST_YMIN(
        ST_POLYGON(ST_LINESTRING('LINESTRING(2 5, 1 2, 1 4, 0 3)')));
```

*Output*: `2`

# Related Links

[Geospatial Data Types](<././Data Types.md>)

[Linestring Constructors](<./Linestring Constructors.md>)

[Point Constructors](<./Point Constructors.md>)

[Polygon Constructors](<./Polygon Constructors.md>)

