1

I'd like to find a function or plugin for QGIS that displays vector data in a dynamic report. For example, I have a point vector layer "sample plots" that consists of 4 fields: ID, plot-number, comments and grade. I'd like to have a report or form that is linked to the dbf-file of that layer and displays the data dynamically in report. So if I add another point, it would show up on the report.

Does such a function or tool exist in QGIS?

4
  • Doesn't the attribute table do exactly that?
    – Erik
    Nov 9, 2018 at 11:47
  • Not sure of your exact need but did you look at the report fonction of QGIS 3 ? Have a look at these link and if that's not what you need provide more detail on your expected output north-road.com/2018/01/23/… OR anitagraser.com/2018/01/21/creating-reports-in-qgis
    – J.R
    Nov 9, 2018 at 13:05
  • For clarification: The report is supposed to have a header, the option to enter a date, and names of the people who did the survey of the plot (they change frequently). The attribute table would be one element of the report. I checked out the reports function in QGIS 3, but the created pdf-file at the end of the process is static. The perfect thing would be a plugin, that allows me to link dbf-fields to pdf-fields in a fillable pdf-form. Nov 9, 2018 at 15:34
  • 3
    @OnTheSurface what if you connected your PostgreSQL database table / view to LibreOffice spreadsheet - this would be a dynamic view of your data in whatever format/layout you want... I posted a tutorial here: github.com/dpsspatial/Installation-Instructions/blob/master/… Nov 9, 2018 at 17:56

2 Answers 2

1

If you wanted to use MS products, you can get a live connection to a shapefile DBF using Excel, but be warned: it can be quite laggy.

IMPORTANT: Your shapefile filename can only be 18 characters long using this method.

I've only tested this in Office 365.

  1. Go to Data > Get Data > From other sources > From ODBC
  2. Select dBASE Files as the DSN (Data source name) - it should be there by default
  3. Under Advanced Options > Connection string, paste the directory path of your dbf after dbq=, like so - make sure you include the terminal backslash in Windows: dbq=C:\users\files\shapefiles\
  4. Select Default or Custom for authentication, leave the credentials blank and click Connect
  5. Expand the folder and you will see your dbfs as a table that you can then load and manipulate using Power Query. If you get some weird error message chances are your dbf file name is too long, probably.

enter image description here

The power of this is you can rename the column names in this display, replace values, change column order, sort, etc. without touching any of the original data, much like a SQL VIEW would let you do.

If your original data has changed, you can refresh the table by selecting any cell and pressing Alt-F5. Or set it to do a background refresh by clicking on the table, going to Design > External Table Data > arrow button under Refresh > Connection Properties and setting a refresh interval:

enter image description here

Really, though, spatialite or better yet (if possible) Postgres would be the better way to store your data for faster retrieval and reporting.. Like DPSSpatial suggested in the comment: Visualizing PostGIS data in LibreOffice

1

QGIS Reports can do this, and more. See the Report section of the QGIS User Manual for details.

Basically you:

  1. "Design" the map(s) that you want to display on each page of the report.
  2. Create a new report (Project-> New Report).
  3. In the Report Organizer, add a Field Group Section under Report by pressing the green plus-button (+) and selecting Field Group Section.
  4. Make sure that "Group" is selected in the Report Organizer, and select your layer in Layer.
  5. Select a field (from the selected layer) for sorting the pages of the report (Field).
  6. Check Include body and click the Edit button to the right. If you right-click in the white "sheet" that shows up on the gray canvas, you can set the page size and orientation.
  7. Add your map (Add Item-> Add Map), dragging out the rectangle for it on the canvas.
  8. Add as many items for text as you need (Add Item-> Add Label), and data define the text to include values from the layer's attribute table.
  9. If the layer is a point layer, go to the Item Properties of the map, and select your preferred map Scale.
  10. Scroll down and check Controlled by Report. For point layers, Fixed scale will be the selected (and only possible) option. For features with an extent (line and polygon geometries), the map can be made to fit the geometry of the feature, with a margin (the default is 10%).
  11. Export your map to PDF, check the results and iterate until you are satisfied.

All the Print Layouts features are also available for Reports, so the possibilities for variations are endless. It is possible to highlight the "current" feature, add pictures using an attribute table field that can be used to generate the path and name of the image, and much more. to the current feature, and much more...

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.