Spatial Data Overview

On this page Carat arrow pointing down

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

Migrating spatial data into and out of CockroachDB

Reference

Spatial objects

Data representations

Spatial functions

In addition to the generated reference documentation for spatial functions, we have written additional documentation for the following functions, including examples:

Known limitations

  • Not all PostGIS spatial functions are supported. #49203
  • The AddGeometryColumn spatial function only allows constant arguments. #49402
  • The AddGeometryColumn spatial function only allows the true value for its use_typmod parameter. #49448
  • 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. #56124
  • CockroachDB does not yet support INSERTs into the spatial_ref_sys table. This limitation also blocks the ogr2ogr -f PostgreSQL file conversion command. #55903
  • CockroachDB does not yet support k-nearest neighbors. #55227
  • CockroachDB does not support using schema name prefixes to refer to data types 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)). #56492
  • Defining a custom SRID by inserting rows into spatial_ref_sys is not currently supported. #55903
  • 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. #148783
  • Spatial features are disabled on ARM Macs due to an issue with macOS code signing for the GEOS libraries. Users needing spatial features on an ARM Mac may instead use Rosetta to run the Intel binary or use the Docker image distribution. #93161

See also

×