I've been saving this one. It's a personal favorite that I came up with myself at the end of 2012. I was working on a parking meter project with the City of San Francisco. They had the Latitude and Longitude of each of the 27,000 meters in the city. I wanted to someone at the central office to be able to see what someone out in the field doing collections was seeing, so I came up with a way to show an interactive Google Streetview for each meter. Once I figured out the correct URL (and parameters in the URL) it was as easy any other URL Dashboard action in Tableau. I'm pretty convinced that I was chosen to speak at TCC last year because of this little trick. Sasha and Morgan told me they'd never seen anyone do it before. So, with out further ado, I give you the Google Streetview hack.
I've had enough of Superstore data for a while. I've gone a grabbed a list of US State Capitals from Wikipedia, and I'm going to use that table as my data source. We're going sightseeing on state capitals around the country! Here we go.
First we're going to make a map showing all the state capitals. In the data, create a State, City hierarchy (Select them both, right click and select "Create Hierarchy" - make sure state is on top of city). Double click "State" and you should see dot in each state. Hover over the State pill on the detail shelf, and hit the plus sign to get to the city level. I excluded Hawaii and Alaska (not from my bucket list, just from the map), and changed the circles to gold stars - It makes them very capital-like. It looks like this:
That's pretty much it for our dev on the sheet. We're now going to make a dashboard. This sheet will make up the top half and the Streetview will be on the bottom half. I've size dashboard to be "iPad Portrait" in case you're interested. I dropped the map in and followed that with a web page container, leaving the URL blank and hit ok. At the moment it should look like this:
Now for the trick. Click the map and go up to Dashboard>>Actions>>Add Action>>URL
Side note, I've just spent the last two hours trying to get a workaround from the "new" Google Maps which appears to have been my URL Streetview link. As such, the only way I could make this trick work is to use Bing. I never thought I'd see the day. Thanks a lot Google.
Back to the program. Tell the action to run on click. In the URL, paste the following:
http://www.bing.com/maps/?v=2&cp=<Latitude (generated)>~<Longitude (generated)>&lvl=10&sty=x~lat~<Latitude (generated)>~lon~<Longitude (generated)>~alt~296.433~z~30~h~258.3~p~-29.1~pid~5082&app=5082&FORM=LMLTCC
It's not quite the same as the Streetview used to be. But it is what it is.
You now have the ability to click a city and get the interactive streetview. It should look like this:
Here's the dashboard. If anybody can get the streetview to work, I'll buy you a Coke at TCC.
Many thanks -
Nelson
Nelson, Try changing the URL for Google Streetview to this format.
ReplyDeletehttps://maps.google.com/maps?q=39.198766,-84.53212&layer=c&z=17&sll=39.198766,-84.53212&cbp=13,276.3,0,0,0&cbll=39.198766,-84.53212&hl=en&ved=0CAoQ2wU&sa=X&output=svembed&layer=c
Example here:
http://public.tableausoftware.com/profile/#!/vizhome/shared/P7CRPWNB6
nice blog , very helpful and visit us for VISUALIZATION SERVICES in UK
ReplyDelete