Bug report #3529
Default CRS does not work as expected
|Affected QGIS version:||Regression?:||No|
|Operating System:||Windows||Easy fix?:||No|
|Pull Request or Patch supplied:||Resolution:||duplicate|
|Crashes QGIS or corrupts data:||Copied to github as #:||13589|
In the general "Options" dialog box, CRS tab there are three options for the default CRS: (1) Prompt for CRS, (2) Project wide default CRS..., (3) Global default CRS...
When loading a layer (either vector or raster) none of those options recognise the layer internal CRS, even if that layer CRS is defined and is reported as defined by GDAL.
This means that, when a layer is loaded:
- With option (1) the CRS dialog box is ALWAYS presented and the default choice is most of the time wrong. Is it extremely frustrating to define the CRS for 100's of layers being imported, knowing that those layer HAVE an internal CRS (them being GeoTIFs of shapefiles).
- With option (2) the project CRS is given to the loaded layer, irrespective of that layer internal CRS. When OTF is on, this has disastrous results as you do not expect the CRS of a loaded layer to be changed and find your layer wait out of where it should be!
- With option (3) the global CRS is given to the loaded layer, irrespective of that layer internal CRS. When OTF is on, this has the same disastrous results as in option (2)!
1 - Open a new QGIS project and set project CRS to WGS84 UTM30N (EPGS:32630)
2 - Create a shapefile in that CRS, draw some points and save it
3 - Check with GDAL that its projection is indeed WGS84 UTM30N
4 - Save project as "Project1"
5 - Create a new QGIS project, set the project default CRS set to Google Mercator (EPSG:900913) and enable on-the-fly projection
6 - Select option (2) in above dialog box
7 - Import the shapefile created in step 2.
8 - Load a google satellite image, with the Google plugin, and realise that the shapefile is at the wrong location!
9 - Use GDAL-Wrap (Raster menu) to convert the google image to GeoTIFF with an internal CRS of WGS84 UTM30N.
10 - Check with GDAL that the internal CRS of the GeoTIFF file is correctly defined.
11 - Load Project1
12 - Select option (1) in the dialog above
13 - Load the GeoTIFF file created in step 9.
14 - QGIS asks for its CRS! In that case the default CRS presented by the CRS dialog box is correct because both the GeoTIFF and the project have the same CRS.
Repeat steps 5-14, but in step 6, select option (3).
You will have similarly wrong results.
#2 Updated by Benoit de Cabissole about 10 years ago
Sorry for delays. I was doing some more tests.
Ok, some more info.
Please get the file at r1 (too big to attach on this message) and unzip it into a local folder.
- google-satellite-z15-1-28022011-091106.tif a GeoTIFF raster file, georeferenced in WGS84 UTM30N (EPSG:32630)
- GDAL_info.txt: the information on the above file given by GDAL.
1) open a new QGIS project
2) set the project CRS to WGS84 - UTM30N (EPSG:32630)
3) in the Settings/Options dialog, CRS tab, select option "Prompt for CRS".
4) load the provided GeoTIFF file into the project
5) you are asked to define its CRS. This is wrong and should not happen!
QGIS up to verion 1.6 knew how to read the internal CRS of a raster/vector file. Not anymore!
Also note that the option "Prompt for CRS" should only be activated if the layer to be loaded does not have a CRS (as the text in the dialog box says). In 1.7, it is ALWAYS activated whatever the presence or not of a CRS in the loaded layer, at least for GeTIFF files.
For the shapefile problem described previously it seems to be an entirely different issue: QGIS does not recognise the *.prj file anymore and needs its own *.qpj file instead in order to recognise that a shapefile has a CRS. Wrong again, but this is another issue.