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

Wrong output CRS when input layer uses generated CRS #25152

Closed
qgib opened this issue Oct 6, 2017 · 3 comments
Closed

Wrong output CRS when input layer uses generated CRS #25152

qgib opened this issue Oct 6, 2017 · 3 comments
Labels
Bug Either a bug report, or a bug fix. Let's hope for the latter! Processing Relating to QGIS Processing framework or individual Processing algorithms

Comments

@qgib
Copy link
Contributor

qgib commented Oct 6, 2017

Author Name: Anita Graser (@anitagraser)
Original Redmine Issue: 17254
Affected QGIS version: master
Redmine category:processing/core
Assignee: Victor Olaya


Tested with qgis:fixeddistancebuffer, native:dissolve, and native:buffer using OSGeo4W 2.99

If the input layer uses a generated / custom CRS, the output layer is loaded in a wrong CRS. In my case, the layers were wrongly assigned WGS84. Note that, in settings, I've configured that QGIS should "prompt for CRS" if a layer without CRS info is loaded.

@qgib
Copy link
Contributor Author

qgib commented Dec 16, 2017

Author Name: Steven Mizuno (Steven Mizuno)


I was making a run at this problem to better understand QGIS and found that trying to create a scratch (memory) vector layer with a user CRS would get a CRS selection dialog, even though the CRS field was filled, where a standard EPSG:... did not.

Using Python console I tried this, which works (no CRS selection dialog):
v=QgsVectorLayer("Polygon?crs=epsg:4326", "Layer Name", "memory")
and:
v1=QgsVectorLayer("Polygon?crs=user:100028", "Layer Name", "memory")
which pops the CRS selection dialog; choosing USER:100028 works. I thought that the selection dialog shouldn't have been invoked.

So it seems that the USER:... CRS is NOT being interpreted properly -- where, I'm not sure yet, as I was calling QgsVectorLayer directly.

I had noticed before (another issue) that QgsCoordinateReferenceSystem::createFromString() expects 'INTERNAL' for any srsid incl. the notion of 'USER', else 'EPSG' or 'POSTGIS' or 'PROJ4' or 'WKT'.
It seemed to me that this function could be amended to include 'USER' and would handle the value same as for INTERNAL.
YES! -- added '|user' to the regex string -- this works -- is there any side effect?

Have tried Processing:Buffer with this fix, with data in USER:100028 and now creates the memory layer correctly.

Alternative is to detect and replace 'USER' with 'INTERNAL' everywhere createFromString is called in a layer provider or any other use of USER CRSes.

QgsCoordinateReferenceSystem::createFromOgcWmsCrs() does deal with 'USER', but has still other notions, like: 'custom', and 'qgis' -- this is confusing.

Note that in the original problem described the layer data actually is in the expected CRS; it is just that the layer was assigned the wrong CRS when loaded.

@qgib
Copy link
Contributor Author

qgib commented Dec 18, 2017

Author Name: Nyall Dawson (@nyalldawson)


Applied in changeset 8cb4893.


  • done_ratio was changed from 0 to 100
  • status_id was changed from Open to Closed

@qgib qgib closed this as completed Dec 18, 2017
@qgib
Copy link
Contributor Author

qgib commented Feb 22, 2018

Author Name: Giovanni Manghi (@gioman)


  • resolution was changed from to fixed/implemented

@qgib qgib added Bug Either a bug report, or a bug fix. Let's hope for the latter! Processing Relating to QGIS Processing framework or individual Processing algorithms labels May 25, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Either a bug report, or a bug fix. Let's hope for the latter! Processing Relating to QGIS Processing framework or individual Processing algorithms
Projects
None yet
Development

No branches or pull requests

1 participant