> ## Documentation Index
> Fetch the complete documentation index at: https://docs.cockroachlabs.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Spatial Data Overview

CockroachDB supports efficiently storing and querying spatial data.

See the links below for more information about how to use CockroachDB for spatial use cases.

## Getting started

* [Install CockroachDB](/docs/stable/install-cockroachdb.md)

## Migrating spatial data into and out of CockroachDB

* [Migrate from Shapefiles](/docs/stable/migrate-from-shapefiles.md)
* [Migrate from GeoJSON](/docs/stable/migrate-from-geojson.md)
* [Migrate from GeoPackage](/docs/stable/migrate-from-geopackage.md)
* [Migrate from OpenStreetMap](/docs/stable/migrate-from-openstreetmap.md)

## Reference

* [Spatial indexes](/docs/stable/spatial-indexes.md)
* [Spatial and GIS Glossary of Terms](/docs/stable/architecture/glossary.md)
* Refer to [Known Limitations](/docs/stable/spatial-data-overview.md#known-limitations)
* [Spatial functions](/docs/stable/functions-and-operators.md#spatial-functions)
* [Client library compatibility](/docs/stable/query-spatial-data.md#compatibility)

### Spatial objects

* [POINT](/docs/stable/point.md)
* [LINESTRING](/docs/stable/linestring.md)
* [POLYGON](/docs/stable/polygon.md)
* [MULTIPOINT](/docs/stable/multipoint.md)
* [MULTILINESTRING](/docs/stable/multilinestring.md)
* [MULTIPOLYGON](/docs/stable/multipolygon.md)
* [GEOMETRYCOLLECTION](/docs/stable/geometrycollection.md)

### Data representations

* [Well known text](/docs/stable/well-known-text.md)
* [Well known binary](/docs/stable/well-known-binary.md)
* [GeoJSON](/docs/stable/geojson.md)
* [SRID 4326 - longitude and latitude](/docs/stable/srid-4326.md)

### Spatial functions

In addition to the [generated reference documentation for spatial functions](/docs/stable/functions-and-operators.md#spatial-functions), we have written additional documentation for the following functions, including examples:

* [`ST_Contains`](/docs/stable/st_contains)
* [`ST_ConvexHull`](/docs/stable/st_convexhull)
* [`ST_CoveredBy`](/docs/stable/st_coveredby)
* [`ST_Covers`](/docs/stable/st_covers)
* [`ST_Disjoint`](/docs/stable/st_disjoint)
* [`ST_Equals`](/docs/stable/st_equals)
* [`ST_Intersects`](/docs/stable/st_intersects)
* [`ST_Overlaps`](/docs/stable/st_overlaps)
* [`ST_Touches`](/docs/stable/st_touches)
* [`ST_Union`](/docs/stable/st_union)
* [`ST_Within`](/docs/stable/st_within)

## Known limitations

* Not all [PostGIS spatial functions](https://postgis.net/docs/reference.html) are supported.
* The `AddGeometryColumn` [spatial function](/docs/stable/functions-and-operators.md#spatial-functions) only allows constant arguments.
* The `AddGeometryColumn` spatial function only allows the `true` value for its `use_typmod` parameter.
* CockroachDB does not support the `@` operator. Instead of using `@` in spatial expressions, we recommend using the inverse, with `~`. For example, instead of `a @ b`, use `b ~ a`.
* CockroachDB does not yet support [`INSERT`](/docs/stable/insert)s into the [`spatial_ref_sys` table](/docs/stable/architecture/glossary#spatial-system-tables). This limitation also blocks the [`ogr2ogr -f PostgreSQL` file conversion command](https://gdal.org/programs/ogr2ogr.html#cmdoption-ogr2ogr-f).
* CockroachDB does not yet support [k-nearest neighbors](https://wikipedia.org/wiki/K-nearest_neighbors_algorithm).
* CockroachDB does not support using [schema name prefixes](/docs/stable/sql-name-resolution.md#how-name-resolution-works) to refer to [data types](/docs/stable/data-types.md) with type modifiers (e.g., `public.geometry(linestring, 4326)`). Instead, use fully-unqualified names to refer to data types with type modifiers (e.g., `geometry(linestring,4326)`).
* Defining a custom SRID by inserting rows into [`spatial_ref_sys`](/docs/stable/architecture/glossary#spatial_ref_sys) is not currently supported.
* Clusters that mix `s390x` with other CPU architectures are unsupported for geospatial workloads. Due to differences in how trigonometric functions are computed on `s390x` systems, geospatial queries in heterogeneous clusters with `s390x` are likely to get incorrect results. This can include taking a backup on one architecture and restoring it on another.
* [Spatial features](/docs/stable/spatial-data-overview.md) are disabled on ARM Macs due to an issue with macOS code signing for the [GEOS](https://libgeos.org/) libraries. Users needing spatial features on an ARM Mac may instead [use Rosetta](https://developer.apple.com/documentation/virtualization/running_intel_binaries_in_linux_vms_with_rosetta) to [run the Intel binary](/docs/stable/install-cockroachdb-mac.md) or use the [Docker image](/docs/stable/install-cockroachdb-mac.md#use-docker) distribution.

## See also

* [Introducing Distributed Spatial Data in CockroachDB](https://www.cockroachlabs.com/blog/spatial-data/) (blog post)
