I have a QGIS project where a SHP-layer contains the IDs of plots besides vector data.

I want to create a form with QTDesigner which enables me to enter the contact information of the landowner(s) for each plot in QGIS. So by clicking on the "identify features"-button the form should open and then I should be able to enter the landowner information. The plot-ID should be a value that is determined and can't be changed.

My biggest question is, how I can consider that some plots can have several, up to 20 land owners. So obviously having all this data on one form is not very good. It should be separated and selectable (tabs, or a drop down menu).

My idea how to handle this in such cases:

I enter the data (street, town, ZIP, phone number) of the first landowner then I push "OK" thus creating a dataset "landowner1". After this I'm still on the same form, but all the fields where I can enter the contact information are empty again and now I can enter the data for "landowner2", and so on. Since the data would be stored in the attribute table I would also have street1, street2,... town1, town2, ... etc. for each landowner.

Later all this data should be accessible via the "identify feature" and I can select in a dropdown-menu or -list between the landowners.

How can I achieve this?

Please note that I'm have almost no idea about Python or programming. I'm using QGIS 2.12.0.

  • Thanks for the replies so far. As no way seems to go around Python, I will have to get familiar with it. Actually I already started online. Might take me some time. I hope I can come back to this topic again and get it solved some day. – SnoopyTheCat Apr 1 '16 at 14:02

What you want to do is to hide GIS/Database functionality behind a simple GUI, legitimate approach imho.

This question thus has two aspects:

1) From the database point of view, you have a m:n cardinality join from plots to landowners (a plot can be owned by n landownder an vice versa, a landowner can own m plots). Such is usually achieved by an intermediate table in which the relations are stored. So design the database in an appropriate way first.

2) One thing (the easy part) is to design a customer GUI with the QtDesigner, but so it is not done. Furthermore you need to implement the logic behind your GUI, which is just done in Python. Since you have 'almost no idea' (which means to me you have little idea), I recommend you to take advantage of this oportunity to start with Python. It will help you anyway.

  • Thanks for the reply. I feared that I would need Python for this. But just that I understood correctly: In order to create this logic or method that after entering the data for one landowner, I can save it and enter the next landowner's data, I definitely need to write sth. in Python? There is no other way around? – SnoopyTheCat Apr 1 '16 at 11:07
  • no way, as far as i can see ;-) – Jochen Schwarze Apr 1 '16 at 11:54

Building off of @Jochen Schwarze answer, I would recommend this structure:

  1. Create database (e.g. SQLite, ESRI File Geodatabase, or PostgreSQL/PostGIS) and store parcel and owner table in it. You will gain many more modern features using a database such as longer field length size, performance, and scaleability compared to shapefile/dbf.
  2. Create UI form with the following controls, owner drop down (that will be populated with all the related parcel owners), owner name1, owner name2, street, town, ZIP, phone number...etc text boxes. Finally, create a button called something like commit.
  3. Next, here is the python logic (pyQGIS and most likely some other modules), on form load event all related owners in owner table will populate owner drop down. This will be a query looking at the parcel ID and the related one to many found ID in the owner table. If no matches are found owner drop down will be blank. If value is found owner drop is populated. User can select owner name from drop down and that click event will thus populate the other related text boxes noted above. User can then edit any of the text box info if needed. Once done, user may click the commit button and thus UPDATE or INSERT those records/field values to the owner table and plus if new owner write ID value too.

So, learn python, then start searching the web for these concepts, "how to INSERT, UPDATE, DELETE db table records using pyQGIS", "how to query layer using pyQGIS", "how to populate QTCombobox", "how to work with QT slots and signals for control events"...etc.

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.