How to Make Maps Using Mapping Software (QGIS)
       |           

Welcome, Guest. Please login or register.
Did you miss your activation email?
March 28, 2024, 09:59:10 AM
News: Election Simulator 2.0 Released. Senate/Gubernatorial maps, proportional electoral votes, and more - Read more

  Talk Elections
  About this Site
  Talk Elections Q & A
  How To (Moderator: Virginiá)
  How to Make Maps Using Mapping Software (QGIS)
« previous next »
Pages: [1] 2 3
Author Topic: How to Make Maps Using Mapping Software (QGIS)  (Read 22326 times)
cinyc
Atlas Icon
*****
Posts: 12,721


Show only this user's posts in this thread
« on: October 30, 2017, 10:46:23 PM »
« edited: November 04, 2017, 05:51:07 PM by cinyc »

Some posters have asked me for a tutorial on how to make election maps without tediously using paint. I've taught a few others before, so I thought I'd put up a post here.

In general, you need a few things to make maps:

1) A GIS mapping program - either free (QGIS, MapWindow GIS, Saga GIS) or paid (ArcGIS). In these tutorials, we will be using QGIS.
2) Shapefiles of the map you're looking for. The Census Bureau has shapefiles for the most common map types - States, Counties, County Subdivisions and Congressional/Legislative Districts. Some states/municipalities provide shapefiles for precincts.
3) Color styles for your mapping program. You can generate these on your own - or, eventually, I'll provide a link to a zip of mine for QGIS.
4) Excel and/or Open Office Calc (free).  Unlike Excel, Open Office Calc allows you to save .dbf files. Excel doesn't. If you decide to only use Open Office Calc, commands are slightly different than those used in this tutorial (for example, semicolons replace commas in formulas).

Where to find these items:

1) I'm currently using QGIS 2.18 for my maps, which is available for download here.
2) There are many different sources for shapefiles. Census' Tigerline Shapefiles are available here. As jimrtex states below, the Tigerline files are not simplified, which leads to wider lines.
3) [To Come]
4) Open Office is avalable for download here. You have to buy Microsoft Excel.

-------------------------------------------------------------------------------------------------------------

There are a number of ways to make maps. The easiest, most professional method is probably jimrtex's method, detailed in Reply #7 and replicated with pictures below, with modifications suggested by @PrdNewEnglander on Twitter. That does not involve manipulating the .dbf files. My method, also detailed below, requires Open Office Calc and manipulating .dbf files.

For both methods in the first half of this tutorial, we'll use the following:
1) Census' 2016 1:5,000,000 County Shapefile (.zip) You'll need to unzip this file before using it. Please put it somewhere where you can find it!
2) countychange.xlsx, County Estimate data downloaded from the Census Bureau's American Factfinder website as a .csv file and converted to an Excel file for your convenience.
3) QGIS
4) Open Office (cinyc Method 2 only)
5) The Atlas 5 Percent Heatmap Color Scale, 5 PCT Gradation Heat with Zero.qml
------------------------------------------------------------------
jimrtex Method 1:

This is what jimrtex did to set up this excerise: He got a (.csv) file from American Fact Finder with the 2016 county estimates. He converted (saved) this as an .xlsx file (countychange.xlsx), which we will use as the working file.

Step (1a): Add four columns:

M2 = TEXT(B2,"00000")
N2 = E2             ! Population April 2010 Base
O2 = L2             ! Population July 2016 Estimate
P2 = O2/N2 - 1   ! Relative change 2010 to 2016

Copy the formula down the columns.

Row 1 of Columns M-P is blank. In Row 1 of those columns, add column titles:

ID, POP10, POP16, INCREASE

When this step is complete, your spreadsheet should look something like this:



(1b) Save your Excel Spreadsheet by hitting CTRL-S or clicking on File-->Save.

(1c) Converting the new data to a separate CSV file is one method of importing the data into QGIS. It allows you to define the type of data in each column with specificity. This is described in Step 2 below. If you don't want to do this, skip to Step 3.

(2a) Change the format of column T values to % with two decimal places. (If you're new to Excel, you can do this a number of ways. One way is to left click to select column T, right click, select "Format Cells", select "Percentage" from the dialog, then hit "OK" on the bottom of the dialog.)

(2b) Create a blank spread sheet with four columns. (If you're new to Excel, you can do this by either typing CTRL-N or hitting Select File-->New-->Blank Worksheet.)

Copy columns M,N,O,P from countychange.xlsx (You can Left Click and hold to select columns M-P and hit CTRL-C or Right Click and select Copy from the drop down menu).  Paste VALUES to columns A, B, C, D of new spreadsheet. This loses the formatting of the increase column, but that is OK. (As you can see below, you can paste values by right clicking and hitting the highlighted clipboard with 123 or clicking on Paste Special from the drop-down menu, then selecting "Values" and hitting OK on the next prompt):



Row 1 is blank. In Row 1, add column titles:

ID, POP10, POP16, INCREASE

(2c) Save new spreadsheet as .csv file countychange.csv. (Type CTRL-S or select File-->Save As, then type "countychange" and select CSV from the drop-down menu).

(2d) Create a file with the type of .csvt countychange.csvt.

This is a text file that can be created in Notepad, that provides the format of each field of the .csv file. The contents of the .csvt file should be:

"String","Integer","Integer","Real"

Next, select File-->Save As. As you can see in the image below, you first need to change the "Save As Type" from "Text Documents" to "All Files" by clicking on the down arrow near red circle 1. Then type "countychange.csvt" as the filename, and click on "Save":



If you have difficulty creating the .csvt file, you can always create it as a .txt file and rename it in File Explorer. The path and name of the .csv and .csvt file must match, so make sure to save it in the same folder as countychange.csv.

We've now prepared the data to be merged with Census' County Shapefile.  Next, open QGIS:

(3) Create a new project using the blank page icon in the upper left.
(4) Drag the cb_2016_us_county_5m.shp file into the map area or click on the dotted V icon on the left of the screen or hit CTRL-Shift-V and browse for that file.
(5) Save the project as, using the diskette icon in the upper left. Make sure you select a directory you can find. This will create a .qgs file which is your project context. Be sure to save this from time to time. If you exit QGIS (or worse it crashes), you can get back to where you were at.

The screenshot shows where the icons described in Steps 3-5 are and what your map should look like, in case you're lost. If you don't see these icons, you need to make sure that you're not hiding the correct toolbars:



Since you now have a map, we should probably show how to move around, select, and set the projection. But for now I will skip to the join.

If you didn't create a .csv file:
(6a) Open countychange.xlsx as a vecrtor layer You can click on Layer --> Add Layer --> Add Vector Layer; but it is far easier to click on the V icon in the far left of the screen.
(6b) Browse for the .xlsx file. Select "All Files" or "MSL Office Open XML Spreadsheet" from the drop down menu on the Browse dialog. Otherwise, you might not be able to find your spreadsheet.
(6c) Hit Open.

If you're lost, these steps are annotated in the picture below:


If you created a .csv file:
(7a) Open the .csv file as a layer. You can click on Layers --> Add Layer --> Add Delimited Text Layer; but it is far easier to click on the Comma icon in the far left of the screen.
(7b) Browse to the .csv file.
(7c) Click on the No Geometry radio button (near the mid-bottom right)
(7d) Click on the OK button.

See the annotated image below if you're lost:


(8) Join the data layer to the county layer:

(8a) Right Click on cb_2016_us_county layer, and select Properties
(8b) Select Joins
(8c) Select Green Plus Sign to add Join
(8d) Select layer to join (the csv or xlsx layer)
(8e) Specify join field (ID is the name we gave to the first field in the csv file and a later field in the xlsx file)
(8f) Specify the target field in the county layer (GEOID)
(8g) Click on OK

This completes the join. Again, see the image below, if you're lost:



(9) Verify Join.
(9a) Make sure county layer is current layer.
(9b) Click on light blue icon that looks like Vermont or Connecticut mortgage card in Monopoly.
(9c) The new fields should be shown.

If you're not familiar with Monopoly, the mortgage card is the icon below the B in the picture below:



Note that it is quite easy to update/make corrections/add fields.

(10) Select csv layer, right click and Remove, and confirm removal. This will eliminate joined fields.
(11) In xlsx file add new column U2 = S2-R2   ! Numeric change 2016-2010
(12) Copy and paste values from xlsx column U to csv column E. Add name of column in E1 (CHANGE)
(13) Save CSV file.
(14) Add field type to csvt file ,"Integer"

(15) Redo Join.

If you've used this method, skip to Map Coloring Instructions in Reply #15 below for info on how to color the counties.
------------------------------------------------------------------
I'm running out of characters in this post. For the cinyc Method 2, click here for Reply #14.
Logged
jimrtex
Atlas Icon
*****
Posts: 11,828
Marshall Islands


Show only this user's posts in this thread
« Reply #1 on: October 31, 2017, 03:21:02 AM »

Some posters have asked me for a tutorial on how I make my election maps without tediously using paint. I've taught a few others before, so I thought I'd put up a post here.

You need a few things to make maps:

Quote
You must be logged in to read this quote.

Excel can open .dbf files, it has disabled writing/updating .dbf files. Microsoft claims that there is something fundamentally flawed with the format, such that they can't reliably produce .dbf files. dBase might have at one time been considered a competitor with Office. dbf files exist because that was what ESRI had available when they invented shapefiles. You really don't need to access the .dbf files directly.

Quote
You must be logged in to read this quote.
For this application I would use the cartographic boundary files. These have been simplified. The basic files have too much detail, and crooked boundaries such as rivers may be rendered as thicker lines.

2016 1:5,000,000 County Shapefile (.zip)

Quote
You must be logged in to read this quote.
How was the second column generated?

Logged
cinyc
Atlas Icon
*****
Posts: 12,721


Show only this user's posts in this thread
« Reply #2 on: October 31, 2017, 07:52:03 AM »

Some posters have asked me for a tutorial on how I make my election maps without tediously using paint. I've taught a few others before, so I thought I'd put up a post here.

You need a few things to make maps:

Quote
You must be logged in to read this quote.

Excel can open .dbf files, it has disabled writing/updating .dbf files. Microsoft claims that there is something fundamentally flawed with the format, such that they can't reliably produce .dbf files. dBase might have at one time been considered a competitor with Office. dbf files exist because that was what ESRI had available when they invented shapefiles. You really don't need to access the .dbf files directly.

Yes, there is a way merge the data using QGIS, but I always run into the leading zero issue. For some reason, QGIS tends to read the states with a GEOID of 01-09 as a number, mismatching those states (in other words, 01001 becomes 1001, and the data doesn’t merge). Do you have an easy fix for that?

Quote
You must be logged in to read this quote.
For this application I would use the cartographic boundary files. These have been simplified. The basic files have too much detail, and crooked boundaries such as rivers may be rendered as thicker lines.

2016 1:5,000,000 County Shapefile (.zip)[/quote]

Fair point.

Quote
You must be logged in to read this quote.
How was the second column generated?


[/quote]

The second column is random.  I assigned a number from 1 to 3233 to each county, in the order in which Census’ shapefile laid them out, then divided by 3233. That’s why if the =sumif function is done correctly, the second column continuously increases from 0 to 1, but the county colors vary.
Logged
muon2
Moderators
Atlas Icon
*****
Posts: 16,788


Show only this user's posts in this thread
« Reply #3 on: October 31, 2017, 12:40:02 PM »

Thanks for putting this in the How To. If you'd like it stickied I'm sure that can be arranged between the board moderator and myself.
Logged
jimrtex
Atlas Icon
*****
Posts: 11,828
Marshall Islands


Show only this user's posts in this thread
« Reply #4 on: October 31, 2017, 06:48:12 PM »

3) Open Office (free) or a similar program that allows you to save and open .dbf files. Excel doesn't.

Excel can open .dbf files, it has disabled writing/updating .dbf files. Microsoft claims that there is something fundamentally flawed with the format, such that they can't reliably produce .dbf files. dBase might have at one time been considered a competitor with Office. dbf files exist because that was what ESRI had available when they invented shapefiles. You really don't need to access the .dbf files directly.

Yes, there is a way merge the data using QGIS, but I always run into the leading zero issue. For some reason, QGIS tends to read the states with a GEOID of 01-09 as a number, mismatching those states (in other words, 01001 becomes 1001, and the data doesn’t merge). Do you have an easy fix for that?
Census ID's are both strings and numbers, but can be manipulated as numbers. The county ID is composed of a State ID and a County ID within a state. Harris County, Texas is "48201", where "48" is the state code for Texas, and "201" is the code for

The DBF file keeps the field type as string. The csv files produced by the Census Bureau for American Fact File does not have data types. You can think of a csv file as a crude form of data base that does not include metadata such as data types. When you open a csv file into Excel it determines data type by looking at the data values. 48201 and 01001 look like numbers, and stored as 48201 and 1001, and displayed as numbers (right justified by default).

There is another problem with leading zeros in GQIS, because of its unixy/c background. A number with a leading 0 denotes an octal number:  030 = 24 is TRUE.

Anyhow what we need to do is store the ID as a string, which is easy enough by using the expression
=TEXT(A1,"00000") which converts a number to a string with at least 5 digits including leading zeros if necessary.
Logged
jimrtex
Atlas Icon
*****
Posts: 11,828
Marshall Islands


Show only this user's posts in this thread
« Reply #5 on: October 31, 2017, 07:08:32 PM »

9) Open tl_2017_us_county.shp in QGIS. You can probably do this by clicking on the file. If not, open QGIS, and either hit CTRL-Shift-V or select Layer-->Add Layer-->Add Vector Layer from the drop-down menu, as you can see in the image below:

I would do this step first. I normally open shapefiles by dragging them into QGIS.

So once you have downloaded QGIS and installed it:

(1) Open QGIS.
(2) Click on the blank page icon in the upper left corner to open a new project, and drag the .shp file into the map panel (big white space).
(3) You have drawn your first map.
(4) Let us know that you are reading this.


Logged
cinyc
Atlas Icon
*****
Posts: 12,721


Show only this user's posts in this thread
« Reply #6 on: October 31, 2017, 11:26:15 PM »
« Edited: October 31, 2017, 11:42:35 PM by cinyc »

Census ID's are both strings and numbers, but can be manipulated as numbers. The county ID is composed of a State ID and a County ID within a state. Harris County, Texas is "48201", where "48" is the state code for Texas, and "201" is the code for

The DBF file keeps the field type as string. The csv files produced by the Census Bureau for American Fact File does not have data types. You can think of a csv file as a crude form of data base that does not include metadata such as data types. When you open a csv file into Excel it determines data type by looking at the data values. 48201 and 01001 look like numbers, and stored as 48201 and 1001, and displayed as numbers (right justified by default).

There is another problem with leading zeros in GQIS, because of its unixy/c background. A number with a leading 0 denotes an octal number:  030 = 24 is TRUE.

Anyhow what we need to do is store the ID as a string, which is easy enough by using the expression
=TEXT(A1,"00000") which converts a number to a string with at least 5 digits including leading zeros if necessary.

I just tried that and still end up with NULLs in the 01-09 states' counties when trying to join the =Text column with the GEOIDs from the original .dbf in QGIS.  Is this a limitation in QGIS, or am I doing something wrong?

Edit: I think I figured out a fix by virtually creating another GEOID column, GEOIDFIXED, defined as a text column, using the following formula, then joining GEOIDFIXED and the GEOID column from the .dbf file:

if(length("GEOID,C,5")=4,concat('0',"GEOID,C,5"),"GEOID,C,5")

This seems almost as complicated to explain as just manually manipulating the .dbf file, though - especially when we get to GEOIDs that are longer than 5 characters.
Logged
jimrtex
Atlas Icon
*****
Posts: 11,828
Marshall Islands


Show only this user's posts in this thread
« Reply #7 on: November 01, 2017, 04:16:33 AM »

Census ID's are both strings and numbers, but can be manipulated as numbers. The county ID is composed of a State ID and a County ID within a state. Harris County, Texas is "48201", where "48" is the state code for Texas, and "201" is the code for

The DBF file keeps the field type as string. The csv files produced by the Census Bureau for American Fact File does not have data types. You can think of a csv file as a crude form of data base that does not include metadata such as data types. When you open a csv file into Excel it determines data type by looking at the data values. 48201 and 01001 look like numbers, and stored as 48201 and 1001, and displayed as numbers (right justified by default).

There is another problem with leading zeros in GQIS, because of its unixy/c background. A number with a leading 0 denotes an octal number:  030 = 24 is TRUE.

Anyhow what we need to do is store the ID as a string, which is easy enough by using the expression
=TEXT(A1,"00000") which converts a number to a string with at least 5 digits including leading zeros if necessary.

I just tried that and still end up with NULLs in the 01-09 states' counties when trying to join the =Text column with the GEOIDs from the original .dbf in QGIS.  Is this a limitation in QGIS, or am I doing something wrong?

Edit: I think I figured out a fix by virtually creating another GEOID column, GEOIDFIXED, defined as a text column, using the following formula, then joining GEOIDFIXED and the GEOID column from the .dbf file:

if(length("GEOID,C,5")=4,concat('0',"GEOID,C,5"),"GEOID,C,5")

This seems almost as complicated to explain as just manually manipulating the .dbf file, though - especially when we get to GEOIDs that are longer than 5 characters.
Did you create a layer for the .csv file?

This is what I did. I got a (.csv) file from American Fact Finder with the 2016 county estimates. I converted (saved) this as an .xlsx file (countychange.xlsx). I'll use this as my working file.

I added four columns:

Q3 = TEXT(B3,"00000")
R3 = E3             ! Population April 2010 Base
S3 = L3             ! Population July 2016 Estimate
T3 = S3/R3 - 1   ! Relative change 2010 to 2016

Copy the formula down the columns. I Changed the format of column T values to % with two decimal places.

Create a blank spread sheet, with four columns. In Row 1, add column titles:

ID, POP10, POP20, INCREASE

Copy columns Q,R,S,T from countychange.xlsx and paste values to columns A, B, C, D of new spreadsheet. This loses the formatting of the increase column, but that is OK.

Save new spreadsheet as .csv file countychange.csv.

Create a file with the type of .csvt countychange.csvt.

This is a text file that can be created in Notepad, that provides the format of each field of the .csv file. The contents of the .csvt file should be:

"String","Integer","Integer","Real"

If you have difficulty creating the .csvt file, create it as a .txt file and rename it in File Explorer. The name of the .csv and .csvt file must match.

Do the following:

(1) Open QGIS
(2) Create a new project using the blank page icon in the upper left.
(3) Drag the county .shp file into the map area.
(4) Save the project as, using the diskette icon in the upper left. Make sure you select a directory you can find. This will create a .qgs file which is your project context. Be sure to save this from time to time. If you exit QGIS (or worse it crashes), you can get back to where you were at.

Since you now have a map, we should probably show how to move around, select, and set the projection. But for now I will skip to the join.

(5) Open the .csv file as a layer. You can click on Layer > Add Layer > Add Delimited Text Layer; but it is far easier to click on the Comma icon in the far left of the screen.

(5a) Browse to the .csv file.
(5b) Click on the No Geometry radio button (near the mid-bottom right)
(5c) Click on the OK button.

(6) Join the csv layer to the county layer.

(6a) Right Click on county layer, and select Properties
(6b) Select Joins
(6c) Select Green Plus Sign to add Join
(6d) Select layer to join (the csv layer)
(6e) Specify join field (ID is the name we gave to the first field in the csv file)
(6f) Specify the target field in the county layer (GEOID)
(6g) Click on OK

This completes the join.

(7) Verify Join.
(7a) Make sure county layer is current layer.
(7b) Click on light blue icon that looks like Vermont or Connecticut mortgage card in Monopoly.
(7c) The new fields should be shown.

Note that it is quite easy to update/make corrections/add fields.

(8) Select csv layer, right click and Remove, and confirm removal. This will eliminate joined fields.
(9) In xlsx file add new column U3 = S3-R3   ! Numeric change 2016-2010
(10) Copy and paste values from xlsx column U to csv column E. Add name of column in E1 (CHANGE)
(11) Save CSV file.
(12) Add field type to csvt file ,"Integer"

(13) Redo Join.
Logged
jimrtex
Atlas Icon
*****
Posts: 11,828
Marshall Islands


Show only this user's posts in this thread
« Reply #8 on: November 01, 2017, 04:27:10 AM »

(6) Join the csv layer to the county layer.

(6a) Right Click on county layer, and select Properties
(6b) Select Joins
(6c) Select Green Plus Sign to add Join
(6d) Select layer to join (the csv layer)
(6e) Specify join field (ID is the name we gave to the first field in the csv file)
(6f) Specify the target field in the county layer (GEOID)
(6g) Click on OK

This completes the join.

(7) Verify Join.
(7a) Make sure county layer is current layer.
(7b) Click on light blue icon that looks like Vermont or Connecticut mortgage card in Monopoly.
(7c) The new fields should be shown.

Footnote: The county shapefile includes Puerto Rico and the island areas (Virgin Islands, Guam, Northern Marianas, and American Samoa). Since our xlsx file does not include data for these areas (when I downloaded county estimates, I did US only) the joined fields for the territorial areas will be NULL.
Logged
cinyc
Atlas Icon
*****
Posts: 12,721


Show only this user's posts in this thread
« Reply #9 on: November 01, 2017, 12:24:06 PM »

Did you create a layer for the .csv file?

Yes, I created a layer for the .csv file - but I didn’t know to create a .csvt file. I’ll try that when I get to my computer tonight to confirm it works. I’m sure it does.
Logged
jimrtex
Atlas Icon
*****
Posts: 11,828
Marshall Islands


Show only this user's posts in this thread
« Reply #10 on: November 01, 2017, 01:26:14 PM »

Did you create a layer for the .csv file?

Yes, I created a layer for the .csv file - but I didn’t know to create a .csvt file. I’ll try that when I get to my computer tonight to confirm it works. I’m sure it does.
If there is no corresponding .csvt file, it uses a default for the data type (I think).

If you right click on a layer, and select Properties > Fields, it will show you the data types for the fields. QGIS might try to figure out data types based on data values. Since the IDs look like integers, the field would be assigned an integer.
Logged
jimrtex
Atlas Icon
*****
Posts: 11,828
Marshall Islands


Show only this user's posts in this thread
« Reply #11 on: November 01, 2017, 02:26:54 PM »

The next few messages will show how to project the data, and do some navigation and selection, and some basic editing.

If you drag the county shp file into the map area it should look like this: (to see this image full size, right click on the image, then select "View Image")



When you load a shp file, QGIS assigns a random color. It is like a box of chocolates, you never know what you are going to get.

Census coordinates are in longitude and latitude. Longitude west of Greenwich, and Latitude south of the equator are negative values. Because this shp file includes Alaska, the western Aleutians have positive longitudes, east of Greenwich. The largest X values are displayed on the far right.

This shp file also includes the island areas. Since Guam and the Northern Marianas are in the Eastern Hemisphere, they are also shown to the right (southwest of the western Aleutians. American Samoa is in the southern hemisphere, but east of 180W latitude, so it is displayed on the lower left, SSW from Hawaii (you may need to clean your screen). Puerto Rico and the US Virgin Islands are to the southeast of Florida.

When I took this screen shot, the cursor was pointing roughly towards Houston, and the Coordinates at the bottom: -95.9, 30.6 show where I was pointing (95.9W, 30.6N)
Logged
cinyc
Atlas Icon
*****
Posts: 12,721


Show only this user's posts in this thread
« Reply #12 on: November 01, 2017, 07:05:15 PM »
« Edited: November 01, 2017, 07:07:09 PM by cinyc »

As expected, I got the join to work with a .csvt file.

Do you mind if I put the relevant parts of Reply #7 in the first thread as the first of methods to make maps (the other being mine)? I'll add screenshots to illustrate.

Once you're done with your basic overview of QGIS, I'd like to add responses on how to calculate the WINCODE, how to use the Print Composer to make professional-looking maps, and (perhaps) how to make map gifs. (It doesn't seem like we have much of an audience for this How To, though).
Logged
jimrtex
Atlas Icon
*****
Posts: 11,828
Marshall Islands


Show only this user's posts in this thread
« Reply #13 on: November 01, 2017, 08:11:41 PM »

As expected, I got the join to work with a .csvt file.

Do you mind if I put the relevant parts of Reply #7 in the first thread as the first of methods to make maps (the other being mine)? I'll add screenshots to illustrate.

Once you're done with your basic overview of QGIS, I'd like to add responses on how to calculate the WINCODE, how to use the Print Composer to make professional-looking maps, and (perhaps) how to make map gifs. (It doesn't seem like we have much of an audience for this How To, though).
OK.

Maybe post links in Political Geography and International Elections and?  I was not aware of "How To"
Logged
cinyc
Atlas Icon
*****
Posts: 12,721


Show only this user's posts in this thread
« Reply #14 on: November 01, 2017, 10:11:14 PM »
« Edited: November 02, 2017, 07:50:18 AM by cinyc »

The cinyc Method 2:

1) Open up the unzipped cb_2016_us_county_5m.dbf file in Open Office Calc.

2) Copy the GEOID column E from the opened .dbf file. To do this, click on E and either hit CTRL-C or Right Click and select "Copy", as you can see in the image below:


3)  Open countychange.xlsx in Excel. Create a new sheet by clicking on the plus sign at the bottom of the page. Paste the column from Open Office to Column A of that new sheet. To do this, go to Cell A1 on Sheet1 and hit CTRL-V.

4) Click on the Data sheet. Add four columns to it:

Q2 = TEXT(B2,"00000")
R2 = E2             ! Population April 2010 Base
S2 = L2            ! Population July 2016 Estimate
T2 = S2/R2 - 1   ! Relative change 2010 to 2016

5) Switch back to Sheet1. Note that the GEOIDs from the test data and GeoIDs from Census' Shapefile are in a different order. We have to rectify this. I use a =sumif formula to get the color codes in Census' order.

-Type the following formula into Cell B2 on Sheet2: =sumif(Data!$Q$2:$Q$3221,$A2,Data!R$2:R$3221)
-Copy that formula to Cells C2 and D2.
-Copy that formula into Cells B3-B3234 on Sheet2. Hit CTRL-C after selecting cells B2-D2, then LEFT CLICK and scroll down from Cells B3 to B3234 (there's a shortcut to this - let me know if you want to know it). Note: The dollar signs in the formula are crucial to making sure the same formula gets cut and pasted in each row.
-Type "POP10,N,19,0","POP16,N,19,0","INCREASE,N,19,15" into Cells B1,C1 and D1 to give the columns a name.
 
6) Now it's time to cut and paste the new Color Code Column from Sheet1 into a new row in the .dbf file of Open Office Calc.
-Left Click and hold on the "B","C" and "D" at the top of Columns B-D to select Columns B-D in Excel and then press CTRL-C (or Right Click and Select Copy).
-Switch to Open Office Calc.  Select cell J1. RIGHT CLICK, then select "Paste Special-->Unformatted Text-->OK"

7) Save the .dbf file in Open Office Calc (CTRL-S or hit the diskette on the toolbar) and Excel. Open Office will warn you that some data might not be able to be saved in dbf format, and suggest another format. Select "Keep Current Format". Excel can't save in .dbf format - that's why you need Open Office. Also, save the .xslx file in Excel.

8) Close Open Office Calc.

Now, we're ready to open QGIS:

9) Open cb_2016_us_county_5m.shp in QGIS. You can probably do this by clicking on the file, or dragging the file to the big window on QGIS. If not, open QGIS, and either hit CTRL-Shift-V or select the V symbol on the left side of the screen, or select Layer-->Add Layer-->Add Vector Layer from the drop-down menu.

Hit "Browse", and find cb_2016_us_county_5m.shp on your computer.

Your screen should now look something like this:


10) Save the project as, using the diskette icon in the upper left. Make sure you select a directory you can find. This will create a .qgs file which is your project context. Be sure to save this from time to time. If you exit QGIS (or worse it crashes), you can get back to where you were at.
--------------------------------------------------------------------------
The next reply includes instructions on how to color the counties.
Logged
cinyc
Atlas Icon
*****
Posts: 12,721


Show only this user's posts in this thread
« Reply #15 on: November 01, 2017, 11:27:02 PM »

Map Coloring Instructions:

Note: This assumes you have cb_2016_us_county_5m.shp open in QGIS. If not, see the instructions for the method you used to learn how to do that.

1) To color the map:
(1a) RIGHT CLICK on cb_2016_us_county_5m in the Layer Panel and select "Properties" from the drop down map, as you can see in the image below:



(1b) The Layer Properties Dialog will appear. Select "Style" on the Left, then Style-->Load Style on the bottom left, as you can see in the picture below:



(1c) Load 5 PCT Gradation Heat with Zero.qml from where you saved it on your computer. The color scheme should load. The default variable isn't INCREASE. Change this to INCREASE by clicking on the down arrow next to PCT_FI_C60, selecting INCREASE and hitting OK on the bottom of the dialog, as you can see in the picture below:



(2) Congratulations! Your map is now colored in various shades of red and blue! It should look like this:



Unfortunately, your map's not perfect, and you might not know how to use QGIS to zoom in or whatever. jimrtex and I am working on more tutorials to tell you how to do that.
Logged
jimrtex
Atlas Icon
*****
Posts: 11,828
Marshall Islands


Show only this user's posts in this thread
« Reply #16 on: November 02, 2017, 03:22:03 AM »

Setting A Map Projection

Because the western Aleutians have a longitude east of Greenwich, and thus show up on the right side of the map, and using longitudes at more extreme latitudes causes east-west stretching and area exaggeration at higher latitudes we want to use a map projection.

To do this:

(1) Click on the cloverleaf in the lower right corner.

This screen will popup:



(2) Be sure On The Fly transformation is checked.

(3) There are a lot of transformations, so type "Albers" in the filter box to limit our choices.

(4) Scroll down to "North_America_Albers_Equal_Area_Conic" and click on it.

(5) Click on Apply and OK.

And you should see this:



This is a pretty good projection for continental-sized areas. Local directions are pretty good, and equal area is good for thematic maps. Over longer distances, directions are distorted (e.g. twisting of Alaska) and location of American Samoa and the Marianas.

For presentation quality maps we might want to use different projections for different maps. There are pre-defined Albers Conic projections for the Continental USA, Alaska, and Hawaii.

Saving a Project

We can save a project by clicking on the diskette icon at the upper left. The first time, you will be asked to select a directory. I ordinarily put all my files for a project including shp files, Excel files, text files, image files, etc. in a single directory.

You can also save a project by typing <CTRL>S.

After saving a project, if you exit QGIS, when you restart QGIS you can open an existing project (and you will be shown your recent projects). Double click on the project that you want and QGIS will open to the state where you left off.

It is a good idea to save a project after you have completed some work. Note that saving a project does not save the data files (shp and dbf) associated with it.
Logged
cinyc
Atlas Icon
*****
Posts: 12,721


Show only this user's posts in this thread
« Reply #17 on: November 02, 2017, 08:58:05 AM »

I found out on Twitter that we needn't even do the .csv step. QGIS can export an Excel .xlsx file as a vector file. That seems to import the ID column directly, as a text file.

jimrtex - do you know of any drawbacks to this? If not, I'll further simplify the preferred method instuctions if I have time tonight.
Logged
jimrtex
Atlas Icon
*****
Posts: 11,828
Marshall Islands


Show only this user's posts in this thread
« Reply #18 on: November 02, 2017, 11:48:55 AM »

I found out on Twitter that we needn't even do the .csv step. QGIS can export an Excel .xlsx file as a vector file. That seems to import the ID column directly, as a text file.

jimrtex - do you know of any drawbacks to this? If not, I'll further simplify the preferred method instuctions if I have time tonight.
QGIS uses a lot of Python plugins, for things like file import/export. I did not know that you could use xlsx files. I did some googling, and there was a tutorial about importing a lay from a csv file, which then mentioned that you could use an xls file, but that it would not import expressions. But I just tried it with an xlsx file and it did import the values of expressions.

I took a Census American Fact Finder file that had the 2016 county estimates, and which I had added some columns, such as calculating the rate of change from 2010 to 2016. I was able to import this into QGIS. It appears that it is keeping the two header rows from the xlsx file as data rows in the QGIS layer, and is confusing some data types. But this might be able to save a step. Personally, I prefer the csv files that I import into QGIS to be limited to a few pertinent columns and exclude intermediate calculations, but it might still be possible to use a simple spreadsheet that is linked to my main spreadsheet.

This might have application for drawing redistricting. I do my redistricting in a spreadsheet, where I can assign a district number to each county, etc., and then compute things like population for districts, and things such as racial composition. I then import this into QGIS to produce district maps. But it could be possible to let the district assignments to be made in QGIS and these exported to a spreadsheet.

I also exported the shapefile/dbf as an xlsx file. It looks OK. I'm not exactly sure I understand why you need to export the dbf file. In my applications, both the shapefile/dbf files and the census data files have the ID so that they can be joined.
Logged
cinyc
Atlas Icon
*****
Posts: 12,721


Show only this user's posts in this thread
« Reply #19 on: November 02, 2017, 04:48:05 PM »
« Edited: November 02, 2017, 08:21:20 PM by cinyc »

QGIS uses a lot of Python plugins, for things like file import/export. I did not know that you could use xlsx files. I did some googling, and there was a tutorial about importing a lay from a csv file, which then mentioned that you could use an xls file, but that it would not import expressions. But I just tried it with an xlsx file and it did import the values of expressions.

Neither did I, until I posted a link to this thread on Twitter and @PrdNewEnglander read this and told me we were making things more complicated than necessary - just import the Excel spreadsheet. I did a very quick test this morning, and seemed to get it to work, properly importing the ID column as a text column. I really should try it with one of my more complicated spreadsheets to make sure, though.

Quote
You must be logged in to read this quote.

The only real reason I developed my method was because I never really knew how to join sheets until your Hudson tutorial, and ran into the leading zero issue when I otherwise tried it. It does have its benefits - I often use more than one map making program/website, and don’t have to do multiple joins across platforms. For example, I can just import the zipped shapefile & .dbf to Carto.com without having to use their join function, which sometimes misreads the column types and imports the GEOIDs as numbers or numbers as text. The data and data type is permanently in the .dbf file.

I’m going to try to update the first post tonight to reflect the possibility of just using the Excel file.
Logged
jimrtex
Atlas Icon
*****
Posts: 11,828
Marshall Islands


Show only this user's posts in this thread
« Reply #20 on: November 02, 2017, 08:27:09 PM »
« Edited: November 03, 2017, 01:11:40 AM by jimrtex »

Navigation in QGIS



These show some of the tool icons that I typically use in QGIS. You can hover with the cursor above the icon to get a tool tip.

Pan and Zoom

The magnifying glass with a plus sign can be used to zoom in on an area. Select the tool, then with the cursor at the upper left corner of the area you want to zoom to, click-and-hold while you move the cursor to the lower right corner of the area you want to zoom to. As you do so, a rectangle showing the area to be zoomed to will be displayed. Release the mouse button, and the area will be zoomed to. You can use any diagonally opposite corners of the zoom box.

The magnifying glass with a minus sign can be used to zoom out on an area. Select the area to zoom out on, in the same way you zoom in. The amount of zooming is based on the area you select. Select a small area, and the zoom out will be large. Select most of the map area, and the zoom out will be minimal, in effect just expanding the area displayed outward a bit.

The hand icon is used to pan the map. Select the tool, and then while clicking-and-holding, drag the map to where you want it. You can also use the scroll wheel to zoom in or out.

Using the zoom and pan functions, we can focus on the contiguous United States.



The rest of the map is still there, which can be confirmed by using the pan option to drag Seattle down towards the center of the map.

Sooner or later, you will pan and zoom so that the map is centered on Buenos Aires (and thus totally blank), and no amount of panning and zooming will bring the United States back into focus. Click on the magnify glass in front of the white paper and you will show the entire layer.

You can also zoom to selected feature(s). Here we have selected Harris County, Texas. Selected features are shown in yellow.



Then click on the magnifying glass in front of the yellow paper and it will zoom to the familiar outline of the home county of the 2017 World Series Champions


Logged
jimrtex
Atlas Icon
*****
Posts: 11,828
Marshall Islands


Show only this user's posts in this thread
« Reply #21 on: November 02, 2017, 08:36:16 PM »

The only real reason I developed my method was because I never really knew how to join sheets until your Hudson tutorial, and ran into the leading zero issue when I otherwise tried it. It does have its benefits - I often use more than one map making program/website, and don’t have to do multiple joins across platforms. For example, I can just import the zipped shapefile & .dbf to Carto.com without having to use their join function, which sometimes misreads the column types and imports the GEOIDs as numbers or numbers as text. The data and data type is permanently in the .dbf file.

I’m going to try to update the first post tonight to reflect the possibility of just using the Excel file.
You can save a joined layer in QGIS. By default the joined layer is cached in memory, but you can force it to be stored on disk (be sure to browse to a directory where you can find the files).

Since the shp and dbf files are associated by position, I would be wary of getting a mismatch if you deleted or added features.
Logged
cinyc
Atlas Icon
*****
Posts: 12,721


Show only this user's posts in this thread
« Reply #22 on: November 02, 2017, 10:03:42 PM »
« Edited: November 03, 2017, 02:30:27 PM by cinyc »

Adding Labels to Your Map

Now that you know how to color, pan and zoom your map, you're ready add county labels. Since these would largely be unreadable on a map of the Continental United States, let's use your newly-acquired Projection, Pan and Zoom skills to focus on Alaska.

(1) Zoom to full map extents by hitting the magnifying glass with three blue arrows.

Notice how Alaska is weirdly tilted on this map? Before making a map of Alaska, we need to change the projection to something more Alaska-specific.

(2) Click on the globe icon in the bottom right-hand corner of the screen. That will launch the project properties dialog.
(3) Type "Alaska Albers" in the box.
(4) Select "Alaska_Albers_Equal_Area_Conic" from the list.
(5) Hit okay.

Now, Alaska looks more like most maps of Alaska.

Here's an image detailing these three steps:


(6) Hit the Zoom In magnifying glass, and draw a box around Alaska. Don't worry if you don't get all of the Aleutian Islands in - most are uninhabited anyway. Pan and Zoom in or out of your map until it looks something like this (assuming you've already colored your map):



Now, we're ready to add labels to the map.

(7a) Right click on cb_2016_us_county_5m in the layer panel.
(7b) Select properties from the drop-down menu.
(7c) Select "Labels" on the left side of the dialog.
(7d) Select "Show labels for this layer" from the top menu.

As you can see, the label dialog has 7 categories of options. I will briefly describe the most salient of them below. Here's a diagram, in case you're lost:



Text - This allows you to change the font, font size, color and transparency. I usually change the style to Bold, but YMMV.

(7e) Click on Style and change it from Normal to Bold from the drop-down menu.

Formatting - This allows you to wrap your text on a character, set a left, right or center alignment, and format numbers.  

(7f) Change the Alignment to Center. Click the box next to formatted numbers, and enter 2 in the Decimal Places box.

Buffer - this draws a text buffer around your text. I think this is a good idea to use with the Atlas color scheme because black text is too dark on dark colors and white text is too light to be seen on its light colors.

(7g) Check the Draw text buffer box.

Background - this allows you to draw a background behind the text. This also helps with visibility, but probably isn't necessary here, since we have a buffer. Skip.

Shadow - this allows you to draw a drop shadow behind your text. This isn't necessary here. Skip.

Placement - this allows you to dictate where your labels are placed - offset from centroid, etc. It also allows you to define the priority of this layers' labels compared to other layers.

(7h) Click on Force point inside polygon.

Rendering - this allows you to, among other things, only show labels on certain zoom levels and show all labels, including colliding labels. Skip for now.

What do we want to include in the label? If we were going to be simple about it, just NAME. But there is a way to include multiple things in your label.

(7i) Click on the curved E to the right of the label with dialog.
(7j) Type the following formula:

"NAME" || '\n' || concat(format_number("INCREASE"*100,2),'%')

'\n' places the increase text on the next line, instead of next to name. The concat function allows you to put a percentage mark after the increase. The format_number function allows you to limit the Increase percentage to 2 decimal places.

(7k) Hit OK to save the formula.
(7l) Hit OK to close the Layer Properties Dialog.

Congratulations! You've added labels to your map! Your map should now look something like this:



Again, remember to save your project.

If you want to print a simple image of your map, you can select Project—> Save an Image which creates a png file of the map window. But if you want to add things like a legend and descriptive text or want to make multiple maps with the same map view, it’s probably best to use QGIS’ print composer. How to do that is described in the next post.
Logged
cinyc
Atlas Icon
*****
Posts: 12,721


Show only this user's posts in this thread
« Reply #23 on: November 03, 2017, 12:11:35 AM »
« Edited: November 07, 2017, 12:49:25 AM by cinyc »

Using the QGIS Print Composer

We're ready to export an image of this map using the print composer. Before we do that, we should probably add a shapefile of Canada. Otherwise, when we color the background, Alaska will look like an island.

Luckily, Statistics Canada's shapefile website has an available provincial shapefile here. Download this file and unzip it.

(1) Add gpr_000b11a_e.shp to your map by dragging the shapefile to the map screen, clicking on the V icon on the left of the screen, or hitting CTRL-Shift-V. Note: if you last opened the .xmlx file, you might have to change File Type back to ESRI Shapefiles to find it.

The names of these two shapefiles are confusing. You can rename them in the layer panel by right clicking and selecting Rename from the drop-down menu. This will also help later when we add a legend to the map.

(2a) Rename gpr_000b11a_e "Canada".
(2b) Rename cb_2016_us_county_5m "County".
Note: This doesn't change the underlying file name, just the name in the Layer Panel. The layer name is used when the print composer auto-makes a legend - though you could separately rename the shapefile name only in the print composer, if you wish.

What color do we want to make Canada? That's totally up to you - and you can easily change it:
(3a) Right click on Canada in the layer panel, and select "Properties" from the drop-down menu.
(3b) Click Style.
(3c) Click on Simple Fill.

You should see a menu with 7 options:



-Fill allows you to change the background color. Clicking on the arrow brings up a simple dialog with a color wheel and simple and recent colors. Clicking on the bar brings up a more complex dialog that allows you to input an HTML code for your color choice.

(3d) Choose whatever color you want. I usually use a dark grey for foreign countries, HTML notation #616161.  The opacity slider allows you to make the layer more or less transparent. It isn't necessary to adjust it here.

-Outline allows you to choose the outline color - here - provincial and country borders.

(3e) Click on the bar or arrow and choose a color. I usually use red, HTML notation #ca0020. If you don't want to show provincial borders, use the same color you used for fill.

-Fill style allows you to decide how to fill a polygon. Solid is probably fine here.

-Outline style gives you options for the outline - solid line, dash, etc. Solid line is probably fine here.

-I'm not sure exactly what Join Style does. Skip.

-Outline width allows you to set the width of your outline. I tend to make state and country borders wider than county borders.

(3f) To do that, hit the up arrow until Outline Width is 0.66000 millimeters.

-Offset allows you to offset your symbols by a specified length. That's not necessary for a solid fill (but might be for points). Skip.

(3g) Hit Okay.

Canada's colo(u)rs should have changed to your specifications.

Save your project.

We're now finally ready to use the print composer.

(4a) Select Project-->Print Composer or type CTRL-P.

A dialog will pop up asking for a unique name. Name it Alaska. The print composer will pop up. It looks like this:



I'm not going to explain what all of the icons do - just the ones typically used to make a map. They are labeled B-F, in order of what I usually do to make my maps:

(4b-1) Click on the icon that looks like a scrolling piece of paper. This adds a map to the canvas. Draw a rectangle as large as the canvas.

You should now see Map 0 in the Items Panel, and tabs for Composition, Item properties, and Command history below that.

(4b-2) Click on the Item properties tab, if it's not already selected.
(4b-3) Under Extents, click on "Set to map canvas extent"

This will make your print composer map look like what the main QGIS screen looks like. The map is still probably not optimal - too much white space. You can manually fix this by playing around with the X min, Y min, X max and Y max values under Extents. You can play around with them until you like your map.

(4b-4) Enter the following values:
X min: -1500000
Y min: 300000
X max: 1750000
Y max: 2500000

Next, we should set the blank space to the color of water. To do that:
(4b-5) Scroll down and check the background box.
(4b-6) Expand the background section and click on background color.
(4b-7) Select whatever color you want. I use HTML notation #a6cee3 for water
(4b-8) Hit OK.

The water should now be colored blue.

Note that the map is now smaller than the canvas. To rectify this:

(4b-9) Click on the Composition tab.
(4b-10) Under "Resize page to content", hit the Resize page button.

While we're here, we might as well lower the export resolution. 100 dpi is usually sufficient. Anything larger might be too large to be uploaded to the Atlas Gallery.

(4b-11) Type 100 in the Export resolution box.

We're now ready to add a legend to the map:

(4c-1) Click on the icon with Yellow, Red, Green squares on the left side of the screen.
(4c-2) Draw a box on the upper right hand side of the map. A legend should be auto-created.
(4c-3) Select Legend in the Item Pane.
(4c-4) Select Item properties.

Legends can be tailored to only include items on the map screen.

(4c-5) Open the Legend items menu if it isn't already.
(4c-6) Hit the funnel icon underneath the list of shapefiles.
(4c-7) Click on the "Only show items inside current atlas feature" box.

If you've done this correctly, the legend should be truncated to about 7 items, and if you update the map extents in the print composer or change the variable in QGIS, the legend should automatically change to reflect what's shown on the map.

(4c-8) Scroll down to Position and size. Expand the menu, if necessary.
(4c-9) Click on the upper right box next to "Reference point".
(4c-10) Move your cursor back to the map. Click on and drag the Legend to the upper right hand corner of the map. You should see red guidelines on the canvas when you get there.

Next, we can add a scale bar (optional):

(4d-1) Click on the black and white bar icon on the left side of the print composer.
(4d-2) Create a box on the lower right hand corner of the map.
(4d-3) Select <scale bar> in the Item Pane
(4d-4) Select Item properties below (if necessary)
(4d-5) This is America. We don't need no stinking metric system. Under units, change "Meters" to "Feet".
(4d-6) Under Segments, make the bar as long or short as you want. Using the down arrow, change left to 0.
(4d-7) Decide whether you like a short or tall bar. I like short bars, so I lower the height to 1.00 mm.
(4d-8) Under Position and size, check the lower right hand box next to Reference point.
(4d-9) On the map, drag the scale bar to the lower right hand corner. You can manipulate the box by making it larger or smaller to move it closer to the bottom of the map.

Finally, we can add a text description of the map anywhere on the canvas:

(4e-1) Click on the icon of a T in a rectangle on the left hand side of the screen.
(4e-2) Draw a rectangle in the upper left hand corner of the screen.
(4e-3) Highlight QGIS in the Item Pane.
(4e-4) Select Item properties below (if necessary)
(4e-5) Type the title of this map in the box under Main properties: Relative Population Change in Alaska County Equivalents, 2010-16
(4e-6) Click the Font Button
(4e-7) Change the font, type and size however you want. I've used MS Shell Dig, Bold, 24 pt type.
(4e-8) Hit OK.
(4e-9) Move the text box to the upper left hand corner, and drag the edges to fit in all the text, if necessary.

Finally, we can export the map as an image:
(4f-1) Click on the icon next to the printer on the top toolbar (it looks like a piece of paper with a mountain on it).
(4f-2) Type a file name for your picture, and hit Save.
(4f-3) A dialog should pop up. Make sure the Export Resolution is set at 100 dpi and check the box to Crop to content. Hit save.
(4f-4) Open your image. It should look something like this:



Congratulations! You have successfully used the print composer to make a map! Assuming you have enough posts here, you can now upload your map to the Atlas Gallery and share it with us!

As always, remember to save your project. This is especially important now because your print composer will be saved as part of your project. That allows you to easily make multiple maps with the same projection and coordinates simply by changing the variable mapped. It's how I make my gifs.

Note: There are a couple of issues with some labels not showing up on the map. We could force all labels to be printed by checking the appropriate box in the label dialog. I'm still not 100% sure how to manually apply label locations to avoid potential collisions, though. Perhaps jimrtex does.

Next from me: Calculating WINCODEs.
Logged
jimrtex
Atlas Icon
*****
Posts: 11,828
Marshall Islands


Show only this user's posts in this thread
« Reply #24 on: November 03, 2017, 02:58:07 AM »

After you added labels, I would do the simple way to create a map: Project > Save an Image which creates a png file of the map window. That is what I always use (my use of QGIS is more as an interactive analysis tool).

I tried to use the Print Composer for Hudson, and could never get the Bing Street Maps to line up with the Census Shapefiles. If you use the Census Shapefiles for street features, each street fragment (a block line) is a feature. So you end up with a lot of labeled streets. I merged street features, but it was a tedious process.

One thing you might show, particularly for the Contiguous US, is how to turn the county boundaries off. That is an awful lot of black which overwhelms the colors. If you do that, then you might want to bring a States layer in, and show how to display layers that cover the same area.

I generally use the show all labels, but I generally only use county names when working interactively. If I am having trouble reading labels, I can just zoom in some more. I have used the expression left("NAME",2) to display the first two characters of a county name. But that is mainly when working in an area where all the counties look the same.

I did some googling, and someone was explaining how to label earthquakes based on their magnitude, which was an attribute. The largest earthquakes (> 6.5 magnitude) had their location; those > 4.5 had their magnitude shown, and smaller ones just had a symbol. There apparently is a way to indicate both what to display (content), and how to display it (style)

You can also define another pair of fields that have the offsets. So you may be able to move some labels so that Ketchikan Gateway Borough and Fairbanks North Star can be displayed.

An expression like this can be used.

if (left( NAME,1)='H', "NAME" ,"")

This frivolous example labels counties whose name begins with "H".

If you were displaying the contiguous US, you probably would not label all 3000+ counties, or even include the percentage change. That is why you are using a color theme. But you might want to display the fastest gaining counties, or the largest populations, etc. So you could simply calculate a variable that indicates which counties should be labeled.

if ("IMPORTANT" = 1, "NAME", "")

I just discovered something really cool. I was using American Fact Finder to get populations for county/congressional district fragments. But when use AFF to create a map, you can save it as a shapefile. The saved shapefile does not have the population attribute, but does include attributes for the CD and county numbers, and also an ID value. When you save the data values, it has the same ID, so they may be joined.
Logged
Pages: [1] 2 3  
« previous next »
Jump to:  


Login with username, password and session length

Terms of Service - DMCA Agent and Policy - Privacy Policy and Cookies

Powered by SMF 1.1.21 | SMF © 2015, Simple Machines

Page created in 0.193 seconds with 14 queries.