Okay so perhaps I got a little overexcited about the moving visualisation demo. Let's work on something more social.
The Foursquare API let's you pull back your user data. So we're going to take that data and generate a map of checkins from it.
1. Get thy data.
Easy enough from the Foursquare API explorer you can copy/paste the full url with authorisation key.
Use curl to pull the data down:
curl https://api.foursquare.com/v2/users/self/checkins?oauth_token=[authtoken]\&v=[yyyymmdd] > data.json
2. Getting the data frames ready in R.
The Google Map method (gvisMap()) requires the location (either lat:lon or postcode) in an array and an another for the labels (or tips) when the pin location is clicked. The snippet below loads the Google Visualisation API for R and the we load our saved JSON data into R as a data.frame. Lastly we create two vectors, Postcodes and Tip. For this example I'll be using Lat/Lon locations.
library(googleVis)
checkins = fromJSON('/work/rails/foursquare/data.json')
Postcode <- c()
Tip <- c()3. Iterating the locations
Now we need to cycle through the checkins and place the data in the respective vectors. The locations are colon separated so the paste function is used to concat them together.
for(n in 1:length(checkins$response$checkins$items)) {
locationname = checkins$response$checkins$items[[n]]$venue$name
location = paste(checkins$response$checkins$items[[n]]$venue$location$lat, checkins$response$checkins$items[[n]]$venue$location$lng, sep=":")
Postcode <- c(Postcode, location);
Tip <- c(Tip, locationname)
}4. Generating the map
Create a data.frame and add our two vectors
df <- data.frame(Postcode, Tip)
Next use the googleVis library to pull everything together and generate our map.
M2 <- gvisMap(df, "Postcode", "Tip", options=list(showTip=TRUE, mapType="normal"))
Lastly plot the map on screen
plot(M2)
How we gawped in wonder at Han Rosling's TED talk. Now you can create your own! Yes you can, with R! In four lines! Don't believe me?
library(googleVis) data(Fruits) M = gvisMotionChart(data=Fruits, idvar="Fruit", timevar="Date", chartid="Fruit") plot(M)
Done! Click here to see it working.
It generates the html code for you, I've saved one on my Dropbox so you can see it working below. Press the play button, tis cool. The GoogleVis library covers the majority of the Google Visualistion API so all the map stuff is there as well. Powerful stuff.
A question to myself the other day, what's in an email address. It's what defines us, a central point in time and space. Our identity, our login and our method of communication.
So what finger prints are we leaving behind..... if you're into social media, loads.
If there's one sentence I hear most of from people wanting to start something it's that. I'm not talking about the tech startup scene or investment vehicles to exit a company with a 3.5x multiplier. I'm talking about something a lot simpler, someone just wanting to make a decent living from week to week.
The reality is that if you want to set up as a hairdresser, window cleaner or open a small popup shop then there are going to be startup overheads.So that's been done startups, we can move on now, done, finito it'll transform retail, well it won't but it's a great hyperbowl to chuck the tech press and get them all exited. So here's where I want it to go....
Consumer wants are based on the psychological instinct. Like Jesse J's outfit you'll scramble to to Google to try and find it or something remotely like it (well I won't as I don't have that sorta fringe). It's time to look at the medium again, watching stuff moving stuff.
Time to rethink the set top box interactions, it was the reason that the Java programming language was originally developed, inter connected consumer devices especially the telebox. So imagine that you're watching Mad Men and that lovely dress comes on, a quick ping of the red button will bring you the online purchasing options (there's a fashion API I know of ripe for the picking)
Your satellite subscription is linked to your payment card or bank account so that's the payment of the product sorted out. The majority of startups are obsessed with the web as the platform and the constant mentioning of putting stuff in the cloud. The reality is that potential customers are all over the place and watching television is still a time chewing pasttime, we just need to make the shopping connection a little better.
Time to play with the Java TV API me thinks :)
For ten long years, possibly longer, I knew this day was coming. Since the idea of floating data and API's was a dream in the bowl of my hipster hat, I knew the day would happen.
And boy did it happen.... with the "Girls Around Me" app.Okay I agree the copy used on the website doesn't help matters at all but there's nothing like a storm in a very small teacup to get the tech press on their keyboards bashing away until the sentences come flying out. The issue here my friends is not the app itself. The girl aspect, while not the be all and end all of apps but causes the most prudish of journalist to come out all guns blazing. It's far more ingrained than that.
If the app were "Dog Walkers Around Me", or "Coffee Lovers' Around Me" then I'm working on the assumption that no one in the tech press would have batted an eyelid about the content nor the main issue with all of this. The main issue is the use of data for the taking.... As soon as you link your Foursquare account and Facebook account together you become a targeted dream. We now know all your likes, friends and connections and where you are. And you gave it to us for free, the most treasured jewels in your closet, the secret stuff you just handed on a plate. And now with added API loveliness you just gave it to everyone else too. With the likes of Grindr and Blendr they are very closed networks, signup and sign in but only be seen by other users on the closed system. Startups hate going this route as it takes up time to build audience. For me it's the best solution, you know your user base and you control the currency, namely the data, that can be used be third parties.