Bug report #11889

Setting "use project CRS" in "settings -> options -> CRS > CRS for new layers" is not applied when creating new shapes

Added by Johannes Kroeger about 10 years ago. Updated almost 8 years ago.

Status:Closed
Priority:Normal
Assignee:-
Category:GUI
Affected QGIS version:master Regression?:No
Operating System: Easy fix?:No
Pull Request or Patch supplied:Yes Resolution:
Crashes QGIS or corrupts data:No Copied to github as #:20103

Description

If you have a project open and create a new layer, QGIS will always use "EPSG:4326 - WGS 84" by default.

Please change it so that the current projection of the project is selected instead.
For example if the project is "EPSG: 3413", the New Vector Layer or New Spatialite Layer dialogs should select that by default.

Associated revisions

Revision 0500865b
Added by Nyall Dawson almost 8 years ago

Set default layer CRS according to behaviour radio (fix #11889)

Makes the new layer dialogs correctly respect the current project
CRS choice when set to follow project CRS.

History

#1 Updated by Giovanni Manghi about 10 years ago

  • Tracker changed from Feature request to Bug report
  • Subject changed from When creating a new layer QGIS should use the current project's projection to Setting "use project CRS" in "settings -> options -> CRS > CRS for new layers" is not applied when creating new shapes
  • Category set to GUI
  • Affected QGIS version set to master
  • Crashes QGIS or corrupts data set to No

it does not uses always "EPSG:4326 - WGS 84" by default, it is supposed to use what is configured in

settings -> options -> CRS > CRS for new layers

the problem is that it still doesn't work when that options is set to "use project CRS".

#2 Updated by Juraj Komačka almost 10 years ago

Hi,

I've tracked the bug down in current development master [eb6332f]. The problem is that src/gui/qgsnewvectorlayerdialog.cpp:88 reads /Projections/layerDefaultCrs from settings but that value is set in /src/app/qgsoptions.cpp:1198 always from LayerDefaultCombo - those labeled as "Use a default CRS". You can verify easily - select some CRS in that combo, select "Use project CRS" radio button and create new shapefile layer - it will use value from disabled "Use a default CRS" combo

I believe setting /Projections/layerDefaultCrs should be handled in the block of code before - from correct combo according to selected radio. I will be able to make a PR on GitHub, but I am not sure what value to set when prompt option is chosen - maybe fallback to default GEO_EPSG_CRS_AUTHID?

I am quite new in this codebase, can anyone offer a feedback on this to me?

#3 Updated by Giovanni Manghi almost 10 years ago

  • Status changed from Open to Feedback

I believe setting /Projections/layerDefaultCrs should be handled in the block of code before - from correct combo according to selected radio. I will be able to make a PR on GitHub, but I am not sure what value to set when prompt option is chosen - maybe fallback to default GEO_EPSG_CRS_AUTHID?

please raise the question on the developers mailing list and after getting feedback create the PR, thanks.

#4 Updated by Juraj Komačka almost 10 years ago

Question on developer list raised (http://lists.osgeo.org/pipermail/qgis-developer/2015-January/036560.html), it seems to go unnoticed. Nonetheless I've created the PR https://github.com/qgis/QGIS/pull/1896

#5 Updated by Giovanni Manghi over 9 years ago

  • Status changed from Feedback to Open
  • Pull Request or Patch supplied changed from No to Yes

#6 Updated by landry Landry Breuil about 9 years ago

  • Target version set to Version 2.12

We've also been experiencing this bug in 2.8 and 2.10 - can a developer look at the PR and check whether it's worth applying to 2.12 ?

#7 Updated by Giovanni Manghi about 9 years ago

  • Target version deleted (Version 2.12)

#8 Updated by Juraj Komačka about 8 years ago

Still present in 2.16. Not having time to update old PR - code moved on too far..

#9 Updated by Nyall Dawson almost 8 years ago

  • Status changed from Open to Closed

Also available in: Atom PDF