# QGIS processing default output vector layer extensions

You can set the default output-extension of a model in processing > options > general. The intermediate transactions in a model are processed in that default file format.

After installing QGIS, the default extension is set to 'shp'.

A well-known disadvantage of using shp is the restriction in attributenames (set to 10 characters).

When I set the default to eg. 'geojson' I can evade the naming-restriction. But I then get some other errors on processing geometries.

So I'm looking for an explanation of the advantages and disadvantages of the different output-extensions used in the graphical modeller.

I'm not sure whether the current version of QGIS uses it for intermediate files, or just output files - it may use memory layers now. In either case, the principle is the same.

As you say, geojson has an advantage over shapefile - there's no need to truncate ("launder") field names.

The reason you might be getting errors changing the result, is that the geojson driver doesn't allow in-place edits. You can read an existing geojson file, create a new one, but you can't edit an existing one.

The same goes for rasters; some file types can't be written, only read.

The following code was cribbed from the Python GDAL/OGR cookbook

from osgeo import ogr

ds = ogr.Open("/path/to/some.geojson",0)
layer = ds.GetLayer()
capabilities = [
ogr.OLCSequentialWrite,
ogr.OLCRandomWrite,
ogr.OLCFastSpatialFilter,
ogr.OLCFastFeatureCount,
ogr.OLCFastGetExtent,
ogr.OLCCreateField,
ogr.OLCDeleteField,
ogr.OLCReorderFields,
ogr.OLCAlterFieldDefn,
ogr.OLCTransactions,
ogr.OLCDeleteFeature,
ogr.OLCFastSetNextByIndex,
ogr.OLCStringsAsUTF8,
ogr.OLCIgnoreFields
]

print("Layer Capabilities:")
for cap in capabilities:
print("  %s = %s" % (cap, layer.TestCapability(cap)))


The output for one geojson file is

Layer Capabilities:
SequentialWrite = False
RandomWrite = False
FastSpatialFilter = False
FastFeatureCount = True
FastGetExtent = False
CreateField = False
DeleteField = False
ReorderFields = False
AlterFieldDefn = False
Transactions = False
DeleteFeature = False
FastSetNextByIndex = True
StringsAsUTF8 = True
IgnoreFields = False


From that, you can see GeoJSON files don't allow editing, and don't have their own spatial indexes. This page describes these capabilities in more detail.

You don't need code for this if you have a layer; right-click on a layer, properties, metadata and scroll down to "capabilities for this layer".

It's also possible that some formats may only support some geometry types... there may be restrictions on 25D, Curves etc. The formats available may depend on the version of QGIS and/or GDAL/OGR installed.

Which format to use depends on your specific requirements. I suspect that shp, sqlite and gpkg are probably the most flexible if you want to do further processing.

• it would be extremely useful to replace the option to change the output format of the vectors. thank you – pigreco May 24 at 19:49