Skip to content

Commit

Permalink
Added time dependent and independent routes to global crs and splitte…
Browse files Browse the repository at this point in the history
…d sql files (#15)
  • Loading branch information
lhuisman authored Jan 9, 2024
1 parent fb4fbd4 commit ff99cde
Show file tree
Hide file tree
Showing 8 changed files with 2,222 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ RUN apt update \
&& apt install -y \
sqlite3

ADD nl_nsgi.sql /usr/share/proj/nl_nsgi.sql
ADD sql /usr/share/proj/nl_nsgi_sql

# Adds the NSGI transformations to the proj.db
# TODO: The nl_ngsi.sql is also added in the /user/share/proj dir
# for completion, but we need to find a 'better' place for it.
RUN cat /usr/share/proj/nl_nsgi.sql | sqlite3 /usr/share/proj/proj.db
RUN for f in /usr/share/proj/nl_nsgi_sql/nl_nsgi_*.sql; do echo $f;cat $f | sqlite3 /usr/share/proj/proj.db;done
18 changes: 18 additions & 0 deletions sql/nl_nsgi_00_authorities.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
-------------------------------------------------------
-- Append NSGI to authority references
-------------------------------------------------------
UPDATE authority_to_authority_preference
SET
allowed_authorities = 'NSGI,' || allowed_authorities
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
('NSGI', 'EPSG', 'NSGI,PROJ,EPSG');
121 changes: 121 additions & 0 deletions sql/nl_nsgi_10_copy_transformations_from_projdb.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
-------------------------------------------------------
-- Duplicate WGS 84 realizations to ITRS realizations with NSGI authority
-------------------------------------------------------
create temp table nsgi_wgs_84_to_itrs as
select * from helmert_transformation_table where name like 'WGS 84 (G%) to ITRF% (1)';
UPDATE nsgi_wgs_84_to_itrs SET auth_name='NSGI';
INSERT INTO helmert_transformation_table SELECT * FROM nsgi_wgs_84_to_itrs;

create temp table nsgi_wgs_84_to_itrs_usage as
SELECT *
from usage
WHERE object_auth_name IN (
SELECT auth_name
FROM helmert_transformation_table
where name like 'WGS 84 (G%) to ITRF% (1)' and auth_name <> 'NSGI'
)
AND
object_code IN (
SELECT code
FROM helmert_transformation_table
where name like 'WGS 84 (G%) to ITRF% (1)' and auth_name <> 'NSGI'
);
UPDATE nsgi_wgs_84_to_itrs_usage SET auth_name='NSGI';
UPDATE nsgi_wgs_84_to_itrs_usage SET object_auth_name='NSGI';
UPDATE nsgi_wgs_84_to_itrs_usage SET code=object_code || '_USAGE';
INSERT INTO usage SELECT * FROM nsgi_wgs_84_to_itrs_usage;

-------------------------------------------------------
-- Duplicate ITRS realizations to ITRS realizations with NSGI authority
-------------------------------------------------------
create temp table nsgi_itrs_to_itrs as
select * from helmert_transformation_table where name like '%TRF% to %TRF% (1)' and deprecated = '0';
UPDATE nsgi_itrs_to_itrs SET auth_name='NSGI';
INSERT INTO helmert_transformation_table SELECT * FROM nsgi_itrs_to_itrs;

create temp table nsgi_itrs_to_itrs_usage as
SELECT *
from usage
WHERE object_auth_name IN (
SELECT auth_name
FROM helmert_transformation_table
where name like '%TRF% to %TRF% (1)' and auth_name <> 'NSGI' and deprecated = '0'
)
AND
object_code IN (
SELECT code
FROM helmert_transformation_table
where name like '%TRF% to %TRF% (1)' and auth_name <> 'NSGI' and deprecated = '0'
)
AND
object_table_name = 'helmert_transformation';
UPDATE nsgi_itrs_to_itrs_usage SET auth_name='NSGI';
UPDATE nsgi_itrs_to_itrs_usage SET object_auth_name='NSGI';
UPDATE nsgi_itrs_to_itrs_usage SET code=object_code || '_USAGE';
INSERT INTO usage SELECT * FROM nsgi_itrs_to_itrs_usage;

-------------------------------------------------------
-- Duplicate WGS 84 realizations to WGS 84 realizations with NSGI authority
-------------------------------------------------------
create temp table nsgi_wgs_84s_to_wgs_84 as
select * from helmert_transformation_table where name like 'WGS 84 (G%) to WGS 84 (G%) (1)' and deprecated = '0';
UPDATE nsgi_wgs_84s_to_wgs_84 SET auth_name='NSGI';
INSERT INTO helmert_transformation_table SELECT * FROM nsgi_wgs_84s_to_wgs_84;

create temp table nsgi_wgs_84s_to_wgs_84_usage as
SELECT *
from usage
WHERE object_auth_name IN (
SELECT auth_name
FROM helmert_transformation_table
where name like 'WGS 84 (G%) to WGS 84 (G%) (1)' and auth_name <> 'NSGI' and deprecated = '0'
)
AND
object_code IN (
SELECT code
FROM helmert_transformation_table
where name like 'WGS 84 (G%) to WGS 84 (G%) (1)' and auth_name <> 'NSGI' and deprecated = '0'
)
AND
object_table_name = 'helmert_transformation';
UPDATE nsgi_wgs_84s_to_wgs_84_usage SET auth_name='NSGI';
UPDATE nsgi_wgs_84s_to_wgs_84_usage SET object_auth_name='NSGI';
UPDATE nsgi_wgs_84s_to_wgs_84_usage SET code=object_code || '_USAGE';
INSERT INTO usage SELECT * FROM nsgi_wgs_84s_to_wgs_84_usage;




-------------------------------------------------------
-- Duplicate ETRS9 ensemble to ETRS89 realizations with NSGI authority
-------------------------------------------------------
create temp table nsgi_etrs89_to_etrf as
select * from helmert_transformation_table where name like 'ETRS89 to ETRF%' and name not like 'ETRS89 to ETRF2000';
UPDATE nsgi_etrs89_to_etrf SET auth_name='NSGI';
INSERT INTO helmert_transformation_table SELECT * FROM nsgi_etrs89_to_etrf;

create temp table nsgi_etrs89_to_etrf_usage as
SELECT *
from usage
WHERE object_auth_name IN (
SELECT auth_name
FROM helmert_transformation_table
where name like 'ETRS89 to ETRF%' and name not like 'ETRS89 to ETRF2000' and auth_name <> 'NSGI'
)
AND
object_code IN (
SELECT code
FROM helmert_transformation_table
where name like 'ETRS89 to ETRF%' and name not like 'ETRS89 to ETRF2000' and auth_name <> 'NSGI'
);
UPDATE nsgi_etrs89_to_etrf_usage SET auth_name='NSGI';
UPDATE nsgi_etrs89_to_etrf_usage SET object_auth_name='NSGI';
UPDATE nsgi_etrs89_to_etrf_usage SET code=object_code || '_USAGE';
INSERT INTO usage SELECT * FROM nsgi_etrs89_to_etrf_usage;

-------------------------------------------------------
-- Append NSGI to authority references
-------------------------------------------------------
UPDATE authority_to_authority_preference
SET
allowed_authorities = 'NSGI,PROJ';
Loading

0 comments on commit ff99cde

Please sign in to comment.