Sometimes, generating our latitudes and longitudes of specific locations is better than depending on Tableau's generated geolocation.
Using Python to automate boring stuff, we can write a simple 30 lines(or less) script that will pass our addresses into Google Maps API(or other services) and return their geolocation.
Here is how:
1. Get the list of the addresses you want geolocation and save them as CSV(e.g. Cities.csv)
2. Write a simple Python script that will append your own Latitudes and Longitudes (e.g. geoGoogle.py #github file).
3.Make sure you have the script and csv file in some folder (e.g. ....\Documents\Python Scripts). Run the script:
python geoScript.py Cities.csv
4. The output will have geo+yourfilename.csv (e.g. geoCities.csv)
5. Left join your data to get your Geolocation
And there you have it. I have attached both Cities.csv and geoScript.py for you to test
Become a Viz Whiz on the Forums!
Support the Community and master Tableau.
Retrieving data ...