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

Stephane Goldstein s.n.g at gmx.com
Tue Mar 14 22:04:04 PDT 2023


So, after fiddling around a bit more, I can see that when zoomed at native
resolution or further out, the "Zoomed out" option works, with "Nearest
Neighbour" showing the source pixels and "Cubic" and "Bilinear" applying
re-sampling.
The options in the "Zoomed in" however do not seem to produce any changes
when overzooming.

On Wed, 15 Mar 2023 at 12:54, Stephane Goldstein <s.n.g at gmx.com> wrote:

>
> Thanks for the replies.
>
> The imagery I'm working with comes from drone mapping.
> The orthomosaic is generated using OpenDroneMap, in WGS84 UTM CRS
> The resulting GeoTIFF is then re-projected  to Web-mercator 3857, before
> being run through gdal2tiles.
> At this stage I'm loading the tiles as an XYZ layer directly from my hard
> drive, and my canvas is set at 3857 as well.
> So I know that the two screenshots I attached earlier come from the same
> PNG file.
>
> When I set the zoom to 1:1 as suggested, I can see the PNG files are
> displayed without anti-aliasing as expected.
> But as soon as I zoom in further, anti-aliasing takes place to oversample
> the image.
> I have tried changing the parameters of the Resampling section in the
> Layer Styling, but they have no effect at all (Zoomed In, Zoomed Out,
> Oversampling and "Early re-sampling" options).
>
> But the weirder thing is that when I set my XYZ layer source as
> "Interpretation: MapTiler Terrain RGB", pixels are shown as squares when
> over-zooming, like a standard raster would, which is what I want (even
> though the data does not make any sense with the MapTiler Terrain RGB
> styling, obviously).
>
> Antialising does not help the interpretation of my imagery, and so far the
> only solution I found was to create tiles up to zoom level 25, which is a
> massive amount of overprocessing and storage, since level 21 is enough to
> account for my 2cm resolution data source. Any other suggestions are really
> appreciated.
>
>
> On Sat, 11 Mar 2023 at 18:29, Johannes Kröger (WhereGroup) <
> johannes.kroeger at wheregroup.com> wrote:
>
>> 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
>> >> <https://pasteboard.co/YodS7tuhtzSC.png>) and how it's rendered in
>> >> QGIS (https://pasteboard.co/tcGLRc7XrsNj.png
>> >> <https://pasteboard.co/tcGLRc7XrsNj.png>).
>> >> The examples are at the same zoom level.
>> >>
>> >> On Thu, 9 Mar 2023 at 21:46, Richard Duivenvoorde
>> >> <rdmailings at duif.net <mailto:rdmailings at 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
>> >> <
>> 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 at 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.kroeger at wheregroup.com
>> www.wheregroup.com
>> Geschäftsführer:
>> Olaf Knopp, Peter Stamm
>> Amtsgericht Bonn, HRB 9885
>> -------------------------------
>>
>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-user/attachments/20230315/a5964074/attachment.htm>


More information about the QGIS-User mailing list