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
GRASS/Processing outputs CRS mismatch #18596
Comments
Author Name: Giovanni Manghi (@gioman) Confirmed here on master/ubuntu. This is certainly a regression. PS
|
Author Name: Giovanni Manghi (@gioman) Can you please check again, it does not seems to happen anymore.
|
Author Name: Paolo Cavallini (@pcav) Confirmed, it is OK here
|
Author Name: Giovanni Manghi (@gioman)
|
Author Name: leolami - (leolami -) Hi all, For example v.select Regards
|
Author Name: Giovanni Manghi (@gioman)
|
Author Name: Giovanni Manghi (@gioman)
|
Author Name: Giovanni Manghi (@gioman)
|
Author Name: Giovanni Manghi (@gioman)
|
Author Name: Giovanni Manghi (@gioman)
|
Author Name: Giovanni Manghi (@gioman)
|
Author Name: Giovanni Manghi (@gioman)
|
Author Name: Jürgen Fischer (@jef-n)
|
Author Name: Paolo Cavallini (@pcav)
|
Author Name: Giovanni Manghi (@gioman)
|
Author Name: Giovanni Manghi (@gioman)
|
Author Name: Alexandre Neto (@SrNetoChan)
|
Should not be an issue with proj 6 based builds. If it is, it's an issue in the 3rd party application instead of qgis. |
@nyalldawson can you elaborate? the example here above seems to suggest that if there is "+type=crs" the CRS do not match the equivalent CRS as recognized by QGIS and so it shows "unkown".
it seems so, but honestly I'm not totally sure. Just thinking out load here below: I tried to import (in native GRASS) my sample data in the temp mapset/location created by QGIS when running GRASS tools from processing, and it fails
this is why in QGIS we use the "-o" parameter in r.in.gdal (is to override the projection check, and use the mapset/location one instead). Anyway this has the effect that after exporting this raster (or one calculated from it) out from GRASS it has a CRS that does not exactly any as known by QGIS. I don't see anything wrong done by QGIS, as it creates the temp location/mapset with the exact CRS of the input
vs
but this has the effect of creating this CRS mismatch in outputs. On the other hand when creating the mapset/location with the input CRS the projection reports as (by g.proj)
but then outputting the raster generates one with a CRS that QGIS correctly matches the one of the input layer. So I'm definitely puzzled. @neteler any idea? (note that the title of this ticket seems now outdated, a new description of the issue is here #18596 (comment)) |
@gioman Testing it with GRASS GIS 7.8 (Fedora 33, for library versions see below) it looks as expected to me:
|
@neteler I have no doubts is correct. As you can see in my comments above replicating the whole import/process/export in native GRASS results in a layer that has no CRS issues when opened in QGIS. The same process in GRASS/Processing (using the same modules used in native GRASS, with basically the same parameters) creates an output that has a CRS that is correct but has a proj string that is slightly different from the original, causing QGIS recognize it as "unknown" that is not a big deal but also not ideal. The question/problem is to try understand why/where this happens. |
Well, since PROJ is undergoing dramatic changes, I believe that valid comparisons can only be done with identical PROJ versions. In your post I don't see which PROJ 6.y.z version you use (that may matter). |
|
Now we need to know the differences between proj=6.3.1 (yours) and proj=6.3.2 (mine)...
I do not spot anything relevant there (not an expert, though). BUT: you also use an oldish GRASS GIS Version (7.8.2 from 2019), missing some PROJ 6+ related fixes:
Maybe that's the reason? |
I updated my GRASS:
The result is the same. From within GRASS/Processing the outputs CRS reads as
out of native GRASS the same output has a CRS that reads as
that extra " +type=crs" causes the mismatch. |
I don't really know what's right, maybe @rouault could enlighten us? |
I'm afraid I'm a bit lost in this thread. What is the question exactly ? " +type=crs" is added by PROJ >= 6 when exporting objects that are CRS. This is to distinguish from transformation pipelines. |
Another test, again with proj=6.3.2, GRASS GIS 7.8.6dev, build_date=2020-12-27:
The expected |
@rouault I'll make here a resume (as noted above the issue changed slightly since this was filed). In QGIS GRASS/Processing when we run some tool the output gets a CRS that is correct but that does not match 100% the one of the input layers, so QGIS shows "unknown" instead of showing exactly the CRS of the input (as far as I have understand this happens only when the input CRS has some towgs84 parameters). Note: the original issue was about that GRASS/Processing was stripping altogether the towgs84 parameters from the output CRS, and this do not seems to the case anymore. So for example if the input has the EPSG 3763 CRS
the output from an operation in GRASS/Processing is
with the extra "+type=crs" causing the mismatch. This is not a big deal because from a user point of view do not change much, but is a bit of inconvenience as this new layers to do not show in QGIS with a precise (as shown by QGIS) CRS.This causes some confusion. The question/doubt is about how/where this "+type=crs" gets added, as replicating in native GRASS the same exact operations that GRASS/Processing does, do not cause this problem. GRASS/Processing imports automatically/on the fly the input(s) in a temp GRASS location/mapset, then process them and them exports them. An example of what happens under the hood in GRASS/Processing:
This creates an output with a CRS that reads
that does do not match completely the one of the input data. In native GRASS we can do the same steps (after having created and opened manually a location/mapset with a CRS that matches the one of the input data):
this creates an output that has a CRS
that fully matches the one of the input data. |
@neteler it the other way... the original data CRS has not |
I don't believe the presence/absence of +type=crs is the issue. |
@rouault thanks for the feedback. result of gdalinfo on output from the GRASS
result of gdalinfo on output from the Processing/GRASS:
|
slope_qgis_grass.tif has lost the information on the ETRS89 datum. I suspect GRASS must store the PROJ.4 string (which doesn't contain the ETRS89 datum information) and use it to set the CRS information on the final TIFF. |
@rouault thanks for the pointer @nyalldawson so the problem seems to be here https://github.com/qgis/QGIS/blob/master/python/plugins/processing/algs/grass7/Grass7Algorithm.py#L1036 where we set the projection for the temp GRASS location/mapset using a PROJ string. We should use a WKT representation instead (and GRASS's g.proj allows it https://grass.osgeo.org/grass78/manuals/g.proj.html). We can get the WKT representation needed with I tried it by hard-coding the path to a file containing the WKT representation of the CRS of several test data in different CRSs and it worked as expected. |
of proj strings wherever possible Because proj strings are lossy Fixes qgis#18596
of proj strings wherever possible Because proj strings are lossy Fixes #18596
of proj strings wherever possible Because proj strings are lossy Fixes qgis#18596 (cherry picked from commit b295bd5)
Author Name: Paolo Cavallini (@pcav)
Original Redmine Issue: 10137
Affected QGIS version: 3.4.1
Redmine category:processing/grass
Apparently Processing, during the analyses starting from layers in a CRS with +towgs parameters (e.g. 23030) creates outputs with a similar projection, but without the parameters; a custom CRS is thus created, and the output does not align with the input.
This happens at least with GRASS and R backends.
Related issue(s): #20098 (relates), #25391 (duplicates)
Redmine related issue(s): 11884, 17494
The text was updated successfully, but these errors were encountered: