3

I'm working with county data in a narrow table format with a WKT column. To simplify, if the headers are id, geo_level, metric, metric_unit, and metric_value, some entries for the county with id 5 are:

5 | county | area | square km | 500
5 | county | pop_married | percent | .7
5 | county | total_pop | people | 4,000
5 | county | per_immigrant | percent | .04
5 | county | households | residences | 2,900

Each county has twenty-eight rows, one for each of the twenty-eight metrics I'm tracking across all counties. So when I load it as a delimited text layer, QGIS renders 28 polygons for each county, stacked exactly on top of one another.

I'd like to be able to visualize specific metrics for each county ("here's % married from county to county", "here's population from county to county"). But visualizing with categorized or graduated symbols in the layer properties doesn't work, because the values in the metric_values are all in different units.

Is there a way to specify what row you'd like the visualization to come from? Or to specify based on a specific string in the desired row?

1

The problem is in your data structure, you need to fix it, or workaround it.

QGIS expects one row per feature with several columns as different attributes. So, option one would be to rearrange the data so that each country only has one row with many attributes. This would be my choice if I had to do many maps or if you need to combine different metrics.

Option two, is to filter the rows you need, before you use them in the Categorised or graduates renderers. So, for instance, right-click the layer's name and select Filter. Set something as:

"metric" = 'area'

Now, you should now have a layer of 28 countries only with the area metric that you can use in any symbol renderer.

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.