Re: [Qgis-user] Display of non-axis-aligned pixels

2023-03-11 Thread Daniel Evans via QGIS-User
Hi Alister,

Thanks for the response, and the link back into the history of the issue.

> I'm not even sure if a fix would involve work on QGIS itself, or gdal, or 
> perhaps both.

I'd be a little surprised if it were GDAL doing something unexpected -
one would have to jump through a couple of extra hoops to get GDAL to
resample the raw, rotated data to north-aligned. However, I can't say
I've ever looked into any of the details of how QGIS uses it to read
rasters, and whether it's a simple read or a far more complex pipeline
(perhaps this will be a prompt to, although illiteracy in C++ is a
minor hurdle!).

Cheers,
Daniel

On Sat, 11 Mar 2023 at 07:30, Alister Hood via QGIS-User
 wrote:
>>
>> Date: Fri, 10 Mar 2023 13:52:42 +
>> From: Daniel Evans 
>> To: qgis-user@lists.osgeo.org
>> Subject: [Qgis-user] Display of non-axis-aligned pixels
>> Message-ID:
>> 
>> Content-Type: text/plain; charset="UTF-8"
>>
>> Hello,
>>
>> I have some raster data where the pixels are not
>> coordinate-system-aligned - i.e. the geotransform has significant
>> diagonal components. `gdalinfo` reports:
>>
>> GeoTransform =
>>   444048.6420808117, 6.302162394202463, 6.152691784443768
>>   5417729.777950762, 4.143808265940849, -3.26376570161891
>>
>> When viewing the raster in QGIS, I am surprised to find that it
>> displays the pixels as north-aligned. An example is here:
>> https://i.imgur.com/i6y1gtM.png
>>
>> If I make nodata visible, it seems that QGIS is displaying an
>> axis-aligned image corresponding to the bounding box of my original
>> image (data in white, nodata in black). Screenshot here:
>> https://i.imgur.com/ZQJ6Mi5.png
>>
>> This behaviour surprised me, as QGIS is capable of showing pixels at a
>> slant in some circumstances. For example, if I set QGIS to render
>> using a different UTM zone, the pixels are slanted - although in this
>> case, it's applying a second rotation on top of the north-aligning
>> rotation it's already applying: https://i.imgur.com/LoC7jyk.png
>>
>> 1. Is it possible to have QGIS display a raster without resampling the
>> pixels to axis-aligned?
>
>
> I don't believe so.
>
>>
>> 2. Is there a reason for making this the default (or only) behaviour?
>> It caused quite some confusion when trying to diagnose a
>> geotransform-related issue elsewhere.
>
>
> Several bug reports have been filed about this over the years, (e.g. 
> https://github.com/qgis/QGIS/issues/23760, which should really be reopened, 
> unless someone files a new ticket instead), and no one has ever tried to say 
> it "should" be this way.  I'm no expert, but I presume the problem is simply 
> that no one has been both motivated and able to do the work to fix it, or to 
> fund someone to do it.
> I'm not even sure if a fix would involve work on QGIS itself, or gdal, or 
> perhaps both.
>
> Regards,
> Alister
> ___
> QGIS-User mailing list
> QGIS-User@lists.osgeo.org
> List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user
___
QGIS-User mailing list
QGIS-User@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user


Re: [Qgis-user] Disable anti-aliasing on XYZ layer

2023-03-11 Thread WhereGroup

That looks like the layer's resampling is not set to nearest neighbor.

Also be aware that QGIS will have to resample the tiles whenever the 
scale of the map does not match one of the pre-rendered zoomlevels of 
the source (and the same CRS). If you have a matching CRS, select the 
layer and click the "1:1" zoom icon, the image *should* match the 
original 100%.


Cheers, Hannes

Am 09.03.23 um 15:55 schrieb Richard Duivenvoorde via QGIS-User:

( bringing it back to the list :-) )

And are you sure the image retrieved from the xyz server is not a jpeg 
(compared to your original png)?
You can try to see the actual url's used via F12 (the Debugging 
Development Tools panel) in QGIS.


Another option: QGIS does not respect the xyz-zoomlevels always.. so 
it is very easy to go to a zoomlevel in which QGIS has to resize the 
original image a little (and 'resample' it, see Rendering/Raster 
settings in the Options). So to really compare QGIS image to the 
original one, you have to use the 'Zoom to native resolution' in the 
legend/layer context menu).


Last idea: is your project in the same CRS as the xyz service 
(probably EPSG:3857?) Because if not, QGIS will also resample your 
original image to 'fit' the tile in the right position in that other 
crs


(and again: I know nothing about Qt image rendering )

Regards,

Richard Duivenvoorde

On 3/9/23 15:36, Stephane Goldstein wrote:
I can see the difference by comparing the .png file in an image 
editor (https://pasteboard.co/YodS7tuhtzSC.png 
) and how it's rendered in 
QGIS (https://pasteboard.co/tcGLRc7XrsNj.png 
).

The examples are at the same zoom level.

On Thu, 9 Mar 2023 at 21:46, Richard Duivenvoorde 
mailto:rdmaili...@duif.net>> wrote:


    On 3/9/23 14:05, Stephane Goldstein via QGIS-User wrote:
 > Hi.
 > Is there a way to disable anti-aliasing of the png tiles 
loaded on an XYZ layer ?


    Hi Stephane,

  From what do you conclude that there is anti-aliasing going on 
with XYZ layers?

    I use xyz layers also but I'm not aware of such behaviour?

    FYI: this is the code rendering the images:
https://github.com/qgis/QGIS/blob/master/src/providers/wms/qgswmsprovider.cpp 
 


    (tried to search for 'alias' but could not find anything)

    Note, I'm not an expert in this field, so just wondering...

    Regards,

    Richard Duivenvoorde




___
QGIS-User mailing list
QGIS-User@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user


--
Johannes Kröger / GIS-Entwickler/-Berater

**
FOSSGIS Konferenz
15.-18. März 2023 in Berlin
https://fossgis-konferenz.de/2023/

WhereGroup-Beiträge auf der FOSSGIS
https://wheregroup.com/unternehmen/aktuelles/
**

WhereGroup GmbH
c/o KK03 GmbH
Lange Reihe 29
20099 Hamburg
Germany

Tel: +49 (0)228 / 90 90 38 - 36
Fax: +49 (0)228 / 90 90 38 - 11

johannes.kroe...@wheregroup.com
www.wheregroup.com
Geschäftsführer:
Olaf Knopp, Peter Stamm
Amtsgericht Bonn, HRB 9885
---

___
QGIS-User mailing list
QGIS-User@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user