[QGIS-Developer] GDAL processing algorithms issues due the default output layer extensions weirdly changed

Even Rouault even.rouault at spatialys.com
Sun Feb 25 16:38:30 PST 2024


I'm not sure if that explains the family of bugs seen, but as those 
settings are a *integer* index in the list returned by 
QgsVectorFileWriter::supportedFormatExtensions() or 
QgsRasterFileWriter::supportedFormatExtensions() , they depend both on 
the QGIS list of known formats which may evolve over versions (not that 
frequent that said), and/or if the GDAL version changes and/or if 
drivers are enabled/disabled. It would be more robust to capture the 
extension as a string rather than an index.

And even capturing an extension is not super robust, as potentially 
several drivers could recognize the same extension

For example when using the ".xml" extension as a vector output, you'll 
probably be surprised that the obscure PDS4 vector driver (tabular data 
for planetary datasets) is used!

This is because:

$ ogrinfo --formats | grep xml | grep 'w'
   PDS4 -raster,vector- (rw+vs): NASA Planetary Data System 4 (*.xml)
   GML -vector- (rw+v): Geography Markup Language (GML) (*.gml, *.xml)
   Interlis 2 -vector- (rw+v): Interlis 2 (*.xtf, *.xml, *.ili)
   GMLAS -vector- (rwv): Geography Markup Language (GML) driven by 
application schemas (*.gml, *.xml)

whereas looking at QgsVectorFileWriterMetadataContainer , I strongly 
suspect that the intent was rather to use the GeoRSS driver for which 
QGIS registers a .xml extension (the GDAL GeoRSS driver doesn't 
advertize a particular file extension)

==> Those settings should actually be deprecated and replaced by others 
that save a GDAL driver name ... plus an extension, because the "MapInfo 
File" driver produces quite different output if you chose ".tab" or 
".mif" (or the GeoJSONSeq driver that will use different separators if 
you select the ".geojsonl" or ".geojsons" extensions)

Even

Le 26/02/2024 à 00:23, Nyall Dawson via QGIS-Developer a écrit :
> On Mon, 26 Feb 2024 at 08:58, Andrea Giudiceandrea via QGIS-Developer
> <qgis-developer at lists.osgeo.org> wrote:
>> Hi developers,
>> various QGIS users have reported during the latest months (mostly since
>> September 2023, and a couple also back in July 2023) on various channels
>> a strange issue which makes the GDAL processing algorithms to fail when
>> the temporary output is set.
>>
>> Looking at the provided processing logs, it turns out that the issue is
>> due to the fact that the default output vector layer extension was set
>> to .xtf "Interlis 2" (instead of the default .gpkg "GeoPackage") or that
>> the default output raster layer extension was set to .nc "NetCDF"
>> (instead of the default .tif "GeoTIFF").
>>
>> The weird think is that all the users affected by the issue have
>> reported that they had not deliberately changed these settings.
> Hmm, I wonder if it's a plugin changing this setting. I've definitely
> seen plugins before doing unfriendly things like this...
>
> Nyall
> _______________________________________________
> QGIS-Developer mailing list
> QGIS-Developer at lists.osgeo.org
> List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer

-- 
http://www.spatialys.com
My software is free, but my time generally not.



More information about the QGIS-Developer mailing list