Skip to content

Commit

Permalink
Database: Additions to the norwegian NKG2020 transformation (OSGeo#2548
Browse files Browse the repository at this point in the history
…), and NGO48 to ETRS89 TIN transfrm (OSGeo#2554)

* Correction grid NKG:ETRF14 to EPSG:7922

* Added NKG:ITRF_TO_NO GIE test

* Correction grid no_kv_NKGETRF14_EPSG7922_2000 added to grid_alternatives.sql

* proj_method 'velocity_grid' added in check_grid_alternatives_proj_method. NKG velocity grid added to grid_alternatives.sql

* also include follow-up fix to master OSGeo#2548: e10a849

* Add NGO48 (EPSG:4273) to ETRS89 (EPSG:4258) triangulation-based transformation (OSGeo#2554)

Co-authored-by: Even Rouault <even.rouault@spatialys.com>
  • Loading branch information
himsve and rouault committed Mar 23, 2021
1 parent 8e9239c commit eeb9fef
Show file tree
Hide file tree
Showing 10 changed files with 245 additions and 17 deletions.
3 changes: 2 additions & 1 deletion data/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,11 @@ SQL_ORDERED_LIST = sql/begin.sql \
sql/deprecation.sql \
sql/esri.sql \
sql/ignf.sql \
sql/nkg.sql \
sql/grid_alternatives.sql \
sql/grid_alternatives_generated_noaa.sql \
sql/customizations.sql \
sql/nkg.sql \
sql/nkg_post_customizations.sql \
sql/commit.sql

EXTRA_DIST = proj.ini GL27 nad.lst nad27 nad83 \
Expand Down
6 changes: 6 additions & 0 deletions data/sql/grid_alternatives.sql
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,10 @@ VALUES
('EGM08_REDNAP.txt','es_ign_egm08-rednap.tif',NULL,'GTiff','geoid_like',0,NULL,'https://cdn.proj.org/es_ign_egm08-rednap.tif',1,1,NULL),
('EGM08_REDNAP_Canarias.txt','es_ign_egm08-rednap-canarias.tif',NULL,'GTiff','geoid_like',0,NULL,'https://cdn.proj.org/es_ign_egm08-rednap-canarias.tif',1,1,NULL),

-- eur_nkg - Nordic Geodetic Commission
('eur_nkg_nkgrf03vel_realigned.tif','eur_nkg_nkgrf03vel_realigned.tif',NULL,'GTiff','velocity_grid',0,NULL,'https://cdn.proj.org/eur_nkg_nkgrf03vel_realigned.tif',1,1,NULL),
('eur_nkg_nkgrf17vel.tif','eur_nkg_nkgrf17vel.tif',NULL,'GTiff','velocity_grid',0,NULL,'https://cdn.proj.org/eur_nkg_nkgrf17vel.tif',1,1,NULL),

-- fi_nls - National Land Survey of Finland (MML)
('fi_nls_n43_n60.json','fi_nls_n43_n60.json',NULL,'JSON','tinshift',0,NULL,'https://cdn.proj.org/fi_nls_n43_n60.json',1,1,NULL),
('fi_nls_n60_n2000.json','fi_nls_n60_n2000.json',NULL,'JSON','tinshift',0,NULL,'https://cdn.proj.org/fi_nls_n60_n2000.json',1,1,NULL),
Expand Down Expand Up @@ -184,6 +188,8 @@ VALUES
-- Norwegian grids
('HREF2018B_NN2000_EUREF89.gtx','no_kv_HREF2018B_NN2000_EUREF89.tif',NULL,'GTiff','geoid_like',0,NULL,'https://cdn.proj.org/no_kv_HREF2018B_NN2000_EUREF89.tif',1,1,NULL),
('href2008a.gtx','no_kv_href2008a.tif',NULL,'GTiff','geoid_like',0,NULL,'https://cdn.proj.org/no_kv_href2008a.tif',1,1,NULL),
('no_kv_NKGETRF14_EPSG7922_2000.tif','no_kv_NKGETRF14_EPSG7922_2000.tif',NULL,'GTiff','geocentricoffset',0,NULL,'https://cdn.proj.org/no_kv_NKGETRF14_EPSG7922_2000.tif',1,1,NULL),
('no_kv_ETRS89NO_NGO48_TIN.json','no_kv_ETRS89NO_NGO48_TIN.json',NULL,'JSON','tinshift',0,NULL,'https://cdn.proj.org/no_kv_ETRS89NO_NGO48_TIN.json',1,1,NULL),

-- nz_linz - New Zealand
('nzgd2kgrid0005.gsb','nz_linz_nzgd2kgrid0005.tif','nzgd2kgrid0005.gsb','GTiff','hgridshift',0,NULL,'https://cdn.proj.org/nz_linz_nzgd2kgrid0005.tif',1,1,NULL),
Expand Down
191 changes: 178 additions & 13 deletions data/sql/nkg.sql
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,6 @@ INSERT INTO "metadata" VALUES('NKG.SOURCE', 'https://github.com/NordicGeodesy/No
INSERT INTO "metadata" VALUES('NKG.VERSION', '1.0.0');
INSERT INTO "metadata" VALUES('NKG.DATE', '2020-12-21');

-- Append NKG to authority references
UPDATE
authority_to_authority_preference
SET
allowed_authorities = allowed_authorities || ',NKG'
WHERE
source_auth_name = 'EPSG' AND target_auth_name = 'EPSG';

INSERT INTO "authority_to_authority_preference"
(source_auth_name,target_auth_name, allowed_authorities)
VALUES
('NKG', 'EPSG', 'NKG,PROJ,EPSG');

-- extent for NKG2008 transformations
INSERT INTO "extent" VALUES(
'NKG','EXTENT_2008', -- extend auth+code
Expand Down Expand Up @@ -693,7 +680,75 @@ INSERT INTO "usage" VALUES (
'NKG', 'SCOPE_GENERIC' -- scope
);

-- NO
INSERT INTO "helmert_transformation" VALUES (
'NKG','PAR_2020_NO', -- operation auth+code
'NKG_ETRF14 to ETRF93@2000.0', -- name
'Transformation from NKG_ETRF14 to ETRF93, at transformation reference epoch 2000.0', -- description / remark
'EPSG','1033', -- method auth+code
'Position Vector transformation (geocentric domain)',
'NKG','ETRF14', -- source auth+code
'EPSG','7922', -- target auth+code
0.01, -- accuracy
-0.05172, -- x
0.13747, -- y
-0.01648, -- z
'EPSG','9001',
0.00268452, -- rx
0.00329165, -- ry
-0.00116569, -- rz
'EPSG','9104',
0.002583, -- s
'EPSG','9202',
NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
'NKG 2020', -- operation version
0
);

INSERT INTO "usage" VALUES (
'NKG', '5041', -- usage auth+code
'helmert_transformation', -- object_table_name
'NKG','PAR_2020_NO', -- object auth+code
'EPSG', '1352', -- extent: Norway - onshore
'NKG', 'SCOPE_GENERIC' -- scope
);

INSERT INTO "other_transformation" (
auth_name,
code,
name,
description,
method_auth_name,
method_code,
method_name,
source_crs_auth_name,
source_crs_code,
target_crs_auth_name,
target_crs_code,
accuracy,
operation_version,
deprecated
)
VALUES(
'NKG', 'NKG_ETRF14_ETRF93_2000', -- object auth+code
'NKG_ETRF14 to ETRF93@2000.0', -- name
'Transformation from NKG_ETRF14 to ETRF93, at transformation reference epoch 2000.0', -- description / remark
'PROJ', 'PROJString',
'+proj=xyzgridshift +grids=no_kv_NKGETRF14_EPSG7922_2000.tif',
'NKG','ETRF14', -- source auth+code
'EPSG','7922', -- target auth+code
0.005, -- accuracy
'NKG 2020', -- operation_version
0 -- deprecated
);

INSERT INTO "usage" VALUES (
'NKG', '5064',
'other_transformation',
'NKG', 'NKG_ETRF14_ETRF93_2000',
'EPSG', '1352',
'NKG', 'SCOPE_GENERIC'
);

-- SE
INSERT INTO "helmert_transformation" VALUES (
Expand Down Expand Up @@ -2056,6 +2111,116 @@ INSERT INTO "supersession" VALUES (
);


-------------------------------------------------------
-- Transformation: NKG_ETRF14 -> ETRF93@1995.0 (NO)
-------------------------------------------------------

INSERT INTO "other_transformation" (
auth_name,
code,
name,
description,
method_auth_name,
method_code,
method_name,
source_crs_auth_name,
source_crs_code,
target_crs_auth_name,
target_crs_code,
accuracy,
operation_version,
deprecated
)
VALUES(
'NKG', 'NO_2020_INTRAPLATE', -- object auth+code
'ETRF93@2000.0 to ETRF93@1995.0', -- name
NULL, -- description
'PROJ', 'PROJString', -- method auth+cod
'+proj=deformation +dt=-5 +grids=eur_nkg_nkgrf17vel.tif',
'EPSG','7922', -- source_crs: ETRF93@2000.0
'EPSG','4936', -- target_crs: ETRS89 (NO)
0.005, -- accuracy
'NKG 2020', -- operation_version
0 -- deprecated
);

INSERT INTO "usage" VALUES (
'NKG', '5058', -- usage auth+code
'other_transformation', -- object_table_name
'NKG', 'NO_2020_INTRAPLATE', -- object auth+code
'EPSG', '1352', -- extent: Norway - onshore and offshore
'NKG', 'SCOPE_GENERIC' -- scope
);

INSERT INTO "concatenated_operation" VALUES(
'NKG', 'ETRF14_TO_NO', -- operation auth+code
'NKG_ETRF14 to ETRS89(NO)', -- name
'Transformation from NKG_ETRF14@2000.0 to ETRF93@1995.0', -- description
'NKG', 'ETRF14',-- source_crs: NKG_ETRF00
'EPSG','4936', -- target_crs: ETRS89 (NO)
0.01, -- accuracy
'NKG 2020', -- operation_version
0 -- deprecated
);

INSERT INTO "concatenated_operation_step" (
operation_auth_name, operation_code, step_number, step_auth_name, step_code
) VALUES
('NKG', 'ETRF14_TO_NO', 1, 'NKG', 'PAR_2020_NO'),
('NKG', 'ETRF14_TO_NO', 2, 'NKG', 'NO_2020_INTRAPLATE')
;

INSERT INTO "usage" VALUES (
'NKG', '5059', -- usage auth+code
'concatenated_operation', -- object_table_name
'NKG', 'ETRF14_TO_NO', -- object auth+code
'EPSG', '1352', -- extent: Norway - onshore and offshore
'NKG', 'SCOPE_GENERIC' -- scope auth+code
);


-------------------------------------------------------
-- Transformation: ITRF2014 -> ETRF93@1995.0 (NO)
-------------------------------------------------------

INSERT INTO "concatenated_operation" VALUES (
'NKG', 'ITRF2014_TO_NO', -- operation auth+code
'ITRF2014 to ETRS89(NO)', -- name
'Time-dependent transformation from ITRF2014 to ETRS89(NO)', -- description
'EPSG', '7789', -- source_crs: ITRF2014
'EPSG', '4936', -- target_crs: ETRS89(NO)
0.01, -- accuracy
'NKG 2020', -- operation_version
0 -- deprecated
);

INSERT INTO "concatenated_operation_step" (
operation_auth_name, operation_code, step_number, step_auth_name, step_code
) VALUES
('NKG', 'ITRF2014_TO_NO', 1, 'EPSG', '8366'), -- ITRF2014 -> ETRF2014
('NKG', 'ITRF2014_TO_NO', 2, 'NKG', 'NKG_ETRF14_TO_ETRF2014'),
('NKG', 'ITRF2014_TO_NO', 3, 'NKG', 'NKG_ETRF14_ETRF93_2000'),
('NKG', 'ITRF2014_TO_NO', 4, 'NKG', 'NO_2020_INTRAPLATE')
;

INSERT INTO "usage" VALUES (
'NKG', '5060', -- usage auth+code
'concatenated_operation', -- object_table_name
'NKG', 'ITRF2014_TO_NO', -- object auth+code
'EPSG', '1352', -- extent: Norway - onshore and offshore
'NKG', 'SCOPE_GENERIC' -- scope auth+code
);

INSERT INTO "supersession" VALUES (
'concatenated_operation',
'NKG', 'ITRF2000_TO_NO',
'concatenated_operation',
'NKG', 'ITRF2014_TO_NO',
'NKG',
0
);


-------------------------------------------------------
-- Transformation: NKG_ETRF14 -> ETRF97@1999.5 (SE)
-------------------------------------------------------
Expand Down
13 changes: 13 additions & 0 deletions data/sql/nkg_post_customizations.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@

-- Append NKG to authority references
UPDATE
authority_to_authority_preference
SET
allowed_authorities = allowed_authorities || ',NKG'
WHERE
source_auth_name = 'EPSG' AND target_auth_name = 'EPSG';

INSERT INTO "authority_to_authority_preference"
(source_auth_name,target_auth_name, allowed_authorities)
VALUES
('NKG', 'EPSG', 'NKG,PROJ,EPSG');
16 changes: 16 additions & 0 deletions data/sql/other_transformation_custom.sql
Original file line number Diff line number Diff line change
@@ -1,5 +1,21 @@
-- This file is hand generated.

-- Norway triangulated files

INSERT INTO other_transformation VALUES(
'PROJ','NGO48_TO_ETRS89NO','NGO 1948 to ETRS89 (2)',
'Transformation based on a triangulated irregular network',
'PROJ','PROJString',
'+proj=pipeline ' ||
'+step +proj=axisswap +order=2,1 ' ||
'+step +proj=tinshift +file=no_kv_ETRS89NO_NGO48_TIN.json +inv ' ||
'+step +proj=axisswap +order=2,1',
'EPSG','4273',
'EPSG','4258',
0.1,
NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0);
INSERT INTO "usage" VALUES('PROJ','NGO48_TO_ETRS89NO_USAGE','other_transformation','PROJ','NGO48_TO_ETRS89NO','EPSG','1352','EPSG','1031');

-- Finland triangulated files

INSERT INTO other_transformation VALUES(
Expand Down
4 changes: 2 additions & 2 deletions data/sql/proj_db_table_defs.sql
Original file line number Diff line number Diff line change
Expand Up @@ -1089,7 +1089,7 @@ CREATE TABLE grid_alternatives(
proj_grid_name TEXT NOT NULL, -- PROJ >= 7 grid name (e.g us_nga_egm08_25.tif)
old_proj_grid_name TEXT, -- PROJ < 7 grid name (e.g egm08_25.gtx)
proj_grid_format TEXT NOT NULL, -- 'GTiff', 'GTX', 'NTv2', JSON
proj_method TEXT NOT NULL, -- hgridshift, vgridshift, geoid_like, geocentricoffset or tinshift
proj_method TEXT NOT NULL, -- hgridshift, vgridshift, geoid_like, geocentricoffset, tinshift or velocity_grid
inverse_direction BOOLEAN NOT NULL CHECK (inverse_direction IN (0, 1)), -- whether the PROJ grid direction is reversed w.r.t to the authority one (TRUE in that case)
package_name TEXT, -- no longer used. Must be NULL
url TEXT, -- optional URL where to download the PROJ grid
Expand All @@ -1099,7 +1099,7 @@ CREATE TABLE grid_alternatives(

CONSTRAINT fk_grid_alternatives_grid_packages FOREIGN KEY (package_name) REFERENCES grid_packages(package_name),
CONSTRAINT check_grid_alternatives_grid_fromat CHECK (proj_grid_format IN ('GTiff', 'GTX', 'NTv2', 'JSON')),
CONSTRAINT check_grid_alternatives_proj_method CHECK (proj_method IN ('hgridshift', 'vgridshift', 'geoid_like', 'geocentricoffset', 'tinshift')),
CONSTRAINT check_grid_alternatives_proj_method CHECK (proj_method IN ('hgridshift', 'vgridshift', 'geoid_like', 'geocentricoffset', 'tinshift', 'velocity_grid')),
CONSTRAINT check_grid_alternatives_inverse_direction CHECK (NOT(proj_method = 'geoid_like' AND inverse_direction = 1)),
CONSTRAINT check_grid_alternatives_package_name CHECK (package_name IS NULL),
CONSTRAINT check_grid_alternatives_direct_download_url CHECK (NOT(direct_download IS NULL AND url IS NOT NULL)),
Expand Down
3 changes: 2 additions & 1 deletion data/sql_filelist.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,10 @@ set(SQL_FILES
"${SQL_DIR}/deprecation.sql"
"${SQL_DIR}/esri.sql"
"${SQL_DIR}/ignf.sql"
"${SQL_DIR}/nkg.sql"
"${SQL_DIR}/grid_alternatives.sql"
"${SQL_DIR}/grid_alternatives_generated_noaa.sql"
"${SQL_DIR}/customizations.sql"
"${SQL_DIR}/nkg.sql"
"${SQL_DIR}/nkg_post_customizations.sql"
"${SQL_DIR}/commit.sql"
)
4 changes: 4 additions & 0 deletions test/cli/testprojinfo
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,10 @@ echo 'Testing -s "ETRS89 / TM35FIN(E,N) + N2000 height" -t "KKJ / Finland Unifor
$EXE -s "ETRS89 / TM35FIN(E,N) + N2000 height" -t "KKJ / Finland Uniform Coordinate System + N43 height" --grid-check none -o PROJ -q >>${OUT} 2>&1
echo "" >>${OUT}

# Quick check of NKG transformations
echo 'Testing NKG: -s EPSG:7789 -t EPSG:4936 --area EPSG:1080 --summary --hide-ballpark' >> ${OUT}
$EXE -s EPSG:7789 -t EPSG:4936 --area EPSG:1080 --summary --hide-ballpark >>${OUT} 2>&1
echo "" >>${OUT}

# do 'diff' with distribution results
echo "diff ${OUT} with testprojinfo_out.dist"
Expand Down
5 changes: 5 additions & 0 deletions test/cli/testprojinfo_out.dist
Original file line number Diff line number Diff line change
Expand Up @@ -1525,3 +1525,8 @@ Testing -s "ETRS89 / TM35FIN(E,N) + N2000 height" -t "KKJ / Finland Uniform Coor
+step +inv +proj=tinshift +file=fi_nls_n43_n60.json
+step +proj=axisswap +order=2,1

Testing NKG: -s EPSG:7789 -t EPSG:4936 --area EPSG:1080 --summary --hide-ballpark
Candidate operations found: 1
Note: using '--spatial-test intersects' would bring more results (2)
NKG:ITRF2014_TO_DK, ITRF2014 to ETRS89(DK), 0.01 m, Denmark - onshore and offshore.

17 changes: 17 additions & 0 deletions test/gie/nkg.gie
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,23 @@ tolerance 1 mm
accept 3541657.3778 948984.2343 5201383.5231 2020.5
expect 3541657.3671 948984.2412 5201383.5058 2020.5

# 2020 Transformations

operation operation urn:ogc:def:coordinateOperation:NKG::ITRF2014_TO_NO
tolerance 0.1 mm

# STAS
accept 3275753.4135 321111.2481 5445042.2134 2020.0
expect 3275753.9111 321110.8658 5445041.8822 2020.0

# BOD3
accept 2391773.9918 615615.1837 5860966.1279 2020.0
expect 2391774.5535 615614.9100 5860965.8138 2020.0

# KAUS
accept 2107888.9134 895603.4769 5933242.6269 2020.0
expect 2107889.5097 895603.2085 5933242.3152 2020.0


# -------------------------------------------------------------------------------
# SWEDEN
Expand Down

0 comments on commit eeb9fef

Please sign in to comment.