Bug report #7976

Merging Shapefiles Fails to Merge Attribute Tables.

Added by Jamie none almost 11 years ago. Updated almost 10 years ago.

Status:Closed
Priority:Normal
Assignee:-
Category:-
Affected QGIS version:1.8.0 Regression?:No
Operating System:OS X QGIS 1.8 Easy fix?:No
Pull Request or Patch supplied:No Resolution:
Crashes QGIS or corrupts data:No Copied to github as #:16833

Description

I'm not sure if this have been solved, or if there's a workaround. I have two shapefiles with different attribute tables. After merging the two shapefiles, the attributes are null where no attributes existed before.

I'm trying to merge two layers that are each polygons. Region A encompasses multiple region b's.. I want to link all of the smaller regions inside Region A, to Region A. so I can manipulate this data.

If Region A is comprised of B1, B2 and B3, the merged attribute table should reflect this after merging. Right now when using MMQGIS or Vector Data Managment Tools (merge shapefiles to one), the attribute table simply combines the attributes of tables from each shapefile, but neglects to link shapefiles to the geometries they reside within.

Any Solutions to this?

largedist.zip - largedistricts (4.26 MB) Jamie none, 2013-06-03 03:59 AM

History

#1 Updated by Giovanni Manghi almost 11 years ago

  • Status changed from Open to Feedback
  • Priority changed from High to Normal

what is the exact tool are you using? vector -> data management -> merge shapes into one?

#2 Updated by Jamie none almost 11 years ago

Vector -> Data managment tools -> Join Attributes by Location . That's the tool i'm using.

When I use that tool, it merges the attributes from both polygon layers, but some of the attributes are incorrect. By incorrect, the attribute assumes a value of an adjacent polygon as opposed to the one it resides in.

When I use the tool Plugins -> mmqgis -> transfer -> merge layers. All of the attribute fields from Region B polygon are empty, yet Region A attribute is intact. The benefit of this is that all Region B polygon's inside the corresponding Region A polygon are correct. The previous example using Join Attributes by Location maintains the attribute data from both, but some of the attribute data is wrong.

How can I associate polygons from smaller regions inside a larger containing region while merging attribute data correctly?

#3 Updated by Giovanni Manghi almost 11 years ago

Jamie none wrote:

Vector -> Data managment tools -> Join Attributes by Location . That's the tool i'm using.

When I use that tool, it merges the attributes from both polygon layers, but some of the attributes are incorrect. By incorrect, the attribute assumes a value of an adjacent polygon as opposed to the one it resides in.

you should share a sample of your data, pointing to an actual error in the result. Is this possible?

When I use the tool Plugins -> mmqgis -> transfer -> merge layers. All of the attribute fields from Region B polygon are empty, yet Region A attribute is intact. The benefit of this is that all Region B polygon's inside the corresponding Region A polygon are correct. The previous example using Join Attributes by Location maintains the attribute data from both, but some of the attribute data is wrong.

a Join and a merge are two different operations, so different result are expected anyway.

#4 Updated by Jamie none almost 11 years ago

Thanks Giovanni, I've attached one of the results, perhaps this will be helpful.

The Largedist.zip file contains the large districts. The Smalldist.zip file contains the smaller districts, that should be merged/associated inside the larger districts. The two input files are combined together to produce Result.zip.

You'll notice that when using the identify features tool on the result.zip files, the identify result window produces a visually accurate result proper large districts are highlighted with smaller districts inside, however the attribute table has some small districts listed as being in the big district, which actually fall outside of the large district.

Moreover, when looking at the attribute table, the first 203 results are the large districts, the ones that follow are the small districts. All I'm trying to do is associate multiple smaller districts with their parent district.

How can I accomplish this? Ideas/guidance is appreciated. I'll have to attach multiple files in multiple posts.

#5 Updated by Jamie none almost 11 years ago

small districts inside large district files

#6 Updated by Jamie none almost 11 years ago

I apologize for the confusion with multiple posts. The datasets are too large to upload, please see links below to obtain sample data.

http://www.cleanandgreenfuels.org/geotest/smalldist_insideLarge.zip <- small districts to be associated with larger districts.
http://www.cleanandgreenfuels.org/geotest/largedist.zip <- large districts to include smaller districts.
http://www.cleanandgreenfuels.org/geotest/Result.zip - output from combining the two files.

#7 Updated by Giovanni Manghi almost 11 years ago

Jamie none wrote:

I apologize for the confusion with multiple posts. The datasets are too large to upload, please see links below to obtain sample data.

http://www.cleanandgreenfuels.org/geotest/smalldist_insideLarge.zip <- small districts to be associated with larger districts.
http://www.cleanandgreenfuels.org/geotest/largedist.zip <- large districts to include smaller districts.
http://www.cleanandgreenfuels.org/geotest/Result.zip - output from combining the two files.

hi,

the input layers (and the result too) have names that does not help understand what to do (using your desciption). Also the input layers do not have any attribute, so again it is not easy to understand what is wrong (if anything is wrong).

anyway it really seems that what you need is the "join by location tool", but without any attribute in the sample inputs it is hard to say if something is wrong.

#8 Updated by Jamie none almost 11 years ago

sorry about the confusion. I wanted to merge the only attribute in the large region shapefile with the attributes contained in the small region shapefile. So the result showed the smaller regions belonging to the larger one.

The intersection tool worked for this. Initially i tried to Join Attributes by location, but this joined smaller regions into larger regions they were adjacent to as opposed to the ones they resided in.

mmqgis merge layers worked better, but it did not preserve the data from the smaller regions. it merely associated the larger regions with the smaller region, and nothing else. All other attributes were wiped out.

#9 Updated by Alexander Bruy about 10 years ago

Closed for the lack of feedback

#10 Updated by Jürgen Fischer almost 10 years ago

  • Status changed from Feedback to Closed

Also available in: Atom PDF