Feature request #3742

Save extent after reprojection

Added by Maxim Dubinin over 13 years ago. Updated almost 13 years ago.

Status:Closed
Priority:Low
Assignee:Jürgen Fischer
Category:Projection Support
Pull Request or Patch supplied:No Resolution:
Easy fix?:No Copied to github as #:13801

Description

Right now if you load a layer and change the project's projection to something else the layer dissapears as the view extent stays the same after reprojection.

It would be more user friendly if extent of the current view would also get reprojected and there will be zoomed to after reprojection is finished.

This way the user will not "loose" a layer.


Related issues

Duplicated by QGIS Application - Bug report #5326: Checking "on the fly CRS transformation" changes silently... Closed 2012-04-05

Associated revisions

Revision eac3a8ff
Added by Jürgen Fischer almost 13 years ago

fix #3742:
- after CRS changes reproject canvas extent regardless of OTFR
- toggling OTFR off, switches the project CRS to the current layer CRS (or
first layer, if no layer is active).
- toggling OTFR also saves the previous CRS setting and restores the previous
selected CRS.

History

#1 Updated by Alister Hood about 13 years ago

  • Assignee deleted (nobody -)
  • Pull Request or Patch supplied set to No

N.B. As well as being a more generally user friendly behaviour, this would fix what I suspect is the most common cause of endlessly repeating "forward transform" errors (which force users to kill QGIS, potentially losing work they have done).

#2 Updated by Giovanni Manghi almost 13 years ago

  • Target version changed from Version 1.7.0 to Version 1.7.4

#3 Updated by Alister Hood almost 13 years ago

Also see #3856 and #3243, which are similar issues for the spatial bookmarks and print composer extents.

#4 Updated by Alexander Bruy almost 13 years ago

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

Implemented in 65f32bc137

#5 Updated by Maxim Dubinin almost 13 years ago

  • % Done changed from 0 to 70
  • Resolution deleted (fixed)

#6 Updated by Maxim Dubinin almost 13 years ago

Great start, but this was not fully implemented.

1. Open layer
2. Select CRS, switch on OTFR. OK
3. Map canvas is repositioned -> everything is ok
4. Switch OTFR back off. OK

Map canvas is not repositioned back to layer's extent.

If you'd like, try to repeat steps 2-4, map canvas is not repositioned anymore.

So this feature works, but only once.

#7 Updated by Jürgen Fischer almost 13 years ago

Alister Hood wrote:

endlessly repeating "forward transform" errors (which force users to kill QGIS, potentially losing work they have done).

BTW this is only valuetool's "fault". Which constantly queries the layer while you move the pointer over the canvas and thereby creating a popup for every move.

Moving the pointer outside the canvas, closing the popup via keyboard and then zooming to a valid extent before moving over the canvas again helps.

#8 Updated by Giovanni Manghi almost 13 years ago

BTW this is only valuetool's "fault". Which constantly queries the layer while you move the pointer over the canvas and thereby creating a popup for every move.

Moving the pointer outside the canvas, closing the popup via keyboard and then zooming to a valid extent before moving over the canvas again helps.

confirmed... value tool is a invaluable tool when doing raster analysis... unfortunately as 3rd party plugin I can imagine is difficult to keep it up to date with the changes in raster code. I already filed a ticket in the value tool bug tracker.

#9 Updated by Maxim Dubinin almost 13 years ago

I don't quite understand why this feature turned into valuetool discussion.

Also, is it possible to reopen the feature request? "Close" button is blocked for me.

#10 Updated by Giovanni Manghi almost 13 years ago

  • Status info deleted (0)
  • Operating System deleted (All)
  • Status changed from Closed to Open

#11 Updated by Jürgen Fischer almost 13 years ago

Maxim Dubinin wrote:

Great start, but this was not fully implemented.

It is. Actually there are two new features:

  1. When inserting the first layer, the project's CRS is set to the layer's extent. Otherwise the canvas extent might not make any sense in the project's CRS, when OTFR is enabled later.
  2. When changing the CRS with OTFR enabled (or changing the CRS and enabling OTFR) the canvas extent is reprojected to the CRS.

Turning OTFR off doesn't change the canvas extent, neither does changing the project's CRS without having OTFR enabled. And IMHO that makes sense. I'd consider having just one layer or using OTFR with layers of unique CRS an edge case. So when using OTFR I'd expect to have layers of different CRS and most of the time even one of the CRS we reproject to. So we don't know which layer's CRS is relevant when OTFR is turned off.

#12 Updated by Jürgen Fischer almost 13 years ago

Maxim Dubinin wrote:

I don't quite understand why this feature turned into valuetool discussion.

No value tool discussion. Just an explanation how to deal with the popups without loosing work.

#13 Updated by Jürgen Fischer almost 13 years ago

Giovanni Manghi wrote:

confirmed... value tool is a invaluable tool when doing raster analysis... unfortunately as 3rd party plugin I can imagine is difficult to keep it up to date with the changes in raster code. I already filed a ticket in the value tool bug tracker.

Sure #4904 - I filed #4905 :)

#14 Updated by Maxim Dubinin almost 13 years ago

Jürgen,

your first point make sense, however, I think that returning to one of the layers is better than showing blank. Also I feel that it doesn't actually explain why when OTFR is turned on second time the canvas doesn't get repositioned.

Try this:

1. Open layer
2. Select CRS, switch on OTFR. OK
3. Map canvas is repositioned -> everything is ok
4. Switch OTFR back off. OK -> layer disappears
5. Zoom to layer to return canvas back to it.
6. Repeat 2.
Why canvas is not repositioned this time? We just repeated the same thing.

#15 Updated by Jürgen Fischer almost 13 years ago

Maxim Dubinin wrote:

Why canvas is not repositioned this time? We just repeated the same thing.

Because zoom to layer only happens automatically when the first layer is inserted.

#16 Updated by Jürgen Fischer almost 13 years ago

  • Status changed from Open to Feedback

#17 Updated by Richard Duivenvoorde almost 13 years ago

I agree with Jurgens points, but also find it annoying that often I fall back to the white map after turning off otf...

So what about this option:

After turning off otf:

1) if there is an active layer, zoom to the mapcanvas extent in THAT crs (ratio: apparently that is the most important layer because you were active in it...)
2) if there is NOT an active layer: zoom to the box of the TOP layer (ratio: I agree with jurgen that it is not clear which layer to take for leading the crs, but(!) this is a corner case. Often in practice you will just have a lot of layers with all the same crs, on top of for example OSM or Google layers...

Another more complex option would to have:
3) in case of really having more crs's in the list: confront the user with a little dialog with the list of current crs's and the question: 'Hey to which crs do you want to pan now: '

#18 Updated by Maxim Dubinin almost 13 years ago

yes, as I said, it is better to fall back to any (first) layer, than to show blank page, so +1 for options 1 or 2, doesn't matter.

Just to note, ArcGIS behavior is exactly that, in case of three layers with different CRSes OTFR-ed to a common CRS it falls back to the first one if OTFR is turned off.

You can also turn it on/off as many times as you need.

Again, this is not to critisize current work, this is a great step forward.

#19 Updated by Nathan Woodrow almost 13 years ago

I think failing back to the first layer would be the best option. It's simple to explain to user. If you turn OTFR off you get the CRS of the first layer. The more complicated you make the way QGIS handles it the harder it is to explain to users when there view changes in front of them.

#20 Updated by Jürgen Fischer almost 13 years ago

  • Assignee set to Jürgen Fischer

#21 Updated by Jürgen Fischer almost 13 years ago

  • % Done changed from 70 to 100
  • Status changed from Feedback to Closed

#22 Updated by dr - almost 13 years ago

Now if enable OTFR, disable, enable it again - extent becomes more larger and larger. Is this expected behavior or bug?

#23 Updated by dr - almost 13 years ago

  • % Done changed from 100 to 90

Also available in: Atom PDF