aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEven Rouault <even.rouault@spatialys.com>2021-04-01 23:45:24 +0200
committerGitHub <noreply@github.com>2021-04-01 23:45:24 +0200
commitc19c6606a2166c7d3a4564096396e6fb13e26c9c (patch)
tree2e3c7da9bf3329cf07cd17e9889a4594d809b3f1
parent4f5df6999ea4832629929a2caaefb4844ff28a0c (diff)
parent3c202610d35ee76b960d41cb69434c1353d78096 (diff)
downloadPROJ-c19c6606a2166c7d3a4564096396e6fb13e26c9c.tar.gz
PROJ-c19c6606a2166c7d3a4564096396e6fb13e26c9c.zip
Merge pull request #2628 from OSGeo/backport-2627-to-8.0
[Backport 8.0] Database: refine checks for 'Geog3D to Geog2D+XXX' transformations, …
-rw-r--r--data/sql/commit.sql23
-rw-r--r--data/sql/customizations.sql8
-rw-r--r--data/sql/metadata.sql2
3 files changed, 25 insertions, 8 deletions
diff --git a/data/sql/commit.sql b/data/sql/commit.sql
index 3394c756..d9adffef 100644
--- a/data/sql/commit.sql
+++ b/data/sql/commit.sql
@@ -118,21 +118,33 @@ FOR EACH ROW BEGIN
g.method_name LIKE 'Geographic3D to GravityRelatedHeight%' AND
g.target_crs_auth_name || g.target_crs_code NOT IN
(SELECT auth_name || code FROM vertical_crs));
- SELECT RAISE(ABORT, 'One grid_transformation with Geographic3D to GravityRelatedHeight has not its source_crs in geodetic_crs table with type = ''geographic 3D''')
+ SELECT RAISE(ABORT, 'One grid_transformation with Geographic3D to GravityRelatedHeight or Geog3D to Geog2D+XXX has not its source_crs in geodetic_crs table with type = ''geographic 3D''')
WHERE EXISTS (SELECT * FROM grid_transformation g WHERE
g.deprecated = 0 AND
- g.method_name LIKE 'Geographic3D to GravityRelatedHeight%' AND
- NOT (g.auth_name = 'EPSG' AND g.code IN (9658,9660)) AND -- those are wrongly registered as they refer to a Geog2D CRS in EPGS v10.017. Reported to EPSG
+ (g.method_name LIKE 'Geographic3D to %' OR g.method_name LIKE 'Geog3D to %') AND
+ NOT (g.auth_name = 'EPSG' AND g.code IN (9658,9659,9660,9661)) AND -- those are wrongly registered as they refer to a Geog2D CRS in EPGS v10.017. Reported to EPSG
g.source_crs_auth_name || g.source_crs_code NOT IN
(SELECT auth_name || code FROM geodetic_crs
WHERE type = 'geographic 3D'));
+ -- check that grids with 'Vertical Offset by Grid Interpolation' methods are properly registered
+ SELECT RAISE(ABORT, 'One grid_transformation with Vertical Offset by Grid Interpolation has not its source_crs in vertical_crs table')
+ WHERE EXISTS (SELECT * FROM grid_transformation g WHERE
+ g.method_name LIKE 'Vertical Offset by Grid Interpolation%' AND
+ g.source_crs_auth_name || g.source_crs_code NOT IN
+ (SELECT auth_name || code FROM vertical_crs));
+ SELECT RAISE(ABORT, 'One grid_transformation with Vertical Offset by Grid Interpolation has not its target_crs in vertical_crs table')
+ WHERE EXISTS (SELECT * FROM grid_transformation g WHERE
+ g.method_name LIKE 'Vertical Offset by Grid Interpolation%' AND
+ g.target_crs_auth_name || g.target_crs_code NOT IN
+ (SELECT auth_name || code FROM vertical_crs));
+
-- check that transformations intersect the area of use of their source/target CRS
-- EPSG, ESRI and IGNF have cases where this does not hold.
SELECT RAISE(ABORT, 'The area of use of at least one coordinate_operation does not intersect the one of its source CRS')
WHERE EXISTS (SELECT * FROM coordinate_operation_view v, crs_view c, usage vu, extent ve, usage cu, extent ce WHERE
v.deprecated = 0 AND
- v.auth_name NOT IN ('EPSG', 'ESRI', 'IGNF') AND
+ (v.table_name = 'grid_transformation' OR v.auth_name NOT IN ('EPSG', 'ESRI', 'IGNF')) AND
v.source_crs_auth_name = c.auth_name AND
v.source_crs_code = c.code AND
vu.object_table_name = v.table_name AND
@@ -149,7 +161,8 @@ FOR EACH ROW BEGIN
SELECT RAISE(ABORT, 'The area of use of at least one coordinate_operation does not intersect the one of its target CRS')
WHERE EXISTS (SELECT * FROM coordinate_operation_view v, crs_view c, usage vu, extent ve, usage cu, extent ce WHERE
v.deprecated = 0 AND
- v.auth_name NOT IN ('EPSG', 'ESRI', 'IGNF') AND
+ ((v.table_name = 'grid_transformation' AND NOT (v.auth_name = 'IGNF' AND v.code = 'TSG1185'))
+ OR v.auth_name NOT IN ('EPSG', 'ESRI', 'IGNF')) AND
v.target_crs_auth_name = c.auth_name AND
v.target_crs_code = c.code AND
vu.object_table_name = v.table_name AND
diff --git a/data/sql/customizations.sql b/data/sql/customizations.sql
index 802fe82c..f075f1bd 100644
--- a/data/sql/customizations.sql
+++ b/data/sql/customizations.sql
@@ -340,7 +340,10 @@ FROM grid_transformation gt
JOIN compound_crs c ON gt.target_crs_code = c.code AND gt.target_crs_auth_name = c.auth_name
JOIN geodetic_crs gcrs ON gt.source_crs_auth_name = gcrs.auth_name AND gt.source_crs_code = gcrs.code
JOIN vertical_crs vcrs on vcrs.auth_name = c.vertical_crs_auth_name AND vcrs.code = c.vertical_crs_code
-WHERE method_auth_name = 'EPSG' AND method_code IN ('1088', '1089', '1090', '1091', '1092', '1093', '1094', '1095', '1096', '1097', '1098', '1103') AND gt.deprecated = 0;
+WHERE method_auth_name = 'EPSG' AND method_name LIKE 'Geog3D to Geog2D+%'
+AND NOT EXISTS (SELECT 1 FROM grid_transformation gt2 WHERE gt2.method_name LIKE 'Geographic3D to%' AND gt2.source_crs_auth_name = gt.source_crs_auth_name AND gt2.source_crs_code = gt.source_crs_code AND gt2.target_crs_auth_name = vcrs.auth_name AND gt2.target_crs_code = vcrs.code)
+AND NOT (gt.auth_name == 'EPSG' AND gt.code IN (9659,9661)) -- issue in EPSG v10.017
+AND gt.deprecated = 0;
INSERT INTO "usage"
SELECT
@@ -355,4 +358,5 @@ SELECT
u.scope_code
FROM grid_transformation gt
JOIN usage u ON u.object_auth_name = gt.auth_name AND u.object_code = gt.code AND u.object_table_name = 'grid_transformation'
-WHERE method_auth_name = 'EPSG' AND method_code IN ('1088', '1089', '1090', '1091', '1092', '1093', '1094', '1095', '1096', '1097', '1098', '1103') AND gt.deprecated = 0;
+WHERE method_auth_name = 'EPSG' AND method_name LIKE 'Geog3D to Geog2D+%'
+AND EXISTS (SELECT 1 FROM grid_transformation gt2 WHERE gt2.auth_name = 'PROJ' AND gt2.code = gt.auth_name || '_' || gt.code || '_RESTRICTED_TO_VERTCRS');
diff --git a/data/sql/metadata.sql b/data/sql/metadata.sql
index b0d14ed5..ef2c8fae 100644
--- a/data/sql/metadata.sql
+++ b/data/sql/metadata.sql
@@ -9,6 +9,6 @@
INSERT INTO "metadata" VALUES('DATABASE.LAYOUT.VERSION.MAJOR', 1);
INSERT INTO "metadata" VALUES('DATABASE.LAYOUT.VERSION.MINOR', 0);
--- TODO at next update remove exception case for EPSG:9658 and 9660 in customization.sql
+-- TODO at next update remove exception case for EPSG:9658 to 9661 in commit.sql and EPSG:9659 and 9661 in customizations.sql
INSERT INTO "metadata" VALUES('EPSG.VERSION', 'v10.017');
INSERT INTO "metadata" VALUES('EPSG.DATE', '2021-04-01');