Easily Sourcing Geographic Data Via Google Maps

INTRO

One of the most recent trends within Tableau and the visualization world is the utilization of geographic data and heat maps. While entering ZIP codes and City names are useful, it would be significantly more interesting to see specific locations as individual pins within those areas.
That's where using Google maps has its benefit. Using the below method, you can easily source geographic data using Latitudes and Longitudes and export the table into excel. There are really only two pieces of software that you need:
  • Microsoft Excel (ON PC)
  • A web browser capable of accessing Google Maps 
  • A google account
**Unfortunately, I have not yet been able to recreate my success with this process on Mac. The XML conversion is a bit difficult to navigate there**

STEP 1: Create a Custom Google Map with the Locations

For the sake of this example, I will plot all of the Chik-Fil-A locations in the Philadelphia area. First, we must plot the area of the map. For this, navigate to https://www.google.com/maps/d/u/0/ and select create a new map (once logged into your Google Account. You will see this:
Now that we have a blank map, I'm going to scroll into the Philadelphia Area and search for all of the Chik-Fil-A locations. Here's what I get: 
By hovering over each of the locations on the left section of the screen, I get access to add them to the table that will eventually be exported by clicking on the (+) button. This will add each location to the total list. I'm going to go ahead and select all of the locations and add them to my list...
Now that these files are all located in the layer sheet, we are all set to export.
For demonstrations sake, he's an embedded version of the map:

STEP 2: Exporting the Data to KML (for Excel) 

The next step in the process is to export the data to KML. On the google maps page on the left banner UI, click on the three dots right of "Chik-Fil-A in Philly" and select export to KML/KMZ. Select the below settings and click download: 

STEP 3: Import Into Excel and Format As You Wish

Now that you have a KML file, you have a data table that Excel can interpret. Locate the KML file created from Google Maps. Right click and select open with Excel to draw that table into an excel file. You will get a pretty gnarly couple of error messages as seen below. Click yes and then read as XML file.

AND THAT'S IT. Now you have latitudes and longitudes with contextual data in an excel spreadsheet that is easily accessible. I would personally get rid of the filters and make it a simpler three column location / latitude / longitude file by using comma delimitation but I'll explain that if anyone in the comments desires to do so. I'm just doing this whole blog to share what I've learned and maybe collaborate with other Tableau people. So that's it for now. Peace 👋

Comments

Popular posts from this blog

Custom Theme Palettes in Tableau

Business Policy Update