Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NKG.sql: Add support for EUREF-FIN in Finish transformations #4399

Merged
merged 2 commits into from
Feb 14, 2025

Conversation

kbevers
Copy link
Member

@kbevers kbevers commented Feb 13, 2025

Recently the Finish national realization of ETRS89 was added to the EPSG registry as it's own separate entity. This commits adds support for the new EUREF-FIN CRS (EPSG:10689) in the NKG transformations. This is done by duplicating the existing transformation entries for Finland and modifying them to have EUREF-FIN as their end-point. This ensures backwards compatibility for users that implemented the original approach in their workflows.

The gist of it all is that in addition to the existing transformations

NKG:ITRF2000_TO_FI and NKG:ITRF2014_TO_FI

two new ones have been added:

NKG:ITRF2000_TO_FI_EUREF-FIN and NKG:ITRF2014_TO_FI_EUREF-FIN

Below a few examples are given, that verify that the old and newly added transformations are equivalent, apart from their final target CRS.

First a demonstration of use of the transformations directly

export PROJ_DATA=data/
export PROJ_NETWORK=ON

echo 27 62 100 | bin/cct +proj=cart
 2675020.1042   1362990.8210  5608603.5251           inf

echo 2675020.1042 1362990.8210 5608603.5251 2025.0 | bin/cct -d 8 NKG:ITRF2000_TO_FI
2675020.75185987  1362990.35866198  5608603.16545234     2025.0000

echo 2675020.1042 1362990.8210 5608603.5251 2025.0 | bin/cct -d 8 NKG:ITRF2000_TO_FI_EUREF-FIN
2675020.75185987  1362990.35866198  5608603.16545234     2025.0000

echo 2675020.1042 1362990.8210 5608603.5251 2025.0 | bin/cct -d 8 NKG:ITRF2014_TO_FI
2675020.76927503  1362990.36127342  5608603.12613439     2025.0000

echo 2675020.1042 1362990.8210 5608603.5251 2025.0 | bin/cct -d 8 NKG:ITRF2014_TO_FI
2675020.76927503  1362990.36127342  5608603.12613439     2025.0000

and then using source and target CRS's. The invovled EPSG-codes are:

EPSG:7912:  ITRF2014    geodetic coordinates
EPSG:4937:  ETRS89      geodetic coordinates
EPSG:10689: EUREF-FIN   geodetic coordinates
echo 62 27 100 2025.0 | bin/cs2cs -d 8 EPSG:7912 EPSG:10689
61.99999528     26.99998642 99.82795259 2025

echo 62 27 100 2025.0 | bin/cs2cs -d 8 EPSG:7912 EPSG:10689 --area finland
61.99999528     26.99998642 99.82795259 2025

echo 62 27 100 2025.0 | bin/cs2cs -d 8 EPSG:7912 EPSG:4937
61.99999528     26.99998642 99.82795259 2025

echo 62 27 100 2025.0 | bin/cs2cs -d 8 EPSG:7912 EPSG:4937 --area finland
61.99999528     26.99998642 99.82795259 2025

As shown, the results are equivalent, which keeps existing workflows happy.

Recently the Finish national realization of ETRS89 was added to the EPSG
registry as it's own separate entity. This commits adds support for the
new EUREF-FIN CRS (EPSG:10689) in the NKG transformations. This is done
by duplicating the existing transformation entries for Finland and
modifying them to have EUREF-FIN as their end-point. This ensures
backwards compatibility for users that implemented the original approach
in their workflows.

The gist of it all is that in addition to the existing transformations

    NKG:ITRF2000_TO_FI and NKG:ITRF2014_TO_FI

two new ones have been added:

    NKG:ITRF2000_TO_FI_EUREF-FIN and NKG:ITRF2014_TO_FI_EUREF-FIN

Below a few examples are given, that verify that the old and newly added
transformations are equivalent, apart from their final target CRS.

First a demonstration of use of the transformations directly

```sh
export PROJ_DATA=data/
export PROJ_NETWORK=ON

echo 27 62 100 | bin/cct +proj=cart
 2675020.1042   1362990.8210  5608603.5251           inf

echo 2675020.1042 1362990.8210 5608603.5251 2025.0 | bin/cct -d 8 NKG:ITRF2000_TO_FI
2675020.75185987  1362990.35866198  5608603.16545234     2025.0000

echo 2675020.1042 1362990.8210 5608603.5251 2025.0 | bin/cct -d 8 NKG:ITRF2000_TO_FI_EUREF-FIN
2675020.75185987  1362990.35866198  5608603.16545234     2025.0000

echo 2675020.1042 1362990.8210 5608603.5251 2025.0 | bin/cct -d 8 NKG:ITRF2014_TO_FI
2675020.76927503  1362990.36127342  5608603.12613439     2025.0000

echo 2675020.1042 1362990.8210 5608603.5251 2025.0 | bin/cct -d 8 NKG:ITRF2014_TO_FI
2675020.76927503  1362990.36127342  5608603.12613439     2025.0000
```

and then using source and target CRS's. The invovled EPSG-codes are:

```
EPSG:7912:  ITRF2014    geodetic coordinates
EPSG:4937:  ETRS89      geodetic coordinates
EPSG:10689: EUREF-FIN   geodetic coordinates
```

```sh
echo 62 27 100 2025.0 | bin/cs2cs -d 8 EPSG:7912 EPSG:10689
61.99999528     26.99998642 99.82795259 2025

echo 62 27 100 2025.0 | bin/cs2cs -d 8 EPSG:7912 EPSG:10689 --area finland
61.99999528     26.99998642 99.82795259 2025

echo 62 27 100 2025.0 | bin/cs2cs -d 8 EPSG:7912 EPSG:4937
61.99999528     26.99998642 99.82795259 2025

echo 62 27 100 2025.0 | bin/cs2cs -d 8 EPSG:7912 EPSG:4937 --area finland
61.99999528     26.99998642 99.82795259 2025
```

As shown, the results are equivalent, which keeps existing workflows
happy.
@kbevers kbevers requested review from rouault and removed request for rouault February 13, 2025 14:23
@kbevers
Copy link
Member Author

kbevers commented Feb 13, 2025

@phakli as promised. I believe everything works as intended but it would be good if you could verify it on your end

data/sql/nkg.sql Outdated


INSERT INTO "concatenated_operation_step" (
operation_auth_name, operation_code, step_number, step_auth_name, step_code
) VALUES
('NKG', 'ETRF00_TO_FI', 1, 'NKG', 'P1_2008_FI'),
('NKG', 'ETRF00_TO_FI', 2, 'NKG', 'ETRF96_2000_TO_ETRF96_1997')
('NKG', 'ETRF00_TO_FI', 2, 'NKG', 'ETRF96_2000_TO_ETRF96_1997'),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would you mind adding the new optional step_direction column with 'forward' / 'reverse' value ? (same remark for below occurences)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

more a matter of presentation / taste, but I would probably use a INSERT INTO "concatenated_operation_step" per concatenated operation. My first reading of the pull request change was that it became a 4-step operation, before realizing it was 2 concatenated operations in the same statement. Same remark for below occurences

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've added the direction hints to entries in the `concatenated_operation_step" table. There is a good mix of forward and reverse in there, so it should be a bit more efficient now with them directions added.

I can see how that is a bit misleading but seeing as the operation codes are different in lenghts I think is fairly clear that they are different:

    ('NKG', 'ETRF00_TO_FI', 1, 'NKG', 'P1_2008_FI', 'forward'),
    ('NKG', 'ETRF00_TO_FI', 2, 'NKG', 'ETRF96_2000_TO_ETRF96_1997', 'forward'),
    ('NKG', 'ETRF00_TO_EUREF-FIN', 1, 'NKG', 'P1_2008_FI', 'forward'),
    ('NKG', 'ETRF00_TO_EUREF-FIN', 2, 'NKG', 'ETRF96_2000_TO_ETRF96_1997_EUREF-FIN', 'forward')

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot @kbevers! It looks good to me and I can also confirm from my side that it produces expected results.

@kbevers kbevers added this to the 9.6.0 milestone Feb 14, 2025
@kbevers kbevers merged commit 2bd03d9 into OSGeo:master Feb 14, 2025
26 checks passed
@kbevers kbevers deleted the update-nkg-euref-fin branch February 14, 2025 10:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants