<p><div><div><div><div data-width="100" data-show-faces="false" data-send="true" data-layout="button_count" data-height="21" data-href="https://www.r-bloggers.com/use-rstats-to-share-google-map-stars-with-friends-2/"></div></div><div><a data-url="https://www.r-bloggers.com/use-rstats-to-share-google-map-stars-with-friends-2/" data-counturl="https://www.r-bloggers.com/use-rstats-to-share-google-map-stars-with-friends-2/" data-count="horizontal" data-text="Use Rstats to Share Google Map Stars with Friends" class="twitter-share-button" data-via="rbloggers" href="https://twitter.com/share"></a></div><div></div></div><div></div></div>
<div>
(This article was first published on <strong><a href="https://mikejacktzen.wordpress.com/2016/11/21/use-rstats-to-share-google-map-stars-with-friends/"> rstats – MikeJackTzen</a></strong>, and kindly contributed to <a rel="nofollow" href="https://www.r-bloggers.com/">R-bloggers)</a> </div>
<p>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.</p>
<p><img sizes="(max-width: 510px) 100vw, 510px" alt="IMG_20160610_214219.jpg" class="wp-image-406" src="https://i0.wp.com/mikejacktzen.files.wordpress.com/2016/06/img_20160610_214219.jpg?resize=456%2C257&ssl=1" data-recalc-dims="1"></p>
<p>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 <a target="_blank" rel="nofollow" href="https://www.wired.com/2016/11/use-google-maps-plan-awesome-vacation/">wired article</a> that came out today!</p>
<h1>ONE DUMB SNAG: YOU CAN NOT DO THIS SMOOTHLY USING PURE GOOGLE TOOLS</h1>
<p>“Google Maps” (what you use on the phone) exports ‘.json’ data</p>
<p>yet</p>
<p>“Google <span><strong>My</strong></span> Maps” (what you share with friends) <strong>CANNOT </strong>import ‘.json’ data</p>
<p><img sizes="(max-width: 800px) 100vw, 800px" alt="1268198584550505870.png" class="wp-image-401" src="https://i2.wp.com/mikejacktzen.files.wordpress.com/2016/06/1268198584550505870.png?w=456&ssl=1" data-recalc-dims="1"></p>
<p><a target="_blank" rel="nofollow" href="https://productforums.google.com/forum/#!topic/maps/Ms6ouQuA4qI">https://productforums.google.com/forum/#!topic/maps/Ms6ouQuA4qI</a></p>
<p>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.</p>
<h2>DUMB SNAG ELIMINATOR:  #RSTATS IS AWESOME</h2>
<p>This is why you’re here, we’re going to fill the middle gap with a very easy #rstats script.</p>
<p>Step 1) Google Takeout > Google My Maps > export json</p>
<p>Step 2) Use R to manipulate json then export a csv spreadsheet</p>
<p>R:::jsonlite::fromJSON()</p>
<p>R:::dplyr::filter()</p>
<p>R:::base::write.csv()</p>
<p>Step 3) Google My Maps > Upload csv spreadsheet via Drag + Drop</p>
<p><a target="_blank" rel="nofollow" href="https://support.google.com/mymaps/answer/3024925?rd=1">https://support.google.com/mymaps/answer/3024925?rd=1</a></p>
<p>Step 4) Share the url link of your new map with friends</p>
<p>Here’s my Google My Maps of <a target="_blank" rel="nofollow" href="https://drive.google.com/open?id=17FEHPl22Bb-4yY_Cc-scmhZm4C0&usp=sharing">Japan</a></p>
<p><img sizes="(max-width: 451px) 100vw, 451px" alt="Screen Shot 2016-06-10 at 10.40.06 PM" class="wp-image-415" src="https://i0.wp.com/mikejacktzen.files.wordpress.com/2016/06/screen-shot-2016-06-10-at-10-40-06-pm.png?resize=451%2C287&ssl=1" data-recalc-dims="1"></p>
<p>Spread the word, use this method, play a game of around the world… around the world <img alt="😉" class="wp-smiley" src="https://s.w.org/images/core/emoji/2/72x72/1f609.png"> , and share your recs.</p>
<p>Shoutouts to <a target="_blank" rel="nofollow" href="https://twitter.com/slowwwmagic?lang=en">Slow Magic</a> and O-nest in Shibuya</p>
<p><a title="View on Instagram" target="_blank" rel="nofollow" href="https://www.instagram.com/p/BEFjoeIjP_g/"><img alt="Instagram Photo" src="http://instagr.am/p/BEFjoeIjP_g/media/?size=l"></a></p>
<h2></h2>
<h2>HERE IS THE MEAT OF THE #RSTATS CODE FOR STEP 2 (ABOVE). LOOK AT HOW SHORT AND ‘HUMAN-READABLE’ THE SYNTAX IS.</h2>
<pre>

library(jsonlite)
library(dplyr)

# read in .json data
# Google -&amp;gt; Takeout -&amp;gt; Google Maps (My Places) -&amp;gt; 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 %&amp;gt;% 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 %&amp;gt;%
 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
</pre>
<p> <a target="_blank" rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/mikejacktzen.wordpress.com/508/"><img alt="" src="http://feeds.wordpress.com/1.0/comments/mikejacktzen.wordpress.com/508/" border="0"></a> <img alt="" src="https://i1.wp.com/pixel.wp.com/b.gif?resize=1%2C1&ssl=1" border="0" data-recalc-dims="1"></p>
<p><div><div><div><div data-width="55" data-show-faces="false" data-send="true" data-layout="box_count" data-height="62" data-href="https://www.r-bloggers.com/use-rstats-to-share-google-map-stars-with-friends-2/"></div></div><div><a data-url="https://www.r-bloggers.com/use-rstats-to-share-google-map-stars-with-friends-2/" data-counturl="https://www.r-bloggers.com/use-rstats-to-share-google-map-stars-with-friends-2/" data-count="vertical" data-text="Use Rstats to Share Google Map Stars with Friends" class="twitter-share-button" data-via="rbloggers" href="https://twitter.com/share"></a></div><div></div></div><div></div></div>
<div>
<div>To <strong>leave a comment</strong> for the author, please follow the link and comment on their blog: <strong><a href="https://mikejacktzen.wordpress.com/2016/11/21/use-rstats-to-share-google-map-stars-with-friends/"> rstats – MikeJackTzen</a></strong>.</div>
<hr>
<a rel="nofollow" href="https://www.r-bloggers.com/">R-bloggers.com</a> offers <strong><a rel="nofollow" href="https://feedburner.google.com/fb/a/mailverify?uri=RBloggers">daily e-mail updates</a></strong> about <a title="The R Project for Statistical Computing" rel="nofollow" href="https://www.r-project.org/">R</a> news and <a title="R tutorials" rel="nofollow" href="https://www.r-bloggers.com/?s=tutorial">tutorials</a> on topics such as: <a title="Data science" rel="nofollow" href="https://www.r-bloggers.com/?s=data%20science">Data science</a>, <a title="Big Data" rel="nofollow" href="https://www.r-bloggers.com/?s=Big%20Data">Big Data, <a title="R jobs" rel="nofollow" href="https://www.r-users.com/">R jobs</a>, visualization (<a title="ggplot and ggplot2 tutorials" rel="nofollow" href="https://www.r-bloggers.com/?s=ggplot2">ggplot2</a>, <a title="Boxplots using lattice and ggplot2 tutorials" rel="nofollow" href="https://www.r-bloggers.com/?s=boxplot">Boxplots</a>, <a title="Maps and gis" rel="nofollow" href="https://www.r-bloggers.com/?s=map">maps</a>, <a title="Animation in R" rel="nofollow" href="https://www.r-bloggers.com/?s=animation">animation</a>), programming (<a title="RStudio IDE for R" rel="nofollow" href="https://www.r-bloggers.com/?s=RStudio">RStudio</a>, <a title="Sweave and literate programming" rel="nofollow" href="https://www.r-bloggers.com/?s=sweave">Sweave</a>, <a title="LaTeX in R" rel="nofollow" href="https://www.r-bloggers.com/?s=LaTeX">LaTeX</a>, <a title="SQL and databases" rel="nofollow" href="https://www.r-bloggers.com/?s=SQL">SQL</a>, <a title="Eclipse IDE for R" rel="nofollow" href="https://www.r-bloggers.com/?s=eclipse">Eclipse</a>, <a title="git and github, Version Control System" rel="nofollow" href="https://www.r-bloggers.com/?s=git">git</a>, <a title="Large data in R using Hadoop" rel="nofollow" href="https://www.r-bloggers.com/?s=hadoop">hadoop</a>, <a title="Web Scraping of google, facebook, yahoo, twitter and more using R" rel="nofollow" href="https://www.r-bloggers.com/?s=Web+Scraping">Web Scraping</a>) statistics (<a title="Regressions and ANOVA analysis tutorials" rel="nofollow" href="https://www.r-bloggers.com/?s=regression">regression</a>, <a title="principal component analysis tutorial" rel="nofollow" href="https://www.r-bloggers.com/?s=PCA">PCA</a>, <a title="Time series" rel="nofollow" href="https://www.r-bloggers.com/?s=time+series">time series</a>, <a title="finance trading" rel="nofollow" href="https://www.r-bloggers.com/?s=trading">trading</a>) and more...
<img height="1" alt="" width="1" src="http://feeds.feedburner.com/~r/RBloggers/~4/9JD67mB-S34"></a></div>