0

I'd like to prepare a point dataset in QGIS (shp or even better a table in a gpkg), with some predefined configuration of the attribute form, which I can share with my co-workers.

I want - as soon as I create a new feature - in the attribute dialogue the coordinates already be filled in. This work so far with defining a default value of $x resp. $y for the attributes "easting" and "northing".

When I import this pre-configured file (shp or table in gpkg - tried both) in a new QGIS project, these configurations are gone and the coordinates are not automatically filled in when I create a new point feature.

Anyone knows, if it is possible to save the file in a way, that these configurations are kept?

Of course I googled this, but did not find anything helpful.

6
  • You could share both the data and qgz file
    – Bera
    Commented May 10 at 8:04
  • You can also Save a layer style inside a geopackage
    – Ben W
    Commented May 10 at 8:17
  • Thanks BERA, but I need a shape or table file which I can add to already existing qgz files. Usually we have a map from a site where we want to add the file and create points from which the coordinates should automatically be stored in the attribute table. So it does not help to have a completely new qgz file which contains my point dataset. @Ben W: Saving the style does not do the trick, as it is not symbology I want to predefine, but the configuration of the attribute form. Saving the file with its metadata also does not help. Tried it. Maybe someone else has an idea. But thanks anyways :)
    – pottsbill
    Commented May 10 at 9:12
  • 1
    Attribute form configuration is part of the layer style
    – Ben W
    Commented May 10 at 9:58
  • Maybe using mergin maps would solve your problem... you can create a project with all necessary layers, configure attribut form, configure styles and share with whoever you want and use together.
    – sttipa
    Commented May 10 at 19:27

2 Answers 2

2

To complement eurojam's answer, I will re-iterate my comment: You can Save a layer style inside a GeoPackage.

Contrary to your assumption, the layer style is not just the symbology; the screenshot below shows all the layer property categories which can be stored in a layer style file. Yes, this includes the attribute form configuration.

enter image description here

Now, if your layer data is stored in a GeoPackage, when you select Style -> Save Style... from the menu at the bottom of the Layer Properties dialog, you will also have the option to Save style in datasource database.

enter image description here

This will save the layer style as a table inside the GeoPackage. Now you have a single file which you can share with colleagues, which can be added to a new or existing QGIS project and will have the default $x & $y attribute values set to fill automatically when a new feature is added.

You can see in the short screencast below, I have set default $x & $y values, and labelled with those fields concatenated. When loading the layer into a project and adding a feature, the Lat & Long fields are automatically populated.

enter image description here

2

You can save the style as qml file in the same directory and with the same name as your shapefile. Then the style will be automatically loaded while loading the shapefile into a new project, including the form, actions and so on...

  • myshape.shp
  • myshape.dbf
  • myshape.shx
  • myshape.cpg
  • myshape.prj
  • myshape.qml

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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