Use Rstats to Share Google Map Stars with Friends
This article is originally published at https://mikejacktzen.wordpress.com
On my trip to Japan, I took this photo of the stairs leading to the “Rucker Park of Tokyo.” I crossed up some Tokyo cats, they were garbage. That one girl behind the blue pillar was practicing her hip hop power moves. She thought no one could see, but I saw.
I’ve been traveling. I’ve been starring places on google maps. I want to share my recs with friends. I also want to receive recs from friends. See this wired article that came out today!
ONE DUMB SNAG: YOU CAN NOT DO THIS SMOOTHLY USING PURE GOOGLE TOOLS
“Google Maps” (what you use on the phone) exports ‘.json’ data
yet
“Google My Maps” (what you share with friends) CANNOT import ‘.json’ data
https://productforums.google.com/forum/#!topic/maps/Ms6ouQuA4qI
For something like this, Gavin Belson would rip a new hole in some unsuspecting Hooli employee. I really hope the engineers of “Google (My) Maps” eventually roll out a backend feature that would make this post obsolete.
DUMB SNAG ELIMINATOR: #RSTATS IS AWESOME
This is why you’re here, we’re going to fill the middle gap with a very easy #rstats script.
Step 1) Google Takeout > Google Maps (your places) > export json
Step 2) Use R to manipulate json then export a csv spreadsheet
R:::jsonlite::fromJSON()
R:::dplyr::filter()
R:::base::write.csv()
Step 3) Google My Maps > Upload csv spreadsheet via Drag + Drop
https://support.google.com/mymaps/answer/3024925?rd=1
Step 4) Share the url link of your new map with friends
Here’s my Google My Maps of Japan
Spread the word, use this method, play a game of around the world… around the world , and share your recs.
PS, Shoutouts to seeing Slow Magic at O-nest in Shibuya
PPS, Sending good vibes for the recovery from the recent earthquake.
HERE IS THE MEAT OF THE #RSTATS CODE FOR STEP 2 (ABOVE). LOOK AT HOW SHORT AND ‘HUMAN-READABLE’ THE SYNTAX IS.
library(jsonlite) library(dplyr) # read in .json data # Google ->; Takeout ->; Google Maps (My Places) ->; Saved Places.json # https://en.wikipedia.org/wiki/Google_Takeout txt = '~/projects/Saved Places.json' dat = fromJSON(txt, flatten = TRUE) # keep the useful parts df_feat = flatten(dat$features) df_dat = df_feat %>% select(`properties.Location.Business Name`, `properties.Location.Address`, `properties.Location.Geo Coordinates.Latitude`, `properties.Location.Geo Coordinates.Longitude` ) # subset to specific geographies # method 1, grep for state in address (easier) dat_jap = df_dat %>% filter(grepl(pattern='Japan',x=properties.Location.Address)) # export to a csv spreadsheet write.csv(dat_jap,file='~/projects//dat_jap.csv',row.names=FALSE) # upload csv into Google My Maps to share
Thanks for visiting r-craft.org
This article is originally published at https://mikejacktzen.wordpress.com
Please visit source website for post related comments.