I downloaded Census Tract shape file data from the US Census for the state of Maryland. There are ~1400 census tracts. This is a vector layer in QGIS.

I have a separate CSV that has 84 census tracts. I only want these 84 tracts to show and remove the rest of the census tracts. I've tried filtering in the attributes table but haven't found a way yet. Is there a way to match the list of 84 census tracts with the ~1400 census tracts shape file and remove the rest?

  • 1
    Certainly both files have an ID, most likely a name, which you can use to select by attribute.
    – Erik
    Apr 7, 2020 at 7:09

1 Answer 1


Assuming you have a common ID in your Shapefile and your CSV file, you should perform a join in QGIS between the census tract layer and your csv [1]. Entities in your shapefile that don't have any correspondence in your CSV will have NULL values on the joined columns. This NULL value would help you to select only the entities that have a match, with a condition like "my_joined_column" is not null. Then you have two options:

1) Create a new shapefile with the desired entities: make a new selection of your data using the selection tools and save them as a new layer by making a right-click on the layer in the layer tree panel and then choose "export -> save selected features as new layer".

2) Filter the visibility of entities in your layer with a condition. This can be done in the properties window of your layer, under the "source tab" you can use the query builder [2].

[1] https://docs.qgis.org/3.4/en/docs/user_manual/working_with_vector/vector_properties.html#joins-properties [2] https://docs.qgis.org/3.4/en/docs/user_manual/working_with_vector/vector_properties.html#query-builder

  • thank you so much!
    – nafcb10
    Apr 8, 2020 at 3:36

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.