Opened 13 years ago

Closed 13 years ago

#3529 closed bug (duplicate)

Default CRS does not work as expected

Reported by: benoitrsa Owned by: nobody
Priority: major: does not work as expected Milestone: Version 1.7.0
Component: Projection Support Version: Trunk
Keywords: CRS, Projection, load, default Cc:
Must Fix for Release: Yes Platform: Windows
Platform Version: Win7, XP Awaiting user input: no

Description

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)!

Example:

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.

Change History (4)

comment:1 by pcav, 13 years ago

Priority: critical: causes crash or data corruptionmajor: does not work as expected

I think your report is complex, and mixes up several things. Please realize that for now raster reprojection is not supported. I use reprojection every day, and see nothing wrong. Please give us more infor in order to understand.

comment:2 by benoitrsa, 13 years ago

Sorry for delays. I was doing some more tests.

Ok, some more info.

Please get the file at [1] (too big to attach on this message) and unzip it into a local folder. Two files:

  • 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.

Now: 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.

[1] http://www.bc-consult.com/xchange/CRS_example.zip (890 KB)

comment:3 by pcav, 13 years ago

I think this is just a consequence of #3537. Please check and close this if appropriate.

comment:4 by benoitrsa, 13 years ago

Resolution: duplicate
Status: newclosed

This ticket has been superseded by #3547, and is now closed.

Note: See TracTickets for help on using tickets.