3

Whenever I create a new layer out of selected features on QGIS, several files are created and saved on my machine. These files have the following extensions: .cpg, .dbf, .prj, .qmd, .shp and .shx.

Is there a name for these files? How can they be used in a different project (if I, at some point, want to include the same layer) and what is the best way to manage them, since it easily becomes a large amount?

I create the new layer by right clicking on the layer with the selected features > Export > Save Selected Features As.

Matt
  • 16,843
  • 3
  • 21
  • 52
user224727
  • 33
  • 3
  • The "main" Shapefile file is the one with file extension .shp (normally it is the one with the largest file size). The other files can be (inofficially?) named "sidecar" files. At least some of them are necessary for the Shapefile to work properly. See also here: https://gis.stackexchange.com/a/414868/88814 – Babel May 21 '23 at 09:37

2 Answers2

7

These are all parts of a Shapefile.

The best way to manage them is to not create them in the first place!

Consider saving your files as GeoPackage (GPKG) instead. It's a more modern format - Shapefiles have many limitations - and the GeoPackage will be in one file instead of several.

See https://www.geopackage.org/

You can select GeoPackage from the drop-down in the Save Selected Features As... interface.

enter image description here

Tom Brennan
  • 4,787
  • 6
  • 26
  • Thank you. How do I save the selected features as GeoPackage instead of these multiple files? – user224727 May 20 '23 at 13:10
  • 3
    Maybe update your question with the steps are you currently to create the layer, and I can update the answer. There are various methods for creating layers from selected features, so best to be specific. – Tom Brennan May 20 '23 at 13:15
  • 2
    I agree with the GPKG solution. Nevertheless, it might help you understand shapefiles because they are still very common in the GIS world. Here are two good places to learn about them: https://desktop.arcgis.com/en/arcmap/latest/manage-data/shapefiles/what-is-a-shapefile.htm and https://desktop.arcgis.com/en/arcmap/latest/manage-data/shapefiles/shapefile-file-extensions.htm Wikipedia also! – Stu Smith May 20 '23 at 16:47
  • ... in to complete what @StuSmith linked, here background information about the (mainly) disadvantages of Shapefiles and what advantages you have using Geopackage instead: http://switchfromshapefile.org/ (at the bottom also some other formats, for each the scenarios are listed when its use makes sense). – Babel May 21 '23 at 09:29
4

Although I agree that Geopackage is a better solution, you can always zip all resulting files from a query (they all will have the same name with different extensions) into a zip file. These zip files can be dragged and dropped into the layers window of any QGIS project. Be aware, however, that when using zipped files, layer editions can't be saved unless you save them as another file.

jpinilla
  • 3,230
  • 1
  • 12
  • 24