5

QGIS 3.6.0

I am new to QGIS software and not very technical on its deep workings. I am trying to split a .shp file using split vector layer. I need .shp file outputs but it auto creates .gpkg files.

I cant seem to find any settings that will change the default from .gpkg to .shp

4

To fix my issue I edited VectorSplit.py located at QGIS 3.4\apps\qgis-ltr\python\plugins\processing\algs\qgis\apps\qgis-ltr\python\plugins\processing\algs\qgis

I reverted the first change here https://github.com/qgis/QGIS/commit/8446d3bdf0089cdee6316e40a7cd0047dbf455c1

such that line 111 now reads

fName = u'{0}_{1}.shp'.format(baseName, str(i).strip())
1

I'm having the same problem with split vector layer in qgis 3.4.5+ on windows.

Since the split vector layer tool saves to a folder rather than an individual file I am unable to specify a format as demonstrated by etrimaille.

In the advanced settings there is a "DEFAULT_OUTPUT-VECTOR-LAYER-EXT" option. Changing this option is not working with split vector layer tool either.

At the moment I'm at a loss and am writing a python script to try to recover this functionality.

  • What is the problem? What happen if you let the default memory layer and the save the layer after that? – etrimaille Mar 29 at 16:04
  • Saving to a memory layer and then exporting again does work, but I'm using the split vector layer feature to generate hundreds of shapefiles at a time. The problem is that I need to break large layers down into many small shapefiles with a few features each. Qgis 3.4.5+ on windows only seems to be able to directly output geopackage files from this algorithm regardless of what settings I change. The devices which need to read this data only accept shapefiles. – adegolyer Mar 29 at 16:27
  • 1
    DEFAULT_OUTPUT_RASTER_LAYER_EXT and DEFAULT_OUTPUT_VECTOR_LAYER_EXT have been removed from QGIS 3.6. (maybe 3.4.6?) because they were not used. Check github.com/qgis/QGIS/commit/… – etrimaille Mar 29 at 16:33
  • And the related ticket issues.qgis.org/issues/20557 – etrimaille Mar 29 at 16:35
  • 1
    Thanks for linking the github. I was able to fix my issue by replacing gpkg with shp in the following line of VectorSplit.py fName = '{0}_{1}.gpkg'.format(baseName, str(i).strip()) – adegolyer Mar 29 at 16:53
-1

For this special case of the split vector layer algorithm, before QGIS 3.10:

  • You need to update the code as mentioned in the other answer.

Since QGIS 3.10, the parameter is back and working: enter image description here

Source: https://github.com/qgis/QGIS/pull/31973

For usual Processing algorithm, any QGIS version:

You could let the default output memory layer when you launch the algorithm. And only after your analysis, in your legend, right click on your layer, export and then Save features as. You can choose the format you want, such as shapefile. export features as

Or, you can simply choose the format your want before to run your processing algorithm save to file

and choose Shapefile save as shapefile

  • 1
    Unfortunately you can not choose the file type in all algorithms, split vector layer is one of it. Here you can only choose an output folder, not the file type. – MrXsquared Mar 29 at 18:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.