QGIS – Merge Shapefiles with Disparate Attributes and Keep Both

censusqgisshapefileunionvector-layer

I have two shapefiles of NYC–one of city council districts and another shapefile of the census blocks inside NYC. I want to merge these two shapefiles so that I can see what blocks lie inside of each census district in NYC.

districts

blocks

Ideally, I want to merge them in a way that results in a shapefile with an attribute table that has both the blocks and districts listed. Here are the current attribute tables:

block attributes

district attributes

When I tried to simply merge them using vector>data managementment>merge vector layer I get a shapefile that includes both geometries, but only displays districts, and the resulting attribute table is full of null values.

Here is that attribute table:

enter image description here

Best Answer

The simplest would be a spatial join, Vector->Data Management Tools->Join Attributes by Location. I think this would accomplish your needs. The information you want can be seen by using the Identify Tool, or the Attribute Table, or by exporting a new layer with the attributes you want.

Another option is either Intersect or Union. This is a bit messier and would probably need some cleanup to deal with sliver polygons, etc. As a secondary action Dissolve would clean it up if you want to simplify them afterwards, but I'm not sure this is what you are looking for.

Related Question