6

I am going to be creating (digitising) many repetitive maps which contain the same set of .shp file vector layers. And I was wondering if there was a way to create a template .shp file I can re-use over and over which saves its style, name and blank fields.

What I wish to do: Be able to import a already set up set of layers made up of polygons, points and lines, for example: Paddocks, PowerPoles, Roads which have their names and pre-defined symbology already set up

Currently I am setting up the layers and importing .qml (style) files which is becoming very tedious as I can have up to 30-50 layers. I have tried using Export/import layer definition files but this points back to my original shp files, which I do not wish to edit again. I need a new blank shp file.

Is there a better way to do this?

4

You can create a folder to hold your templates. Create the Shapefiles, style them, set the labels.

The, for each of them, save the style/label as a QML file. Right click the layer, go to properties, then style, then hit the style button then save style / QGIS Layer Style File and use the same name as your Shapefile (so mylayer.shp -> mylayer.qml).

When you start a new project, copy the template folder to a new one (like project1). Add the Shapefiles from this new project1 folder, either by drag and drop or by the menu Layer / Add layer / Add vector layer. They will be automatically styled and labeled.

You can look at the qml file using a text editor. It is not linked to any particular layer, and the file name being the same as the shapefile name is the key.

enter image description here

0

If you are familiar with QGIS programming with python, you can programmatically

  1. create a template shapefile and the style file manually.

  2. create a copy of the template, load it into a QGIS map, and apply the style file in a loop.

Very rough ideas, but it's doable in pyqgis.

See this interesting GIS.SE question about commonly used pygis functions (Looking for common PyQGIS functions for QGIS 3) for possible examples code that you can use.

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.