Comment on page
indexing
CORE
This module contains functions used for indexing
ST_CRSFROMTEXT(proj4)
Description
Creates a CoordinateReferenceSystem from a PROJ.4 projection parameter string.
proj4
:String
input projection parameter string.
Return type
Geometry
Example
1
SELECT carto.ST_CRSFROMTEXT('+proj=merc +lat_ts=56.5 +ellps=GRS80');
2
-- +proj=merc +lat_ts=56.5 +ellps=GRS80
ST_EXTENTFROMGEOM(geom)
Description
geom
:Geometry
input Geometry.
Return type
Extent
Example
1
SELECT carto.ST_EXTENTFROMGEOM(carto.ST_MAKEBBOX(0, 0, 1, 1))
2
-- {"xmin": 0, "ymin": 0, "xmax": 1, "ymax": 1}
ST_EXTENTTOGEOM(extent)
Description
extent
:Extent
input extent.
Return type
Geometry
Example
1
WITH t AS (
2
SELECT carto.ST_EXTENTFROMGEOM(carto.ST_MAKEBBOX(0, 0, 1, 1)) as extent
3
)
4
SELECT carto.ST_ASTEXT(carto.ST_EXTENTTOGEOM(extent)) FROM t;
5
-- POLYGON ((0 0, 0 1, 1 1, 1 0, 0 0))
ST_GEOMREPROJECT(geom, crsA, crsB)
Description
Transform a
Geometry
from The Common Reference System crsA to crsB.geom
:Geometry
input geom.crsA
:CRS
input crsA.crsB
:CRS
input crsB.
Return type
Geometry
Example
1
WITH t AS (
2
SELECT carto.ST_POINT(3, 5) AS point,
3
carto.ST_CRSFROMTEXT('+proj=merc +lat_ts=56.5 +ellps=GRS80') AS crsa,
4
carto.ST_CRSFROMTEXT('+proj=longlat +ellps=GRS80 +datum=NAD83 +no_defs') AS crsb
5
)
6
SELECT carto.ST_ASTEXT(carto.ST_GEOMREPROJECT(point, crsa, crsb)) FROM t;
7
-- POINT (0.00003 0.00005)
ST_MAKEEXTENT(lowerX, lowerY, upperX, upperY)
Description
lowerX
:Double
input lower x value.lowerY
:Double
input lower y value.upperX
:Double
input upper x value.upperY
:Double
input upper y value.
Return type
Extent
Example
1
SELECT carto.ST_MAKEEXTENT(0, 0, 1, 1);
2
-- {"xmin": 0, "ymin": 0, "xmax": 1, "ymax": 1}
Last modified 8mo ago