1

I am using QGIS 3.16.12.

I have a dataset of 150 retail companies, each selling a product over 100 counties across the country. This dataset also includes data on the number of sales per county for each company. I merged this dataset into the U.S counties shapefile. Below is an snapshot of the shapefile attribute table.

enter image description here

I’d like to create a map per company (150 maps in total) using Atlas that indicates the number of sales across the U.S. For instance, when I generate company A's map using the entire country's map (like the snapshot below), I'd like to see the number of sales at the county level that it operates regardless of how many counties it's operating in. In order words, I don't want the maps get zoomed into only the counties that it operates, but rather I want to see it across the entire country's map so I can do a comparison between companies country wide like this:

enter image description here

Could you please tell me what steps I need to do next in order to achieve what I am intending to do? because when I select the shapefile mentioned above in Atlas as coverage layer and Company_ID as page layer, it doesn't uniquely identify each company like the image here:

enter image description here

2 Answers 2

0

Atlas is the right tool for that.

You have tree different layer :

  1. County as polygon with a unique id named county_id
  2. Retail company as table (or geographic feature) with unique id named company_id
  3. Sales per county per company as a table (the Excel snapshot you shared)

You have to build a geographic layer containing your sales, you will duplicate every county to get one for every company. For this you have to use the tool Join attribute by field value with county as Layer 1, county_id as table field, sales as layer 2 and county_id as table field with the option **create separate feature for each matching feature (one-to-many).

enter image description here

With this tidy layer, you only have to filter only the feature that match the company_id for each atlas page. Create a layout with the map of the US, activate atlas rendering with company as coverage layer. Then you have different options, one is to activate a filter on your sales geographic layer (right click => Filter). The formula should be : attribute(@atlas_feature, 'company_id') = "company_id".

Test it and adjust the styling rules to fit all your cases.

3
  • Thanks, @Corentin! The formula you provided was definitely part of the answer. The steps I took to resolve this issue was: 1) I split the U.S map into 4 parts and created one separate shapefile (with Alaska, PR, etc.) for each. I used the U.S map as shown above as the "zoom in" layer as explained here link. Next, used this comments link here to create a polygon per company (used that as coverage layer)
    – Z N
    Jun 23, 2022 at 15:16
  • Then because I work with multiple shapefiles, and the coverage layer is different than the shapefile (county layer) where the sales data are coming from, I used this link and this linkcomments to make a link between the county layer data and atlas which is what you have referred to in your response, @Corentin!
    – Z N
    Jun 23, 2022 at 15:23
  • Great if it has been useful to you @ZN . I was thinking that you always want the same map extent and just changing the data shown on the map. I didn't understand all your comment but I think you have done something to get different zones depending on retail company. Jun 24, 2022 at 7:38
0

If I understand correctly, you've got a set of polygons representing each county and the sales figures for each company which do not necessarily cover every county (as in some companies do not sell to certain counties so there are no figures for them). My guess would then be to have a set of attributes for each polygon (sales_copmany_a, sales_company_b etc) and in counties where the company does not sell, populate them with 'NULL' or simply leave them empty.

Finally, in the layer symbology, you can choose the "Categorized" option and import all values of each attribute (sales_copmany_a, sales_company_b etc) then choose either not to show the counties where there are no sales figures (by simply deleting the "all other values" category) or apply some specific symbology to them (grey or hashed) like the image below.

enter image description here

1
  • thanks so much for your response. I am sorry that I wasn't very clear in my question. I edited my question above, and hope it is more clear now.
    – Z N
    Jun 17, 2022 at 17:33

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.