From 23c44387d104b1d5c16c9f583d975ea4d895b534 Mon Sep 17 00:00:00 2001
From: Even Rouault <even.rouault@spatialys.com>
Date: Tue, 28 Sep 2021 14:47:06 +0200
Subject: Database: add some hand made entries early

---
 data/sql/customizations_early.sql | 6 ++++++
 1 file changed, 6 insertions(+)
 create mode 100644 data/sql/customizations_early.sql

(limited to 'data/sql/customizations_early.sql')

diff --git a/data/sql/customizations_early.sql b/data/sql/customizations_early.sql
new file mode 100644
index 00000000..7f9505df
--- /dev/null
+++ b/data/sql/customizations_early.sql
@@ -0,0 +1,6 @@
+-- This file is hand generated.
+
+INSERT INTO "extent" VALUES('PROJ','EXTENT_UNKNOWN','Not specified','Not specified.',-90.0,90.0,-180.0,180.0,0);
+INSERT INTO "scope" VALUES('PROJ','SCOPE_UNKNOWN','Not known.',0);
+
+INSERT INTO celestial_body VALUES('PROJ', 'EARTH', 'Earth', 6378137.0);
-- 
cgit v1.2.3


From bc30adc7d84aa07a551391f722c1ab7bcaae60ee Mon Sep 17 00:00:00 2001
From: Even Rouault <even.rouault@spatialys.com>
Date: Tue, 28 Sep 2021 14:47:08 +0200
Subject: Database: add check for Orthographic conversion

---
 data/sql/customizations_early.sql | 11 +++++++++++
 1 file changed, 11 insertions(+)

(limited to 'data/sql/customizations_early.sql')

diff --git a/data/sql/customizations_early.sql b/data/sql/customizations_early.sql
index 7f9505df..fceef235 100644
--- a/data/sql/customizations_early.sql
+++ b/data/sql/customizations_early.sql
@@ -4,3 +4,14 @@ INSERT INTO "extent" VALUES('PROJ','EXTENT_UNKNOWN','Not specified','Not specifi
 INSERT INTO "scope" VALUES('PROJ','SCOPE_UNKNOWN','Not known.',0);
 
 INSERT INTO celestial_body VALUES('PROJ', 'EARTH', 'Earth', 6378137.0);
+
+
+
+CREATE TRIGGER conversion_method_check_insert_trigger_orthographic
+INSTEAD OF INSERT ON conversion
+BEGIN
+
+    SELECT RAISE(ABORT, 'insert on conversion violates constraint: bad parameters for Orthographic')
+        WHERE NEW.deprecated != 1 AND NEW.method_auth_name = 'EPSG' AND NEW.method_code = '9840' AND (NEW.method_name != 'Orthographic' OR NEW.param1_auth_name != 'EPSG' OR NEW.param1_code != '8801' OR NEW.param1_name != 'Latitude of natural origin' OR NEW.param1_value IS NULL OR NEW.param1_uom_auth_name IS NULL OR NEW.param1_uom_code IS NULL OR (SELECT type FROM unit_of_measure WHERE auth_name = NEW.param1_uom_auth_name AND code = NEW.param1_uom_code) != 'angle' OR NEW.param2_auth_name != 'EPSG' OR NEW.param2_code != '8802' OR NEW.param2_name != 'Longitude of natural origin' OR NEW.param2_value IS NULL OR NEW.param2_uom_auth_name IS NULL OR NEW.param2_uom_code IS NULL OR (SELECT type FROM unit_of_measure WHERE auth_name = NEW.param2_uom_auth_name AND code = NEW.param2_uom_code) != 'angle' OR NEW.param3_auth_name != 'EPSG' OR NEW.param3_code != '8806' OR NEW.param3_name != 'False easting' OR NEW.param3_value IS NULL OR NEW.param3_uom_auth_name IS NULL OR NEW.param3_uom_code IS NULL OR (SELECT type FROM unit_of_measure WHERE auth_name = NEW.param3_uom_auth_name AND code = NEW.param3_uom_code) != 'length' OR NEW.param4_auth_name != 'EPSG' OR NEW.param4_code != '8807' OR NEW.param4_name != 'False northing' OR NEW.param4_value IS NULL OR NEW.param4_uom_auth_name IS NULL OR NEW.param4_uom_code IS NULL OR (SELECT type FROM unit_of_measure WHERE auth_name = NEW.param4_uom_auth_name AND code = NEW.param4_uom_code) != 'length' OR NEW.param5_auth_name IS NOT NULL OR NEW.param5_code IS NOT NULL OR NEW.param5_name IS NOT NULL OR NEW.param5_value IS NOT NULL OR NEW.param5_uom_auth_name IS NOT NULL OR NEW.param5_uom_code IS NOT NULL OR NEW.param6_auth_name IS NOT NULL OR NEW.param6_code IS NOT NULL OR NEW.param6_name IS NOT NULL OR NEW.param6_value IS NOT NULL OR NEW.param6_uom_auth_name IS NOT NULL OR NEW.param6_uom_code IS NOT NULL OR NEW.param7_auth_name IS NOT NULL OR NEW.param7_code IS NOT NULL OR NEW.param7_name IS NOT NULL OR NEW.param7_value IS NOT NULL OR NEW.param7_uom_auth_name IS NOT NULL OR NEW.param7_uom_code IS NOT NULL);
+
+END;
-- 
cgit v1.2.3


From e6e6e4ca345e774910afa5bbe485c3d9f7851cd4 Mon Sep 17 00:00:00 2001
From: Even Rouault <even.rouault@spatialys.com>
Date: Tue, 28 Sep 2021 14:47:09 +0200
Subject: Add a mapping for versioned authorities, so that one can use IAU:xxxx
 or IAU_2015:xxxx transparently

---
 data/sql/customizations_early.sql | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'data/sql/customizations_early.sql')

diff --git a/data/sql/customizations_early.sql b/data/sql/customizations_early.sql
index fceef235..08c44b37 100644
--- a/data/sql/customizations_early.sql
+++ b/data/sql/customizations_early.sql
@@ -5,7 +5,7 @@ INSERT INTO "scope" VALUES('PROJ','SCOPE_UNKNOWN','Not known.',0);
 
 INSERT INTO celestial_body VALUES('PROJ', 'EARTH', 'Earth', 6378137.0);
 
-
+INSERT INTO versioned_auth_name_mapping VALUES ('IAU_2015', 'IAU', '2015', 1);
 
 CREATE TRIGGER conversion_method_check_insert_trigger_orthographic
 INSTEAD OF INSERT ON conversion
-- 
cgit v1.2.3

