2

I have data from several runs of a numerical modeling tool. The data always has the same structure - e.g. fixed set of rectangular vector tiles - no matter if there is a "valid" output or zero.

It looks like this (I only put some random data inside):

polygon data in QGIS

The attributes also always have the same names - "cell", "value" and "maximum" where "cell" is ID of particular vector tile:

enter image description here

I am probably going to have several tens or hundreds of such datasets and I was asked if it is possible to join them into one vector layer with several attribute columns for each model run.

The ways to merge shapefiles do not expect same geometries so I would probably end with unnecessary overlapping tiles... while the vector tiles remain the same and only the attribute values change.

I would probably be able to put together some CLI linux script first converting all the DBF files to CSV and somehow rename the column names based on the filename to avoid conflicts and finally join it with the geometries - in QGIS, maybe or some sort of geodatabase...

Or is there any better way to do this?

PS: can share some testing data if it helps

5
  • I'm puzzled when you say "... with several attribute columns..." Could you be more specific? How many is several? What data would you expect in those columns?
    – Stu Smith
    Commented Aug 6, 2020 at 20:14
  • @StuSmith that instead of having let s say 100 shp files - all with the same tiles, but different numbers in "value" attribute column I would have one shp (or gpkg) file with the tiles and 100 attribute columns like "value1", "value2" etc. taken from the input shp files.
    – Juhele
    Commented Aug 6, 2020 at 20:33
  • Will the output vector layers all have the same exact geometry?
    – Stu Smith
    Commented Aug 8, 2020 at 18:00
  • How do you id each model run?
    – Stu Smith
    Commented Aug 8, 2020 at 18:02
  • @StuSmith yeah for the "same" scenario (same source and area in various conditions, time etc.) the model uses same geometry. It also somehow numbers the output files.
    – Juhele
    Commented Aug 20, 2020 at 17:02

1 Answer 1

1

Assuming you find a way to convert dbf to csv (this link shows how to do it from the command line using LibreOffice), you could then use the Linux join command from a script to merge one file at a time. You would use something like sed to deal with renaming the column headings. You could then do a join in Qgis to reconnect the data to the geometry. (Or to be really crufty, convert the final merged csv back to a dbf with the same name as one of your input files.)

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.