qgis / QGIS

QGIS is a free, open source, cross platform (lin/win/mac) geographical information system (GIS)
https://qgis.org
GNU General Public License v2.0
10.58k stars 3k forks source link

Raster resampling happens before map canvas rotation #23602

Open qgib opened 8 years ago

qgib commented 8 years ago

Author Name: Johannes Kroeger (Johannes Kroeger) Original Redmine Issue: 15679 Affected QGIS version: 2.16.3 Redmine category:unknown


If you use QGIS' canvas rotation feature and have raster images in your map, they will look much worse than intended.

It seems like the resampling is done before the rotation. The rotation of course leads to different neighborhood relationships between pixels so the quality degrades. Would it be possible to resample after rotating?

Attached is an example of the same area with Nearest Neighbor resampling as well as Average with 0° and 10° rotation applied. As you can see, the image quality in the 10° Average image looks not very good.


qgib commented 7 years ago

Author Name: Giovanni Manghi (@gioman)


qgib commented 7 years ago

Author Name: Jürgen Fischer (@jef-n)


qgib commented 6 years ago

Author Name: Johannes Kroeger (Johannes Kroeger)


This also affects OTF reprojection as shown in this image. I would update the title if I could.



qgib commented 5 years ago

Author Name: Giovanni Manghi (@gioman)


End of life notice: QGIS 2.18 LTR

Source: http://blog.qgis.org/2019/03/09/end-of-life-notice-qgis-2-18-ltr/

QGIS 3.4 has recently become our new Long Term Release (LTR) version. This is a major step in our history – a long term release version based on the massive updates, library upgrades and improvements that we carried out in the course of the 2.x to 3x upgrade cycle.

We strongly encourage all users who are currently using QGIS 2.18 LTR as their preferred QGIS release to migrate to QGIS 3.4. This new LTR version will receive regular bugfixes for at least one year. It also includes hundreds of new functions, usability improvements, bugfixes, and other goodies. See the relevant changelogs for a good sampling of all the new features that have gone into version 3.4

Most plugins have been either migrated or incorporated into the core QGIS code base.

We strongly discourage the continued use of QGIS 2.18 LTR as it is now officially unsupported, which means we’ll not provide any bug fix releases for it.

You should also note that we intend to close all bug tickets referring to the now obsolete LTR version. Original reporters will receive a notification of the ticket closure and are encouraged to check whether the issue persists in the new LTR, in which case they should reopen the ticket.

If you would like to better understand the QGIS release roadmap, check out our roadmap page! It outlines the schedule for upcoming releases and will help you plan your deployment of QGIS into an operational environment.

The development of QGIS 3.4 LTR has been made possible by the work of hundreds of volunteers, by the investments of companies, professionals, and administrations, and by continuous donations and financial support from many of you. We sincerely thank you all and encourage you to collaborate and support the project even more, for the long term improvement and sustainability of the QGIS project.


kannes commented 5 years ago

This is still the case in 3.8, please re-open.

Maybe there is no filtering applied to the map canvas in general after rotation?

Pedro-Murteira commented 2 years ago

This is still valid on QGIS 3.22.3.

AlisterH commented 1 year ago

Here is another sample showing that this is really bad if people want to bring raster (perhaps scanned) maps to QGIS. I sometimes "export map to image" to use in CAD (yes, to render the text it has to be very high resolution, but this is better than bringing in vast amounts of vector data to CAD). If I have the map rotated in QGIS when I export, I get a rotated geotif. For reference, this is what it looks like in an image viewer (which does not know anything about the rotation): image If I wanted to load a rotated image like this into QGIS, it would be illegible (regardless of the rotation I set for the QGIS window): image image If I wanted to bring in scanned maps or something with some rotation, I would need to upsample them significantly for legibility.

elpaso commented 1 year ago

I am afraid there is nothing we can do: the exported image is rotated and GDAL loads it correctly.

You can try different resampling algorithms to get a slightly better image.

immagine

kannes commented 1 year ago

The issue is that this resampling is done before the canvas rotation. The "resampling" of the rotation is not filtered and leads to jarring aliasing.

A reduction in visual quality when rotating rasters is to be expected but it could be drastically reduced if it wasn't a nearest neighbor operation (I guess).

elpaso commented 1 year ago

The issue is that this resampling is done before the canvas rotation. The "resampling" of the rotation is not filtered and leads to jarring aliasing.

Rotation of the canvas in QGIS is not involved at all in this issue.

After you load a raster which was exported from a rotated image the issue appears also if the canvas is not rotated. It is the original raster which was rotated when exported, GDAL knows that from the world file and applies the appropriate transformation.

kannes commented 1 year ago

Ah, I missed that @AlisterH's comment was only tangentially really related to my bug report. @AlisterH maybe make a feature request to make raster export of a rotated canvas store a resampled image instead of "just" an image with its rotation defined in the metadata (if that is what happens).

AlisterH commented 1 year ago

No, I'm not complaining about export of rotated maps, I'm talking about display of rasters with rotated geotransform. I think it is #46262, which has been marked as duplicate of this (although it was also addressed in another old ticket). So maybe that one should be reopened if we want to keep the issues separate?

alexbruy commented 12 months ago

Does activating "Early resampling" checkbox in the recent QGIS versions improves situation?

AlisterH commented 11 months ago

There is almost no improvement in my example of rasters with rotated geotransform. I don't see any improvement in the case of a rotated canvas and a raster without rotated geotransform - but perhaps there is a minimal improvement and I just can't see it.