Bug report #4748

Raster reprojection in broken in qgis-master and has problems with rasters under qgis 1.7.3

Added by dr - over 12 years ago. Updated about 12 years ago.

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

Description

Open any shapefile (I'm not sure this bug for all shapefiles but I catch it with shapefile in attachment), then File - Project Properties - enable on the fly CRS transformation and set "Google Mercator EPSG:900913". No effect.
QGIS version: 1.9.90+git20120104+d04bc8f~natty1

admin.7z (64.3 KB) dr -, 2012-01-04 10:42 PM

dem_clipped.tif (498 KB) Giovanni Manghi, 2012-01-27 08:37 AM

giac.ogv (2.7 MB) Giovanni Manghi, 2012-01-28 06:04 AM


Related issues

Duplicated by QGIS Application - Bug report #4583: Raster reprojection error (plus QGIS freeze) Closed 2011-11-30

Associated revisions

Revision 95099990
Added by Richard Duivenvoorde over 12 years ago

better fix for #4550 change itemchanged event for simple clicked event
(also should fix #4748)

History

#1 Updated by Maxim Dubinin over 12 years ago

This is not reprojection issue, this is interface issue, but still a bug

1. Open QGIS, add a layer, go to project properties, CRS
2. Turn on OTF, choose Google Mercator from recent -> Note that Proj string DIDN'T change
----If you click Apply, OK now - the reprojection won't turn on.
3. Choose any other CRS -> Proj string changed -> choose Google Mercator again -> Proj string changed
Apply, OK
Now back to normal.

#2 Updated by Maxim Dubinin over 12 years ago

correction, this applies for any projection, not only Google Mercator

when you first open properties/crs, selection of any proj from recent doesn't change proj sttring and consequently doesn't reproject.

#3 Updated by Alexander Bruy over 12 years ago

  • Status changed from Open to Closed
  • % Done changed from 0 to 100

#4 Updated by Richard Duivenvoorde over 12 years ago

  • Status changed from Closed to Reopened

hi alexander,

this does not solve it completely. There is a sort of race problem with the statechangedevents of the recent crs list.

I did an earlier try to fix this, please have a look at

https://github.com/qgis/Quantum-GIS/pull/77

Richard

#5 Updated by Richard Duivenvoorde over 12 years ago

  • Status changed from Reopened to Closed

#6 Updated by Alexander Bruy over 12 years ago

  • Resolution set to fixed

Pull request applied

#7 Updated by Alexander Bruy over 12 years ago

  • Status changed from Closed to Reopened
  • Resolution deleted (fixed)

Problem still here. Proj4 definition updated correctly when selection changes but reprojection not work

#8 Updated by Giovanni Manghi over 12 years ago

  • Crashes QGIS or corrupts data changed from No to Yes
  • Subject changed from On the fly CRS transformation doesn't work to Reprojecion in broken in qgis-master and has problems with rasters under qgis 1.7.3

I was noticing the same for rasters, see #4804, I didn't realised that was a general problem. With rasters under Windows it even causes crashes (there is a sample dataset also in #4804).

The problem surfaces if you add first the layer, and then set the project CRS and enable OTFR. If you do the other way then it seems to work.

QGIS 1.7.3 also suffer of reprojection problems with rasters as described in other tickets -> Reprojecting a raster with a projected CRS into a geographic CRS results in the following warning

@forward transform of
(-15345.3, 85704.6)

failed with error: latitude or longitude exceeded limit@

each time the mouse passes over the canvas.

#9 Updated by Giovanni Manghi over 12 years ago

  • Subject changed from Reprojecion in broken in qgis-master and has problems with rasters under qgis 1.7.3 to Reprojection in broken in qgis-master and has problems with rasters under qgis 1.7.3

#10 Updated by Alexander Bruy over 12 years ago

  • Status changed from Reopened to Closed
  • Resolution set to fixed

Seems fixed in 9a9b53bb94.

#11 Updated by Giovanni Manghi over 12 years ago

The vector reprojection seems fixed, the raster one is not, I'm testing it but it seems we need to reopen this or #4583

#12 Updated by Paolo Cavallini over 12 years ago

confirmed:

trasformazione diretta of
(832.453740, 1353.648851)
PROJ.4: +proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs +to +proj=tmerc +lat_0=39.66825833333333 +lon_0=-8.133108333333334 +k=1 +x_0=0 +y_0=0 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs
Error: latitude or longitude exceeded limits

#13 Updated by Giovanni Manghi over 12 years ago

  • Status changed from Closed to Open
  • Resolution deleted (fixed)
  • Subject changed from Reprojection in broken in qgis-master and has problems with rasters under qgis 1.7.3 to Raster reprojection in broken in qgis-master and has problems with rasters under qgis 1.7.3

See also #4583

I confirm that now the message that pop ups in the canvas is slightly different but the problem is still there.

I also still confirm that with certain data (see #4583) there is a freeze.

#14 Updated by Jürgen Fischer about 12 years ago

Giovanni Manghi wrote:

See also #4583
I confirm that now the message that pop ups in the canvas is slightly different but the problem is still there.
I also still confirm that with certain data (see #4583) there is a freeze.

Can't reproduce the problem with master. Is master still affected?

#15 Updated by Giovanni Manghi about 12 years ago

Can't reproduce the problem with master. Is master still affected?

Hi Jurgen,

I just updated under both Linux and Windows and while under Windows seems ok, under Linux I still get the

forward transform of
(309.320618, 934.085281)
PROJ.4: +proj=longlat +datum=WGS84 +no_defs +to +proj=tmerc +lat_0=39.66825833333333 +lon_0=-8.133108333333334 +k=1 +x_0=0 +y_0=0 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs
Error: latitude or longitude exceeded limits

message. You can try the attached raster that is in the 3763 CRS. As already described the problem pop ups only when reprojecting to a geographic CRS, like wgs84.

#16 Updated by Jürgen Fischer about 12 years ago

Giovanni Manghi wrote:

I just updated under both Linux and Windows and while under Windows seems ok, under Linux I still get the

forward transform of
(309.320618, 934.085281)
PROJ.4: +proj=longlat +datum=WGS84 +no_defs +to +proj=tmerc +lat_0=39.66825833333333 +lon_0=-8.133108333333334 +k=1 +x_0=0 +y_0=0 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs
Error: latitude or longitude exceeded limits

message. You can try the attached raster that is in the 3763 CRS. As already described the problem pop ups only when reprojecting to a geographic CRS, like wgs84.

I'm probably missing something. How do you produce that? On current master on Linux I get:

  1. Clean project (defaults to wgs84, otfr off)
  2. Insert dem_clipped
  3. canvas zooms to dem_clipped in EPSG:3763
  4. switch otfr on
  5. 2 errors about empty reprojected (canvas) extent.
  6. Zoom to layer
  7. Content appears in EPSG:4326

#17 Updated by Giovanni Manghi about 12 years ago

I'm probably missing something. How do you produce that? On current master on Linux I get:

  1. Clean project (defaults to wgs84, otfr off)
  2. Insert dem_clipped
  3. canvas zooms to dem_clipped in EPSG:3763
  4. switch otfr on
  5. 2 errors about empty reprojected (canvas) extent.
  6. Zoom to layer
  7. Content appears in EPSG:4326

Hi Jurgen,
see the attached screencast, this is what I'm getting in master.

Thanks!

#18 Updated by Giovanni Manghi about 12 years ago

Hi Jurgen,
see the attached screencast, this is what I'm getting in master.

ps, in Windows it work as expected, no annoying warning pop

#19 Updated by Jürgen Fischer about 12 years ago

Giovanni Manghi wrote:

Hi Jurgen,
see the attached screencast, this is what I'm getting in master.

ps, in Windows it work as expected, no annoying warning pop

which version of proj.4 are you running?

#20 Updated by Giovanni Manghi about 12 years ago

Jürgen Fischer wrote:

Giovanni Manghi wrote:

Hi Jurgen,
see the attached screencast, this is what I'm getting in master.

ps, in Windows it work as expected, no annoying warning pop

which version of proj.4 are you running?

Version: 4.7.0-2~oneiric2

#21 Updated by Jürgen Fischer about 12 years ago

Giovanni Manghi wrote:

ps, in Windows it work as expected, no annoying warning pop

so you're not running valuetool on windows?

#22 Updated by Jürgen Fischer about 12 years ago

Jürgen Fischer wrote:

Giovanni Manghi wrote:

ps, in Windows it work as expected, no annoying warning pop

so you're not running valuetool on windows? ;)

#23 Updated by Giovanni Manghi about 12 years ago

  • Resolution set to fixed
  • Status changed from Open to Closed

Jürgen Fischer wrote:

Jürgen Fischer wrote:

Giovanni Manghi wrote:

ps, in Windows it work as expected, no annoying warning pop

so you're not running valuetool on windows? ;)

damn me... I didn't had the value tool active so I didn't think it was installed... sorry for the noise.

#24 Updated by Jürgen Fischer about 12 years ago

Giovanni Manghi wrote:

damn me... I didn't had the value tool active so I didn't think it was installed... sorry for the noise.

2564e6a79 adds support for the QgsCsException, so that python plugins can also catch that exception. Now the popup comes from python and show where the exception wasn't catched.

The following patch makes valuetool ignore that exception - no errors popping up anymore.

diff -u ~/.qgis/python/plugins/valuetool/valuewidget.py /tmp/valuewidget.py 
--- /home/fischer/.qgis/python/plugins/valuetool/valuewidget.py    2012-01-28 22:35:33.578309041 +0100
+++ /tmp/valuewidget.py    2012-01-28 22:34:38.694036879 +0100
@@ -151,7 +151,11 @@
             pos = mapPos
             if not mapCanvasSrs == layerSrs and self.iface.mapCanvas().hasCrsTransformEnabled():
               srsTransform = QgsCoordinateTransform(mapCanvasSrs, layerSrs)
-              pos = srsTransform.transform(mapPos)
+              try:
+                pos = srsTransform.transform(mapPos)
+              except QgsCsException, err:
+                # ignore transformation errors
+                continue
             isok,ident = layer.identify(pos)
             if not isok:
                 continue

#25 Updated by Jürgen Fischer about 12 years ago

Jürgen Fischer wrote:

2564e6a79 adds support for the QgsCsException, so that python plugins can also catch that exception. Now the popup comes from python and show where the exception wasn't catched.

c0cbe53a also sets the project's CRS to the layer's CRS, when it zooms to the first layer's extent...

#26 Updated by Giovanni Manghi about 12 years ago

c0cbe53a also sets the project's CRS to the layer's CRS, when it zooms to the first layer's extent...

I think the users will find this a huge usability improvement. Thanks Jurgen.

#27 Updated by Giovanni Manghi about 12 years ago

c0cbe53a also sets the project's CRS to the layer's CRS, when it zooms to the first layer's extent...

Hi Jurgen, just tested this feature:

it works as the project CRS really changes after the first "zoom to layer" (example project in wgs84 and layer in a projected CRS). At the same I see that the scalebar still shows degrees. If I enter the project properties and pick again the new CRS and then click "ok", then the scalebar goes ok.

#28 Updated by Giovanni Manghi about 12 years ago

it works as the project CRS really changes after the first "zoom to layer" (example project in wgs84 and layer in a projected CRS). At the same I see that the scalebar still shows degrees. If I enter the project properties and pick again the new CRS and then click "ok", then the scalebar goes ok.

Hi Jurgen, let me know if you want me to file a separate ticket about this issue.

Also available in: Atom PDF