Geocode campaign contributions
First, you'll geocode, or geographically locate, a spreadsheet of addresses of political contributions from the 2017 Albuquerque mayoral campaign.
Download the CSV file
Political campaign contributions can inform who and which businesses support a candidate or political party. Contribution data is often publicly available on government websites or as physical records. In this scenario, you have acquired a CSV file of contributions for the 2017 Albuquerque mayoral campaign. By mapping the location and amount of each contribution, you'll be able to visualize where constituents for each party are concentrated across the city.
First, you'll download the CSV file of political campaign contributions. Then, you'll familiarize yourself with its contents.
- Download ABQ_Voter_Data.csv.
- Optionally, locate the downloaded CSV file and open it in a spreadsheet editor such as Microsoft Excel.
The CSV file contains the following information for 814 political contributions:
- Address data
- The political affiliation of the candidate who received the contribution
- The occupation of the contributor
- The contribution amount in United States dollars
- Whether the contributor was an individual or business
- The type of contribution (in this case, all contributions are monetary)
The address data comes in two forms: the full address and individual columns for the street address, city, state, and ZIP code. When you geocode the file, you'll use the individual columns to ensure each part of the address is correctly recognized by the automated geocoding service.
- Close the CSV file. If prompted to save changes to the file, click Don't Save.
Geocode the CSV file
To map the CSV file, you'll geocode it. Geocoding is the process of converting a description of a location, such as an address or place name, into a coordinate that can be displayed on a map. You can geocode a CSV file or other spreadsheet of addresses when you upload it as an item in ArcGIS Online.
- Sign in to your ArcGIS organizational account.
Note:
If you don't have an organizational account, see options for software access.
- On the ribbon, click Content.
- Click New item.
- In the New item window, click Your device. Browse to and double-click the ABQ_Voter_Data.csv file you downloaded.
- For How would you like to add this file, ensure Add ABQ_Voter_Data.csv and create a hosted feature layer or table is selected. Click Next.
The next window determines how the fields in the CSV file will be included in the feature layer you create. By default, all fields will be included. Most fields will be string (text) fields, while the ContributionAmount field will be an integer (number) field. These parameters are correct.
You can also change the display names of the fields, which determine how the field names are shown in pop-ups and charts. You'll make changes to improve legibility and presentation.
- For Display name, change the following names:
- Remove the underscores from Full_Address, Address_1, Address_2, and Contribution_Type and replace them with a space.
- Change Zip to ZIP Code.
- Change Political_Affl to Political Affiliation.
- Add spaces between the words for ContributionAmount and ContributorType.
- Click Next.
Next, you'll set the parameters to geocode the addresses in the CSV files. First, you'll set the region the addresses are in.
- Expand Advanced location settings. For Region, choose United States.
The default address locator used by ArcGIS Online is ArcGIS World Geocoding Service. This service will be able to locate most addresses in the United States.
Next, you'll set the fields in the CSV file that will be used to locate the addresses. You'll change the fields so that they are taken from the address, city, state, and ZIP code fields instead of the field with the full address. By using multiple fields instead of one, you'll ensure the address locator reads the location information correctly.
- Under Location fields, select Location information is in multiple fields.
- For Address or Place, choose Address 1. For Address2, choose Address 2.
The City, State, and ZIP Code fields were automatically selected.
Geocoding consumes credits. Credits are the currency used across ArcGIS and are consumed for specific transactions and types of storage, such as storing features, performing analytics, and using premium content. The amount of credits consumed during geocoding depends on the number of features being geocoded. The Credit estimate section estimates it will take 32.60 credits to geocode the CSV file.
Note:
If you don't have enough credits to complete the geocoding, or if you don't want to spend credits, you can use a replacement feature layer that has already been geocoded for you. Go to Albuquerque 2017 Campaign Contributions details page and proceed to the next section of the tutorial. You may need to sign in to your ArcGIS account again.
- Click Next.
Lastly, you'll add metadata about the feature layer you're creating.
- For Title, type Albuquerque 2017 Campaign Contributions and add your name or initials.
Note:
You cannot create two layers in an ArcGIS organization with the same name. Adding your initials to a layer name ensures that other people in your organization can also complete this tutorial. Once a layer has been created, you can rename it in the map to remove your initials, which will not affect the name of the underlying data layer.
- For Tags, add the tags voting, elections, and political parties. For Summary, type (or copy and paste) Political contributions in the 2017 mayoral election in Albuquerque, New Mexico.
- Click Save.
The feature layer is created and you go to its item page. A window confirms that 814 locations were successfully geocoded. Because there were no errors, you don't need to review the geocoded locations.
- In the Review locations window, click No.
Style the campaign contributions
Now that you've geocoded the political campaign contributions, you'll add them to a web map. You'll style the contributions to show both the contribution amount and the political party that received the contribution.
- On the Albuquerque 2017 Campaign Contributions item page, click Open in Map Viewer.
The layer is added to a new web map centered around Albuquerque, New Mexico. Each contribution is displayed as a point.
Though you've mapped the contributions, the default style doesn't tell you much about them. To learn more about the data, you'll change its style so that contributions have different appearances based on the dollar amount of the contribution and the political party they were for.
You'll also rename the layer to remove unneeded information. When you save the map, you'll include information about the year and city in the map title, so the layer can have a simpler title.
- In the Layers pane, for Albuquerque 2017 Campaign Contributions, click the Options button.
- In the options menu, choose Rename. Rename the layer to Campaign Contributions and click OK.
Next, you'll style the layer based on contribution amount and political affiliation.
- On the Settings (light) toolbar, click Styles.
- In the Styles pane, under Choose attributes, click Field.
- In the Select fields window, select Political Affiliation and Contribution Amount. Click Add.
The fields are added and the layer style automatically changes. Now, the size of each point reflects the dollar amount of the contribution and the color represents the political affiliation. In the 2017 mayoral election, there were two political parties represented, Republicans and Democrats. By default, Republican contributions are styled in red and Democrat contributions in blue, reflecting the colors commonly associated with each party.
Refine the style
The style conveys useful information, but could be improved. Contributions overlap or cover each other completely, making some contributions difficult or impossible to see. You'll add transparency to the symbols to make it possible to see the covered contributions.
- In the Styles pane, for Types and Size, click Style options.
You can choose to change the style for political affiliation (Types) or contribution amount (Counts and Amounts). You'll add transparency to the symbol color, so it's the political affiliation symbol you want to change.
- For Types (unique symbols), click Style options. Click the Symbol style button.
- In the Symbol style window, set Fill transparency to 30 percent.
The transparency is applied, making it possible to see where symbols are overlapping. For clarity, you'll give each symbol a unique outline without transparency so individual symbols stand out more.
- Close the Symbol style window. In the Style options pane, click the REPUBLICAN symbol.
- In the Symbol style window, point to the Fill color button.
A tooltip provides the hexadecimal (#) code for the color. The code is #ED5151.
You'll use the same color for the outline, but remove the outline's transparency.
- Click the Outline color button. In the Select color window, for the hexadecimal code (#), type ed5151.
- Close the Select color window. In the Symbol style window, change Outline transparency to 0 percent.
You'll style the DEMOCRAT symbol similarly.
- Close the Symbol style window. In the Style options pane, click the DEMOCRAT symbol.
The hexadecimal code for this symbol's fill color is #149ECE.
- Click the Outline color button and change the outline color's hexadecimal code (#) to 149ece. Close the Select color window.
- Change Outline transparency to 0 percent. Close the Symbol style window.
Lastly, you'll change the name of each symbol. Because of the way the data in the CSV file was formatted, the symbol names are in all capital letters. You'll change them to title case.
- In the Style options pane, click REPUBLICAN and type Republican. Click DEMOCRAT and type Democrat.
Note:
The number next to each symbol indicates the number of times that symbol is used on the map. Based on this information, there are 501 Republican contributions and 313 Democrat contributions.
- At the bottom of the Style options pane, click Done.
The layer is now styled to show where the largest contributions came from for each candidate and how contributions compare between parties.
Change the map context
You can also improve the presentation of your data by changing and adding contextual information to the map. First, you'll update the basemap to one with a simpler appearance to avoid unneeded information from distracting from the campaign contributions. Then, you'll add the city boundary of Albuquerque.
- On the Contents (dark) toolbar, click Basemap.
- In the Basemap pane, click Light Gray Canvas.
- Close the Basemap pane.
The light gray background makes the contributions easier to see.
Next, you'll add a city boundary to help users focus on the area that's important to the campaign.
- On the Contents toolbar, click Add and choose Browse layers.
You'll search for the city boundary layer by searching all content shared on ArcGIS Online.
- In the Browse layers pane, click My content and choose ArcGIS Online.
- In the search bar, type Albuquerque City owner:Esri_Tutorials.
Tip:
By adding owner: and the name of an account, you can narrow the search results to only those owned by that account.
- In the list of results, for Albuquerque City Boundary, click Add.
The layer is added to the map. It shows the official city boundary of Albuquerque, which stretches from the east of the Sandia Mountains to the Volcano Cliffs on the west mesa.
Your map is finished, so you'll save it.
- On the Contents toolbar, click Save and open and choose Save as.
- In the Save map window, add the following information:
- For Title, type Albuquerque Political Campaign Contributions.
- For Tags, add the tags voting, elections, and political parties.
- For Summary, type Political campaign contributions for the 2017 mayoral election in Albuquerque, New Mexico.
- Click Save.
You've geocoded a CSV file of campaign contributions and mapped them with an appropriate layer style to show where the largest contributions are located throughout the city. This information will provide your candidate with a good idea of the most important neighborhoods to target messaging for contributions to their own campaign. But what does your candidate know about the contributors? To help them understand more about where contributions are coming from, you'll create a chart that breaks down contributions by type.
Chart contributions by type
The campaign contributions you geocoded include nonspatial data, or data that isn't related to geographic location. Previously, you changed the layer style to emphasize some of this nonspatial data (specifically, political affiliation and contribution amount). The candidate would also like to know whether contributions are coming from businesses or individuals. This information will help them target their campaign messaging.
Adjusting the layer style to show a third field in addition to the two you're already displaying isn't possible with the available style options. Instead, you'll create a chart to visualize contributor type. You'll also manage layer pop-ups so users can quickly view important information about individual contributions.
Create a chart
First, you'll chart the amount of contributions coming from businesses and the amount coming from individuals.
- On the Contents toolbar, click Layers.
The Layers pane appears.
- In the Layers pane, click the Campaign Contributions layer to select it.
- On the Settings toolbar, click Configure charts.
- In the Charts pane, click Add chart and choose Bar chart.
An empty bar chart appears. To create the chart, you'll choose the field you want to show.
- In the Data pane, for Category, choose Contributor Type.
A bar chart is created. There are two contributor types: business and individual. By default, the types are aggregated by count, meaning the chart shows the total number of contributions by each type.
Individuals made significantly more contributions than businesses did. However, this chart doesn't account for the amount of money that was contributed. It's possible that individuals made a large number of small contributions, while businesses made a small number of large contributions. You'll adjust your chart to show the total contribution amount instead of the number of contributions.
- For Aggregation, choose Sum.
- For Numeric fields, click Select numeric fields. Choose Contribution Amount and click Done.
The bar chart updates to show the total amount of contributions, rather than the total number. The difference between businesses and individuals is smaller, though individuals still contributed significantly more. Your candidate will probably want to prioritize their messaging toward individuals, but they shouldn't ignore businesses completely.
Your candidate also wants to know if there is a significant difference in contributor types by political party. You'll adjust the chart to split each bar by affiliation.
- For Split by, choose Political Affiliation.
The chart updates.
The chart confirms what your map seems to show: Republicans received a significantly higher amount of contributions than Democrats. While Republicans received most of their contributions from individuals, they also received a significant amount from businesses. By contrast, Democrats received almost no contributions from businesses. Your candidate's political affiliation might determine whether they target messaging toward businesses or not.
Improve the chart
You'll make some adjustments to the chart to improve its presentation. Then, you'll export it as an image.
- Turn on Show data labels.
On the chart, each bar is labeled with its total amount. In this case, this option is useful because it reveals that Democrats did receive some contributions from businesses (550 dollars), even though the chart's scale makes it appear as though they received none.
- Click the General tab.
On this tab, you can change the titles of the chart and its axes. You'll give the chart simpler titles to make it more legible.
- Change the following parameters:
- For Chart title, change the title to Contribution Amount by Type and Party.
- Turn off X-axis title.
- For Y-axis title, change the title to Total Amount.
Next, you'll adjust the length of the axis labels. The Business/Group label is cut off because it exceeds the label character limit. By increasing the length, you'll display the entire label.
- Click the Axes tab.
- For X-axis, for Label character limit, type 20.
Lastly, you'll change the legend so the political parties are listed in title case rather than all capital letters.
- Click the Series tab.
- For Series, click DEMOCRAT.
- In the Series style window, for Label, type Democrat. Close the Series style window.
- Change the REPUBLICAN label to Republican and close the Series style window.
The chart is finished. You're ready to export it as an image.
- On the chart pane toolbar, click the Export button and choose Export as Image.
The chart is downloaded to your computer as a PNG image.
- In the Series pane, click the Back button.
You return to the Charts pane. The chart you created is listed.
Tip:
If you want to edit the chart again, click the options button next to its name and choose Edit.
- On the Contents toolbar, click Charts.
The Layers pane is replaced by the Charts pane. You can access your chart from this pane, too.
- On the Contents toolbar, click Layers. Close the Charts pane and the pane showing your bar chart.
Configure pop-ups
Charts aren't the only way to display a map's nonspatial information. Layers also have pop-ups, which appear when you click a feature on the map. A pop-up displays attributes about a selected feature. By configuring pop-ups, you can quickly view information about individual contributions.
- On the map, click any campaign contribution feature.
The pop-up doesn't display information about the contribution. Instead, it displays information about Albuquerque. The pop-up you see is actually the pop-up for the city boundary layer. You'll want to turn off this pop-up so users see information about campaign contributions instead.
The bottom of the pop-up says 1 of 2. (Depending on where you clicked, it may say 1 of 3 or more.) This number refers to the number of pop-ups at the location you clicked. You'll look at the second pop-up at this location.
- In the pop-up, click the Next button.
The next pop-up is displayed. It shows information about the campaign contribution. All of this information comes from the CSV file you geocoded.
Not all of the information in this pop-up is useful. All of the contributions are in Albuquerque and all of them are monetary, so this information is redundant. It's also not necessary to display the address multiple times. You'll remove the unneeded information from the pop-up.
- In the Layers pane, confirm that Campaign Contributions is selected. On the Settings toolbar, click Pop-ups.
First, you'll change the pop-up's title. The current title is the original name of the layer, which isn't useful. You'll change it to the full address of the contribution.
- In the Pop-ups pane, click Title.
- Delete the title text. Click the fields button.
- In the Add field window, choose Full Address.
Now, the pop-up title will display the address of the campaign contribution. Next, you'll remove unneeded fields from the pop-up.
- Click Fields list.
The list expands. You'll remove the address field because the address is in the title.
- For Address 1, click the remove button.
- Remove the following fields:
- Address 2
- City
- Contribution Type
- Full Address
- State
- ZIP Code
Now, only four fields remain. On the map, the pop-up automatically updates based on your changes.
You've mapped or charted contribution amount, contributor type, and political affiliation. The remaining field of interest is Occupation, which shows the occupation of the person who contributed or, in the case of businesses, the type of business.
Tip:
For an optional challenge, to test what you've learned, try creating a chart that shows the total amount of contributions by occupation. Which occupations contributed the most to campaigns?
Lastly, you'll turn off the pop-up for the city boundary.
- In the Layers pane, click Albuquerque City Boundary to select it.
The Pop-ups pane automatically updates to show options for the selected layer's pop-up.
- In the Pop-ups pane, turn off Enable pop-ups.
- Close the Pop-ups pane. On the map, click any campaign contribution feature.
Now, only the pop-up for the campaign contribution appears. The city boundary pop-up has been turned off.
- Close the pop-up. Save the map.
In this tutorial, you geocoded political campaign contributions and added them to a web map. Then, you styled them by political affiliation and contribution amount. Lastly, you created a chart showing contributor type and configured pop-ups to show relevant information. The result is a map that combines spatial and nonspatial data to give an in-depth picture of campaign contributions in Albuquerque, New Mexico. Your candidate can use this map to identify important areas to canvass and ways to best target messaging so that they can ensure a successful campaign.
This tutorial covered only some of the ways a web map could be used to help a campaign. To learn more about what you can do in ArcGIS Online, try the following tutorials:
- To learn about elections on a national and state level, try Investigate and share election results.
- To learn how to present your web map with an app that can be used even by people without GIS experience, try Create an app.
You can find more tutorials in the tutorial gallery.