名称

postgis_srs_search — 返回使用区域完全包含 bounds 参数的投影坐标系的元数据记录。

概要

setof record postgis_srs_search(geometry bounds, text auth_name=EPSG);

描述

返回使用区域完全包含 bounds 参数的投影坐标系的元数据记录集。每个记录将包含 auth_nameauth_sridsrnamesrtextproj4text 以及使用区域的角点 point_swpoint_ne

搜索仅查找投影坐标系,旨在帮助用户探索适合其数据范围的可能系统。

可用性:3.4.0

Proj 版本 6+

示例

搜索路易斯安那州的投影坐标系。

SELECT auth_name, auth_srid, srname,
  ST_AsText(point_sw) AS point_sw,
  ST_AsText(point_ne) AS point_ne
FROM postgis_srs_search('SRID=4326;LINESTRING(-90 30, -91 31)')
LIMIT 3;

 auth_name | auth_srid |                srname                |      point_sw       |      point_ne
-----------+-----------+--------------------------------------+---------------------+---------------------
 EPSG      | 2801      | NAD83(HARN) / Louisiana South        | POINT(-93.94 28.85) | POINT(-88.75 31.07)
 EPSG      | 3452      | NAD83 / Louisiana South (ftUS)       | POINT(-93.94 28.85) | POINT(-88.75 31.07)
 EPSG      | 3457      | NAD83(HARN) / Louisiana South (ftUS) | POINT(-93.94 28.85) | POINT(-88.75 31.07)

扫描表格以查找最大范围,并找到可能适合的投影坐标系。

WITH ext AS (
  SELECT ST_Extent(geom) AS geom, Max(ST_SRID(geom)) AS srid
  FROM foo
)
SELECT auth_name, auth_srid, srname,
  ST_AsText(point_sw) AS point_sw,
  ST_AsText(point_ne) AS point_ne
FROM ext
CROSS JOIN postgis_srs_search(ST_SetSRID(ext.geom, ext.srid))
LIMIT 3;

另请参阅

postgis_srs_codespostgis_srs_allpostgis_srs