Skip to content

Conversation

@metzm
Copy link
Contributor

@metzm metzm commented Nov 4, 2025

Use newer OSRIsSame() from the OGR SRS API replacing the old G_compare_projections() in GRASS from PROJ4 times.

Fixes #5867

@marisn If this PR is ok with you, I would adjust v.external, r.in.gdal, r.external accordingly.

@metzm metzm requested a review from marisn November 4, 2025 14:49
@metzm metzm added bug Something isn't working vector Related to vector data processing C Related code is in C module labels Nov 4, 2025
@github-actions github-actions bot added the CMake label Nov 4, 2025
@metzm
Copy link
Contributor Author

metzm commented Nov 5, 2025

Interesting: a test for v.in.ogr fails now because the test attempts to import data with a CRS different from the GRASS project, the difference is in the datum.

Apparently the CRS of the NC sample projects has been changed some time ago by adding a PROJ_EPSG file to PERMANENT. Unfortunately, this PROJ_EPSG file is mssing in nc_spm_full_v2alpha2 which is used in the pipelines to perform tests.
The test data have been created in a NC sample project that did contain a PROJ_EPSG file, and the new test in v.in.ogr now correctly reports that input CRS (generated with EPSG) and project CRS (no EPSG) differ.

So either add this PROJ_EPSG file to nc_spm_full_v2alpha2, changing the CRS of this GRASS sample project, or regenerate the testdata with nc_spm_full_v2alpha2.

See also list of different versions of the NAD83 datum: https://geodesy.noaa.gov/datums/horizontal/index.shtml

@petrasovaa
Copy link
Contributor

So either add this PROJ_EPSG file to nc_spm_full_v2alpha2, changing the CRS of this GRASS sample project, or regenerate the testdata with nc_spm_full_v2alpha2.

Adding the file would be easiest, no? This dataset is used for testing only I believe.

@metzm
Copy link
Contributor Author

metzm commented Nov 5, 2025

So either add this PROJ_EPSG file to nc_spm_full_v2alpha2, changing the CRS of this GRASS sample project, or regenerate the testdata with nc_spm_full_v2alpha2.

Adding the file would be easiest, no? This dataset is used for testing only I believe.

Probably yes. How can I update this nc_spm_full_v2alpha2.tar.gz?

@petrasovaa
Copy link
Contributor

Probably yes. How can I update this nc_spm_full_v2alpha2.tar.gz?

It is downloaded from here: https://grass.osgeo.org/sampledata/north_carolina/nc_spm_full_v2alpha2.tar.gz

So @neteler would have access and probably someone else.

@echoix
Copy link
Member

echoix commented Nov 5, 2025

If the test dataset changes, make sure to clear the cache in GitHub actions, as I don’t think there was a check to go get the checksum of the dataset on the download server to make the cache key.

Changing a dataset like that, while it could be considered an immutable file, is hard to understand. How would we compare later on if something else had changed when recreating the archive? The old one wouldn’t be available

@metzm
Copy link
Contributor Author

metzm commented Nov 5, 2025

Probably yes. How can I update this nc_spm_full_v2alpha2.tar.gz?

It is downloaded from here: https://grass.osgeo.org/sampledata/north_carolina/nc_spm_full_v2alpha2.tar.gz

I know and have done so for testing, but someone would need to upload a new version. Even better, create a new one like nc_spm_full_v2beta1.tar.gz and use this one in the github pipelines.

The change by adding the PROJ_EPSG file is non-trivial because it changes the CRS of the sample dataset and thus not only CRS comparisons, but also coordinate transformation operations.

@metzm
Copy link
Contributor Author

metzm commented Nov 5, 2025

Is EPSG:3358 indeed the correct CRS for the NC sample dataset? Probably only @hmitaso can tell. The question is about the datum

North American Datum 1983

or

NAD83 (High Accuracy Reference Network)

For a new version of the sample dataset, the files PERMANET/PROJ_SRID and PERMANET/PROJ_WKT should also be added. PERMANET/PROJ_EPSG is deprecated because there are more CRS authorities than just EPSG: authority names known to PROJ are EPSG, ESRI, IAU_2015, IGNF, NKG, NRCAN, OGC, PROJ.

@hmitaso
Copy link
Contributor

hmitaso commented Nov 6, 2025 via email

@metzm metzm changed the title v.in.ogr: use OSRIsSame to compare CRSs r.external, r.in.gdal, v.external, v.in.ogr: use OSRIsSame to compare CRSs Nov 6, 2025
@github-actions github-actions bot added the raster Related to raster data processing label Nov 6, 2025
@metzm metzm force-pushed the issue_5867_compare_projections branch from 97faa1b to a97b904 Compare November 9, 2025 20:19
@metzm metzm changed the title r.external, r.in.gdal, v.external, v.in.ogr: use OSRIsSame to compare CRSs GDAL data import: use OSRIsSame to compare CRSs Nov 9, 2025
@metzm metzm changed the title GDAL data import: use OSRIsSame to compare CRSs (r|v).import: use OSRIsSame to compare CRSs Nov 9, 2025
@metzm metzm changed the title (r|v).import: use OSRIsSame to compare CRSs v.in.ogr: use OSRIsSame to compare CRSs Nov 9, 2025
@github-actions github-actions bot added the tests Related to Test Suite label Nov 10, 2025
@metzm metzm marked this pull request as ready for review November 10, 2025 17:49
@metzm
Copy link
Contributor Author

metzm commented Nov 10, 2025

@nilason @neteler any suggestions for a title for this PR? Right now it starts with v.in.ogr: which initially triggered this PR, but it includes modifications to r.external, r.in.gdal, r.import, v.external and v.in.ogr because the code base is nearly identical, including comments to keep the affected part of the C modules r.external, r.in.gdal, v.external and v.in.ogr in sync. I tried various alternatives (see above), but none was accepted by the title check.

@nilason
Copy link
Contributor

nilason commented Nov 10, 2025

The possibilities (currently) are defined here:

https://github.com/OSGeo/grass/blob/main/utils/release.yml

Maybe something like grass_proj: …. (In the end, it is mainly important for automatically generate News for releases.)

@metzm metzm changed the title v.in.ogr: use OSRIsSame to compare CRSs grass_proj: use OSRIsSame to compare CRSs Nov 10, 2025
@nilason
Copy link
Contributor

nilason commented Nov 13, 2025

Maybe not a question we necessarily need to decide here and now, but maybe it is time (version 8.5) to require GDAL 3+ (two years since #2995) and PROJ 8+. If this PR is to be backported, then that definitely needs to be decided after merge.

@metzm
Copy link
Contributor Author

metzm commented Nov 14, 2025

Maybe not a question we necessarily need to decide here and now, but maybe it is time (version 8.5) to require GDAL 3+ (two years since #2995) and PROJ 8+. If this PR is to be backported, then that definitely needs to be decided after merge.

If this PR is to be backported, PR #6593 needs to be backported first because this PR depends on it.

The last really substantial changes to PROJ regarding CRS handling have been introduced with GDAL 3.1 and PROJ 6.2 (according to the GDAL API documentation), after that mostly new functionality and bug fixes have been added. Bumping the GRASS requirements to at least GDAL 3.1 and PROJ 6.2 would be a big relief for all maintainers of the GRASS interface to GDAL and PROJ.

@metzm metzm requested a review from nilason November 14, 2025 18:32
@neteler
Copy link
Member

neteler commented Nov 15, 2025

Bumping the GRASS requirements to at least GDAL 3.1 and PROJ 6.2 would be a big relief for all maintainers of the GRASS interface to GDAL and PROJ.

Yesterday, at the GRASS-PSC meeting we even discussed if GDAL < 2 and PROJ < 8 support might be removed from main to simplify code maintenance. Of course a separate issue.

Copy link
Contributor

@nilason nilason left a comment

Choose a reason for hiding this comment

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

Looks good to me, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working C Related code is in C CMake module raster Related to raster data processing tests Related to Test Suite vector Related to vector data processing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feat] v.import should use best transformation option reproted by proj

6 participants