# Spatial Accessors

Components used to obtain properties about a geography data type or a set of geographies.

## ST Geometry Type

**Description**

This component adds a column containing the geography type of the geography in each row of the input table.

**Inputs**

* `Source table [Table]`
* `Geo column [Column]`

**Outputs**

* `Result table [Table]`

**External links**

[BigQuery reference](https://cloud.google.com/bigquery/docs/reference/standard-sql/geography_functions#st_geometrytype)

[PostgreSQL reference](https://postgis.net/docs/ST_GeometryType.html)

## ST NumGeometries

**Description**

This component creates a new table with an additional column with the number of parts in each input geography.

**Inputs**

* `Source table [Table]`
* `Geo column [Column]`

**Outputs**

* `Result table [Table]`

**External links**

[BigQuery reference](https://cloud.google.com/bigquery/docs/reference/standard-sql/geography_functions#st_numgeometries)

[Redshift reference](https://docs.aws.amazon.com/es_es/redshift/latest/dg/ST_NumGeometries-function.html)

[PostgreSQL reference](https://postgis.net/docs/ST_NumGeometries.html)

## ST NumPoints

**Description**

This component creates a new table with an additional column with the number of points in each input geography.

**Inputs**

* `Source table [Table]`
* `Geo column [Column]`

**Outputs**

* `Result table [Table]`

**External links**

[BigQuery reference](https://cloud.google.com/bigquery/docs/reference/standard-sql/geography_functions#st_numpoints)

[Snowflake reference](https://docs.snowflake.com/en/sql-reference/functions/st_npoints)

[Redshift reference](https://docs.aws.amazon.com/redshift/latest/dg/ST_NumPoints-function.html)

[PostgreSQL reference](https://postgis.net/docs/ST_NumPoints.html)

## ST Point N

**Description**

This component adds a new column with the point at the n-th position in the original input geography.

The geography must be of type linestring.

It will set the column value to null if the original geography is not a linestring, if it is empty, or if there is no vertex at the given index.

**Inputs**

* `Source table [Table]`
* `Geo column [Column]`
* `Point index [Number]`

**Outputs**

* `Result table [Table]`

**External links**

[BigQuery reference](https://cloud.google.com/bigquery/docs/reference/standard-sql/geography_functions#st_pointn)

[Snowflake reference](https://docs.snowflake.com/en/sql-reference/functions/st_pointn)

[Redshift reference](https://docs.aws.amazon.com/redshift/latest/dg/ST_PointN-function.html)

[PostgreSQL reference](https://postgis.net/docs/ST_PointN.html)

## ST X / ST Y <a href="#st-x-st-y" id="st-x-st-y"></a>

**Description**

This component creates a new table with additional columns containing X and Y coordinates of the geographies in the input table. This only applies to the case of point geographies.

**Inputs**

* `Source table [Table]`
* `Geo column [Column]`

**Outputs**

* `Result table [Table]`

**External links**

[BigQuery reference](https://cloud.google.com/bigquery/docs/reference/standard-sql/geography_functions#st_x)

[Snowflake reference](https://docs.snowflake.com/en/sql-reference/functions/st_x.html)

[Redshift reference](https://docs.aws.amazon.com/redshift/latest/dg/ST_X-function.html)

[PostgreSQL reference](https://postgis.net/docs/ST_X.html)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.carto.com/carto-user-manual/workflows/components/spatial-accessors.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
