Skip to content

LGIA geoid grid #134

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

Merged
merged 10 commits into from
Mar 2, 2025
Merged

LGIA geoid grid #134

merged 10 commits into from
Mar 2, 2025

Conversation

yurish
Copy link
Contributor

@yurish yurish commented Feb 28, 2025

Adding Latvian Geospatial Information Agency grid for conversion of LKS-92 (EPSG:4669) to Latvia 2000 height (EPSG:7700)

@jjimenezshaw
Copy link
Contributor

Opening the tif file in QGIS I see two problems:

  • 9999 is not set as no-data value. (just opening with QGIS)
  • It is rotated and at a wrong location. Apparently you swapped latitude with longitude

How did you convert the data? It is a good idea to have a script to easily reproduce it. This is one example: https://github.com/OSGeo/PROJ-data/blob/master/fi_nls/build_FIN2000_05_23.sh

Also some test with some checkpoints (using OSGeo/PROJ#4412)

@jjimenezshaw
Copy link
Contributor

jjimenezshaw commented Feb 28, 2025

Running the script to update index.html you are using a version that is not master. You are deleting some info related to EPSG:10689 (Finland)
It is better if you use the last docker image. It needs git, so some hacks are needed. I think this may work:

docker pull ghcr.io/osgeo/gdal:ubuntu-full-latest
docker run --workdir $PWD --rm -v /home:/home ghcr.io/osgeo/gdal:ubuntu-full-latest sh -c "apt update && apt install -y git && git config --global --add safe.directory $PWD && python3 regenerate_index_html.py"

and later change the owner of files.geojson with

sudo chown $(id -u):$(id -g) files.geojson

(better solutions are welcome)

@yurish
Copy link
Contributor Author

yurish commented Feb 28, 2025

Thank you for your comments, @jjimenezshaw ! I have fixed the grid and added the script, that generates it. Can you guide me, what is the best solution for adding tests for the grid?

gdal_translate -of GTiff -a_nodata 9999 "$TEMP_FILE" "$OUTPUT_TIF"

# Run the vertoffset grid conversion
../grid_tools/vertoffset_grid_to_gtiff.py \
Copy link
Contributor

Choose a reason for hiding this comment

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

add python3 before, as you do in the next command

--parameter-name "geoid_undulation" \
--source-crs "EPSG:4949" \
--target-crs "EPSG:7700" \
"$OUTPUT_TIF" "$OUTPUT_TIF"
Copy link
Contributor

Choose a reason for hiding this comment

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

Using the same name for input and output is not a good idea. Just use another temp file.

files.geojson Outdated
@@ -133,9 +133,9 @@
{ "type": "Feature", "properties": { "url": "https://cdn.proj.org/eur_nkg_nkgrf03vel_realigned.tif", "name": "eur_nkg_nkgrf03vel_realigned.tif", "area_of_use": "Nordic and Baltic countries", "type": "VELOCITY", "source_crs_name": "Unknown based on GRS80", "source": "The Nordic Geodetic Commission", "source_country": "Europe", "source_id": "eur_nkg", "source_url": "http://www.nordicgeodeticcommission.com/", "description": "Deformation model covering the Nordic and Baltic countries. Used in transformations between global reference frames and the local realisations of ETRS89 in the Nordic and Baltic countries", "file_size": 362495, "sha256sum": "a646bd863c427c7623eb2b365878351bab9a0a9b67aa6792b2dd31c3ef58e0b9" }, "geometry": { "type": "Polygon", "coordinates": [ [ [ 3.0, 53.0 ], [ 40.0, 53.0 ], [ 40.0, 73.0 ], [ 3.0, 73.0 ], [ 3.0, 53.0 ] ] ] } },
{ "type": "Feature", "properties": { "url": "https://cdn.proj.org/eur_nkg_nkgrf17vel.tif", "name": "eur_nkg_nkgrf17vel.tif", "area_of_use": "Nordic and Baltic countries", "type": "VELOCITY", "source_crs_code": "EPSG:8403", "source_crs_name": "ETRF2014", "source": "The Nordic Geodetic Commission", "source_country": "Europe", "source_id": "eur_nkg", "source_url": "http://www.nordicgeodeticcommission.com/", "description": "Deformation model covering the Nordic and Baltic countries. Used in transformations between global reference frames and the local realisations of ETRS89 in the Nordic and Baltic countries", "file_size": 715692, "sha256sum": "515f68aeb59f659a3f3c340626cd060f58de6f93b4546df67732b906949e0d66" }, "geometry": { "type": "Polygon", "coordinates": [ [ [ -0.0, 49.0 ], [ 50.0, 49.0 ], [ 50.0, 75.0 ], [ -0.0, 75.0 ], [ -0.0, 49.0 ] ] ] } },
{ "type": "Feature", "properties": { "url": "https://cdn.proj.org/fi_nls_README.txt", "name": "fi_nls_README.txt", "source": "National Land Survey of Finland (MML)", "source_country": "Finland", "source_id": "fi_nls", "source_url": "https://www.maanmittauslaitos.fi", "file_size": 3458, "sha256sum": "05708b917dd04f8704911c48c6aa0b3eb26643eaa9403bea7157c3563f0223e5" }, "geometry": null },
{ "type": "Feature", "properties": { "url": "https://cdn.proj.org/fi_nls_fin2000.tif", "name": "fi_nls_fin2000.tif", "area_of_use": "Finland", "type": "VERTICAL_OFFSET_GEOGRAPHIC_TO_VERTICAL", "source_crs_code": "EPSG:10689", "source_crs_name": "EUREF-FIN", "target_crs_code": "EPSG:5717", "target_crs_name": "N60 height", "source": "National Land Survey of Finland (MML)", "source_country": "Finland", "source_id": "fi_nls", "source_url": "https://www.maanmittauslaitos.fi", "description": "EUREF-FIN (EPSG:10689) to N60 height (EPSG:5717)", "file_size": 311425, "sha256sum": "e9a54beb1ed06cc623212f89eb3b30f06db06743ae91d6a99e6751b8fcb948ed", "version_added": "1.21" }, "geometry": { "type": "Polygon", "coordinates": [ [ [ 17.5, 59.0 ], [ 33.0, 59.0 ], [ 33.0, 70.7 ], [ 17.5, 70.7 ], [ 17.5, 59.0 ] ] ] } },
Copy link
Contributor

Choose a reason for hiding this comment

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

Please, use the proper version of PROJ. The gdal docker image is a good option.

@jjimenezshaw
Copy link
Contributor

Can you guide me, what is the best solution for adding tests for the grid?

In the PROJ PR, add a couple of checkpoints and the command line to convert them to see they are correct. It can be in the PR description itself, nothing fancy

@rouault rouault added this to the 1.21 milestone Mar 2, 2025
@rouault
Copy link
Member

rouault commented Mar 2, 2025

I've done the adjustments suggested by @jjimenezshaw and pushed them in the branch. The grid seems to be consistent with EGM2008:

$ echo 24 57 0 | bin/cct +proj=vgridshift +grids=/home/even/proj/PROJ-data/lv_lgia/lv_lgia_lv14.tif
24.0000000000 57.0000000000 -20.7065 inf

$ echo 24 57 0 | bin/cct +proj=vgridshift +grids=/home/even/proj/PROJ-data/us_nga/us_nga_egm08_25.tif
24.0000000000 57.0000000000 -20.9804 inf

$ echo 23 57 0 | bin/cct +proj=vgridshift +grids=/home/even/proj/PROJ-data/lv_lgia/lv_lgia_lv14.tif
23.0000000000 57.0000000000 -21.6148 inf

$ echo 23 57 0 | bin/cct +proj=vgridshift +grids=/home/even/proj/PROJ-data/us_nga/us_nga_egm08_25.tif
23.0000000000 57.0000000000 -21.8943 inf

@rouault rouault merged commit d2d7016 into OSGeo:master Mar 2, 2025
2 checks passed
@yurish
Copy link
Contributor Author

yurish commented Mar 3, 2025

Thank you, @rouault ! Same coordinates from the official LGIA calculator (https://www.lgia.gov.lv/en/koordinatu-parrekinu-kalkulators):

57 24 0 -20.706
57 23 0 -21.614

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