Below is a general process about how to use mapping features in SketchPAD (Looker Studio) and BigQuery GeoViz.
Mapping in SketchPAD (Looker Studio)
Adding locations to your map
Using Place Names
One fun thing about Looker Studio is that it allows you to map geographic units using the name of the unit rather than needing to have its shape. You may, however, need to convince Looker Studio to interpret the name as a geographic field. Here’s how:
-
Select ‘Add dimension’ for the Location label under Fields
-
Then select Create Field
-
Give your new field a name, a formula, and a Geo data type. We recommend that you concatenate the county name with the state abbreviation to make sure that Looker Studio recognizes and graphs in the intended way, as multiple geographies with the same name (which often happens with counties) can lead to unexpected results. If you have FIPS codes available, these can be more reliable than using the names.
- You should now see the outlines (or bubbles, depending on your type of graph) of the geographical units of your map all showing up the same color!
Using Geospatial Data (geography-type shapes)
There are 2 key steps to mapping in Looker Studio using geospatial data. Note that to pull in geospatial data from BigQuery, it needs to be in the GEOGRAPHY format in BigQuery or one of Looker Studio's built-in geography types (listed above).
- Add a unique identifier for your geographic data as the dimension for the Location label under Fields. This may be the GEOID/FIPS code or the name of your place.
-
Then under Geospatial fields, add your shape field as a metric.
NOTE: By default, Google Maps in Looker Studio only plots 100k points (Polygon vertices). This may be enough for your map, but if not, you have 2 options:
- Add a filter so your map only shows one portion of the data at a time. This works really well in cases like examining census tracts in a state where you can limit it to only one or a few counties.
-
Adjust the number of points being plotted (up to 1 million). This can slow down the loading of your map by a small bit, but for most use cases, it will allow your map to show all of your data. Here’s how:
- Go to the Style section for customizing your map, and scroll down to the Filled Area Layer section. Change the ‘Max number of polygon vertices’ from 100,000 to 1,000,000
You should now see all of your shapes on the map!
Coloring your map
The next step is adding the field you want to visualize to your map.
-
There are two different options for how to add color to your map. Adding your field as a dimension under ‘Color Dimension’ will treat it as a categorical variable. This can be useful when you want to visualize something like a voter’s most common top issue in that geographic area. If you want to graph a continuous variable, like population growth in each geographic area, then you should add your field as a metric under ‘Color Metric’
- Looker Studio will apply a function to the data used as a metric. You can use this to aggregate the data if you haven’t already done so in BigQuery. If you have, Sum will return and graph the exact value provided.
-
NOTE: Looker Studio is unable to interpret a percent when the data is already in that form. However, it is able to take a decimal and return it as a percent in your graphed data. Here’s how:
- In your BigQuery query (or other data source), leave the field that you want to be a percent as a decimal
-
Once you’ve connected your data to Looker Studio, go to Edit data source
-
Click to change the data type for the field you wish to convert. Then, select Number and Percent
- Hit the blue Done button to exit out of the data source editor. Now you have a graph that shows your metric as a percent!
Labeling your map
You can customize the label that pops up when you hover over a geographical area by adding a dimension under ‘Tooltip’. You can choose any field directly from your data or create a new text field to display anything you want.
- By default, Looker Studio will use the text of the field used as the Location dimension
- If you want to add more information to the label and create a new field, be sure to save it as a Text data type. Here are some tips and tricks for doing this:
- CONCAT() allows you to string pieces of text and data together
- “\n” is a new line character that you can use to display the text of your label on multiple lines
CONCAT(county_name,'\n',
'2010 Population : ',pop_2010, '\n',
'2018 Population : ',pop_2018, '\n',
'Population Change : ', population_change, ' (', ROUND( percent_change * 100, 3), '%)')
Customizing Style and Color
- The sections “Background Layer” and “Map Controls” allow you to customize the appearance of the Google Map that makes up the background of the chart (Satellite vs Standard, Street view access, zoom controls, etc)
- “Layer Type,” “Filled Area Layer,” and “Colors” customize the appearance of the areas on your chart. Hint: for an extra wow factor, you could set these to be opposing colors from your organization’s color palette
- The final sections “Color Legend”, “Background and Border”, and “Chart Header” allow you to customize how your map appears on your dashboard. Hint: you can include a map as one chart of many in a Looker Studio dashboard
Mapping in GeoViz
Another option for geospatial visualizations is to use the BigQuery GeoViz tool. To do so, you can run a SQL query and then display the results as an interactive map. In order to produce the maps, you have to include a data field of the GEOGRAPHY type (see Google’s documentation here on that data type). You can then customize the color, opacity, and thickness of lines to stylize your map.You can see an example of creating a GeoViz from Google here.
We recommend using GeoViz for quick visuals that don’t necessitate an entire dashboard in Looker Studio and don’t need to be shared widely. Below are some limitations of GeoViz:
- GeoViz can only display one map at a time based on one BigQuery SQL query
- GeoViz maps can only be shared with other users authorized to run queries in the same BigQuery project the data is coming from
- Sharing links expire after 30 days
- You cannot customize the style and amount of information that appears on the label for a geographic unit.
Visualizing Geographic Data in PAD
For more information about how to visualize geographic data in PAD, check out our help article here.
Have more questions? Contact us at help@techallies.org
Was this article helpful?
That’s Great!
Thank you for your feedback
Sorry! We couldn't be helpful
Thank you for your feedback
Feedback sent
We appreciate your effort and will try to fix the article