1

I have a GeoJSON file from an upstream provider that uses multiple feature "rows" to represent disjoint boundaries of what I need to treat as a single feature.

For example in the dataset that can be previewed at https://data.cityofchicago.org/Education/Chicago-Public-Schools-High-School-Attendance-Boun/8vea-73uh and downloaded at https://data.cityofchicago.org/Education/Chicago-Public-Schools-High-School-Attendance-Boun/is3f-j4ke you can see that "HIRSCH HS" (to pick one such case) has three attribute rows all with school_id of 609712 linked to three separate polygons for its boundary.

Screenshot of linked website, with multiple "Hirsch HS" popups open on its preview map

I want to gather all "matching" features — in this case whenever the school_id column has the same value — and merge the geometries of each such group into one feature. Is this possible do (in a semi-automated fashion) using the QGIS user interface?

[And yes in this example it looks like technically each row is already a "multipolygon" but regardless I want to aggregate duplicate attribute rows together into one single multipolygon so that I have only one unique feature for each underlying row ID.]

1 Answer 1

2

You want to make one polygon separated by school_id, right?

Use the dissolve tool in QGIS.
It can be found in the Vector menu -> Geoprocessing Tools -> Dissolve.

Just select the school_id as the dissolve field.

If you only want to work with features with duplicate school_id, use the select by expression to select them.
The condition is COUNT(1, "school_id")>1.

2
  • Yes, I want to make one MultiPolygon per unique school_id if that's what you mean by "one polygon separated". So I might have 15 polygons in the input file, but only 10 actual schools, and I want to join all polygons only if they share the same identifier value. So I get one multipolygon per school → i.e. 10 features out. I'm guessing that's what the "dissolve field" is for then and will try it out soon, thanks!
    – natevw
    Feb 25, 2022 at 21:49
  • Confirmed, yes! The QGIS tool does exactly what I wanted with the "dissolve field". The dissolve tool creates a new layer, looking at the field I choose to keep separate features unless the value matches.
    – natevw
    Feb 25, 2022 at 21:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.