0

I have a shapefile, clean_intersection, representing a geographic area. I'm trying to add additional columns to the attribute table showing the evapotranspiration (ET) for each element of my map, clean_intersection.

I used the "simplify geometry" tool to simplify clean_intersection enough to handle in Excel, where I created a .csv file to add a couple columns to the attributes table. Then I used "add delimited text layer" to return the .csv file to QGIS now as "clean_simple_data." Clean_simple_data is a shapefile with the data I want but with simplified geometry polygons. I'm now trying to join clean_simple_data with clean_intersection to generate a shapefile with detailed boundaries (like clean_intersection) but with the additional columns from the clean_simple_data attribute table.

To accomplish this join, I try: image of join attributes by location dialogue

This creates a joined layer. However, the attribute table of the joined layer has many repeated values: image of attributes table showing repeated value

The "ICA" value of 6.633 is correctly paired with the ET value of 1.12, but it is assigned to too many rows. Here's a screenshot of the Excel .csv file showing how there should be many different values instead of a few repeated values in the ICA and ET columns.

this is what it should look like

Originally I had many more columns of data that I was attempting to join but I pared the .csv file down which seemed to help but did not resolve the issue. I have also tried many different variations of the geometric predicates available in the "Join attributes by location" dialogue, to no avail. I am running QGIS 2.18.

Does anyone have any insight?

0

You are doing a join on three spatial predicates - contains, touches and overlaps. So one polygon is likely being joined to multiple other polygons. Also because you are simplifying the geometries there will be some polygons that may now overlap others that you did not realise depending on which vertices are removed to do the simplifocation.

Secondly why export to excel to add a field? Why not add the fields to the original shapefile? Or create a sepeate CSV with IDs of polygons from the shapefile and populate new columns in excel and then join this aspatial table to the shapefile. That is if you need excel to populate those columns?

  • "Or create a sepeate CSV with IDs of polygons from the shapefile and populate new columns in excel and then join this aspatial table to the shapefile." This worked great. I used this tutorial which walks you through the process of joining an aspatial table. Used TextEdit to create the .csvt. – qwerk Jun 6 '18 at 16:56
0

I'm not sure to good understand, but he seems to me that it's better to join your date with a join on a field.

  • First, create a new field with a unique ID for clean_intersection (Field Calculator, expression "row_number"), save
  • Save your layer in excel format (save as)
  • Create the fields in excel for the evapotranspiration, save and close
  • use the extension "Spreadsheet Layers" to import excel file ( or with "add delimited text layer")
  • Do a join with the table in the Layer properties of clean_intersection. The join is your field ID.

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.