Showing posts with label TransitVis. Show all posts
Showing posts with label TransitVis. Show all posts

Friday, April 25, 2014

Bay Area Bike Share - Data Challenge

I've put together an entry for the Bay Area Bike Share Data Challenge.  The challenge involved a fun data set containing individual trips and bike availability data.

It's an iOS app, because that's what I do.  Even better, it's a script in the WhirlyViz app.

Popular Trips

The Entry


My entry to the competition is the app.  More specifically, it's the Bay Area Bike Share Stats visualization within WhirlyViz.

First, go install WhirlyViz.  It's fine, I can wait.



Next, find the "Bay Area Bike Share Stats" entry.


There's instructions in the upper left.  But just go ahead and tap on things.  No one reads the instructions.

The Video


Don't have an iPad or iPhone?  It's cool, I won't tell anyone.  You can just watch the video.



The Technology


The display part here is WhirlyViz, my geospatial data display engine based on the WhirlyGlobe-Maply library.  Since moving to Javascript for the configuration files, I've put together some interesting examples.  The BABS visualization is the most complicated thus far.

I'm really liking how much control I have with the Javascript support.  I can start to tell a story with the data and point out things along the way.  I'm parsing a couple varieties of JSON from different sources, but it's all pretty seamless to the user.

The back end technology is PostgreSQL running on an Amazon ec2 instance with a simple node.js front end.  This is the first time I've bothered to stand up something like that and it was interesting.  It makes me appreciate the commercial services and what they do.

Bonus Visualization


It turns out several cities use the same format for their bike availability feed.  Look for the "City BikeShares" entry in WhirlyViz.





Thursday, April 10, 2014

WhirlyViz: GeoTrellis Transit

With WhirlyViz 1.3 we have a lot more flexibility in how we talk to back end services.  I'm having a blast wiring up all sorts of interesting geospatial engines.  Today's is the GeoTrellis Transit API from Azavea.



You can outrun the zombie outbreak on a bike.


GeoTrellis Transit


You should go check out their web page, but I’ll give you the quick version.  GeoTrellis Transit provides an API for answering questions about a travelshed.  You can use it to figure out how far a commuter could get using standard modes of transportation from point A to a variety of points’ B.

Can't beat rail for getting around.


Presumably you’d use this for urban planning, decision making and such.  Seems useful and it's fun to play with in a wonky sort of way.

WhirlyViz Demo


The GeoTrellis example is right up top in WhirlyViz 1.3.  Feel free to install that and give it a go.  Tap and hold to move the travelshed’s center.



Like all the of the newer examples, the WhirlyViz configuration is controlled by Javascript.  It was fairly simple to talk to the WMS server they provide, even not explicitly using the WMS functionality in WhirlyGlobe-Maply.  Constructing the rest of the parameter string was a cinch.

Sunday, April 6, 2014

WhirlyViz 1.3 - Javascript Update

WhirlyViz is a geospatial visualization engine for mobile devices.  It's based on my WhirlyGlobe-Maply open source library.  With it, you can whip together a pretty data visualization for an iPad or iPhone.



I license the engine to clients, but the WhirlyViz app is free and the best demonstration of the engine itself.

Javascript


WhirlyViz is eminently configurable.  That's kind of the point, but I wasn't entirely satisfied with what we had in 1.2.  Now I know why.  With version 1.3 we've switched to Javascript.

Apple added support for JavaScriptCore in ios7.  They put together a fairly nice bridge between Objective-C and Javascript to go with it.  This gives you a clean, empty Javascript interpreter to use in your app.

That's just what I did.  WhirlyViz configuration files are now Javascript.  Whenever a user taps on something, or a remote vector tile needs to be loaded, or even when the visualization starts up you're running a Javascript function.

This example talks to a WMS server.


It's incredibly flexible and as long as it's not in the main rendering loop (good grief no!) still very fast.  There are other advantages too.

Everything Speaks JSON


These days every remote web service speaks JSON.  [Except for the ones that don't].  Using Javascript makes it much easier to decode a random JSON return value and do something visual with it.

SF Bay Area Bike Share

For example, several public bike share companies provide JSON feeds with up-to-the-minute station availability.  They have spatial data, but not as GeoJSON.  That's kind of annoying, but now easily fixed.
  • We fetch the appropriate feed in the script
  • Parse the JSON return and iterate through the records
  • Pull out location data and anything we might want to display
  • Convert the data to GeoJSON and hand it back to WhirlyViz

WhirlyViz still knows nothing about the JSON feeds from the bike share companies, it's just displaying GeoJSON with some styling info.  The script has all the smarts and, best of all, it wasn't all that much code.

Running Your Own Script


WhirlyViz has its own URL scheme for displaying data.  Refer back to this post for details.

Now you can run your own Javascript configuration file too.  Just specify it like so.


The script argument tells WhirlyViz we're running a script and the js argument tells it where to go get it.  Of course, then you have to write one of these and the documentation is... lacking.

Wrapup


You can see some of the new examples in the latest WhirlyViz update.  I'm now talking to two new geospatial data services which will get their own blog posts.

I'm very happy with this approach and I'll be writing up the Javascript functions shortly.  You can kind of figure it out from the examples, but documentation is important.

In the mean time, if you have a neat visualization you'd like to see on mobile, hit me up and we'll talk.

Friday, March 21, 2014

WhirlyViz 1.2 - Update

The latest WhirlyViz is on the app store.  It's a bit faster, more reliable and has better navigation, particularly for the phone.  But most importantly, there's new functionality.

San Francisco is very brown today
If you're just tuning in, WhirlyViz is a geospatial display app for iOS which I've discussed before.  It's based on client projects and a few of my own.  One of those was.....

TransitVis


The TransitVis app was an experiment and an entry for a hackathon.  It was a great way to work through some data viz issues without a client breathing down my neck.  We can now duplicate the TransitVis app with a configuration file.

Like many of the other examples, I'm using CartoDB on the back end.  When the user changes parameters or taps on a data value it's sending off a SQL query.

The 14 isn't transit, it's dinner and a show.

Election Map


Everyone needs an election map!  With the 2014 midterms coming up, I'd love to see some WhirlyViz based election maps in prominent apps.  And if not, there's always 2016...

The only time Ross Perot is described as "pretty".

I put this one together from county census voting data from 1980 to 2008 and used the Purple America algorithm to get some nice blended colors.  The 1992 election is interesting since there was a third party candidate and you get some green.

Next for WhirlyViz


Demos, demos, demos.  More demos is the main thing.  I'm lining up a few with collaborators rather than writing any more of my own.

I've also been experimenting with Javascript in the configuration files.  I like it!  There will be more of that.

Thursday, February 27, 2014

WhirlyViz Demo

The other day I was planning to give a short talk on WhirlyViz at the San Francisco GeoMeetup.  Due to equipment problems it never happened.

Rather than let slides go to waste, here's the talk in video form.



You can get WhirlyViz on the app store.

The URLs I use as examples can be found in a previous blog post.

Saturday, April 6, 2013

TransitVis - Urban Data Challenge

TransitVis is live on the Apple app store for iPad.  It's a free download.  Watch the video to learn how to use it.



Don't forget to go get some data.  That's sold separately (also free).

The Urban Data Challenge awards were today and we took 3rd.  Thanks to everyone involved in that.  Lots of great projects.

What's next for TransitVis, you might ask?  All the interesting technology is in WhirlyGlobe-Maply so that'll be popping up in client projects.  For the app itself... we'll wait to see if anyone uses TransitVis for anything and go from there.

Thursday, April 4, 2013

TransitVis - How to Load Data

This post is about loading data into TransitVis.  I cover this in the announcement post for TransitVis, but it can't hurt to be even more explicit.  Plus I need something to link to from the app.

What does it mean?  Dunno.  Pretty!

How to Get Some Data


Once you've got the app, you'll need to load some data.  We processed all three of the data sets for use.  A data set consists of two geojson files and a sqlite database for each data set.  Be sure to download all three files and then upload them to the app via iTunes.

Getting Data Into TransitVis


Getting data into an app once you've installed is actually pretty easy.  Install the app first and then follow Apple's instructions for file sharing via iTunes.  Look for the app "TransitVis" in that window.

Here's what that looks like on my MacBook Pro.  Bring up iTunes.

Next page is all Hello Kitty apps

Select your iPad, like mine in the upper right there.  That should look like so.


That's right, rename your iPad 'mousebird'. [Don't do that]

Select the Apps tab up there along the top.  Then you should see something like this.

Only you're not trying to hide the name of client apps.

Select TransitVis and upload those files.

If you already ran the app, you'll need to kill it and rerun it as TransitVis looks for its data files on startup.  It should load the first data set it finds and make the others available for selection.