CRS Transformation
WherobotsDB provides coordinate reference system (CRS) transformation through theST_Transform function. The transformation engine supports multiple CRS input formats and grid-based transformations for high-accuracy datum shifts.
Supported CRS Formats
WherobotsDB supports the following formats for specifying source and target coordinate reference systems.Authority Code
The most common way to specify a CRS is using an authority code in the formatAUTHORITY:CODE. WherobotsDB uses spatialreference.org as an open-source CRS database, which supports multiple authorities:
WKT1 (OGC Well-Known Text)
WKT1 is the OGC Well-Known Text format for CRS definitions. It starts withPROJCS[...] for projected CRS or GEOGCS[...] for geographic CRS.
WKT2 (ISO 19162:2019)
WKT2 is the modern ISO 19162:2019 standard format. It starts withPROJCRS[...] for projected CRS or GEOGCRS[...] for geographic CRS.
PROJ String
PROJ strings provide a compact way to define CRS using projection parameters. They start with+proj=.
PROJJSON
PROJJSON is a JSON representation of CRS, useful when working with JSON-based workflows.Grid File Support
Grid files enable high-accuracy datum transformations, such as NAD27 to NAD83 or OSGB36 to ETRS89. WherobotsDB supports loading grid files from multiple sources.Grid File Sources
Grid files can be specified using the+nadgrids parameter in PROJ strings:
When using the
@ prefix, grid files are automatically fetched from PROJ CDN.
Optional vs Mandatory Grids
@prefix (optional): The transformation continues without the grid if it’s unavailable. Use this when the grid improves accuracy but isn’t required.- No prefix (mandatory): An error is thrown if the grid file cannot be found.
SQL Examples with Grid Files
Coordinate Order
WherobotsDB expects geometries to be in longitude/latitude (lon/lat) order. If your data is in lat/lon order, useST_FlipCoordinates to swap the coordinates before transformation.
WherobotsDB automatically handles coordinate order in the CRS definition, ensuring the source and target CRS use lon/lat order internally.
Using Geometry SRID
If the geometry already has an SRID set, you can omit the source CRS parameter:Function Signatures
See Also
- ST_SetSRID - Set the SRID of a geometry
- ST_SRID - Get the SRID of a geometry
- ST_FlipCoordinates - Swap X and Y coordinates

