Posts tagged Grand Rapids

Scraping Grand Rapids bus routes

The Rapid, the bus service for Grand Rapids and surrounding areas, recently redesigned their website. The redesign was long overdue and the result certainly looks a lot cleaner, if still far from inspiring. They’ve added a flash-based map showing their routes (though it could do with being a little larger on the page) and added PDF maps of each route (eg. this one for Route 6). Unfortunately as yet there’s no tool for working out routes, but that’s not a big surprise.

My favourite features, however, are not any of those mentioned above but the fact that each route now has a clean URL (eg. http://www.ridetherapid.org/ride/routes/6/) and a link to google maps for each stop, thereby exposing the coordinates of all the stops. With those two components in place, it becomes very easy to pull out the route data and begin to apply it to other uses. A ruby script (using _why’s excellent hpricot) to do just that would be:

#!/usr/bin/env ruby
require 'rubygems'
require 'open-uri'
require 'hpricot'
 
routes = (1..15).to_a.concat [24,28,37,44,49,50,51]
 
routes.each do |route|
  begin
    route_uri = "http://www.ridetherapid.org/ride/routes/#{route}/stops/"
    doc = Hpricot(open(route_uri))
    title = doc.at("h1").children[0].to_s.strip
    puts title
    stopList = doc.search("div#stopList table tr")
    (1..stopList.size).each do |row|
      unless stopList[row].nil?
        uri = stopList[row].at("a").attributes['href']
        name = stopList[row].at("a").children[0].to_s
        coords = uri.match(/q=(\d+\.\d+),\+(.*?)\&/)
        if coords.class == MatchData
          latitude = coords[1]
          longitude = coords[2]
          puts "#{name} on route #{route} is at #{latitude}, #{longitude}"
        end
      end
    end
  rescue => err
    puts "Problem retrieving #{route_uri}"
  end
end

With this data available, it immediately becomes possible for local people and organizations to make use of it in a variety of ways–businesses could easily show the nearest bus stops to their locations, listing services can help visitors plan their routes, and those of us who aren’t fans of the flash-map could use other services to build alternatives.

BarCamp Grand Rapids 2

This weekend was the inaugural BarCamp Grand Rapids. I was only able to make it for the day on Saturday, missing the previous evening’s introductions, talks, and trip to Grand Rapids Brewing Company, but it was good to be able to attend, and even better to have it just a short bike ride away.

It was a fairly small group that was gathered, so almost all of the sessions ran in a single room. Java developers were in the majority—probably not a surprise given that it was the local Java Users’ Group that put the event together—but those of us working with dynamic languages made sure that those languages got their share of mentions.

If anyone was hoping for a serious conflict in the ‘web frameworks smackdown’ they will have been disappointed, as we quickly seemed to come to an agreement that most of the time maintainability and scalability are down to the quality of the code as much as the choice of language/framework, and moved on to a quick demonstration of the building of a Rails app, and a discussion of the potential of JRuby.

Having never really worked with java, I enjoyed Kyle’s demonstration of the DWR ‘Easy Ajax for Java’ library which I’d read about but not seen in action. It still seemed like more work than RJS, but for those with an existing commitment to java it seems like a great help.

I had various ideas I’d contemplated presenting on, including ActiveResource, my Collage project and its use of Atom, and microformats. But time didn’t allow me to prepare the former two, and Andy had microformats pretty well covered in his (very interesting) ‘geo’ session, so I ended up running a quick demo of the Smart Pill Filemaker/PHP plugin, that seemed to be well received.

Overall, it was good to find some other people around Grand Rapids who have a good grasp of what’s happening in web development at the moment. Not being in a big city or getting to conferences, it can sometimes seem like all the innovation is going on elsewhere. Most of it is, but at least a few people around here are involved in working out where the web is going next.

BarCamp Grand Rapids

Kyle Adams posted in the comments on my RubyConf MI entry to say that the first BarCamp in Michigan will take place in Grand Rapids the weekend before RubyConf MI.

As I’ll be leaving for Greenbelt a few days later, I’m not sure that I’ll be able to make it for the whole thing, but I’m definitely planning to drop in for at least some of it. At last a tech conference within a bike ride of my house!

There’s more information at the Bar Camp Grand Rapids website. Since all attendees have to be presenters, I guess I’d better start coming up with a presentation…

Tags: ,

Grand Rapids GIS

A couple of weeks ago I attended my first Grand Rapids Perl Mongers meeting in order to hear a presentation about the City of Grand Rapids‘ efforts to build a GIS driven by perl and hosted on linux. The presentation was interesting, though the coverage of the technology used didn’t dig much deeper than “we used perl and linux because they’re free and we had staff who advocated them” and “this is all done in perl,” and I didn’t get a sense of a broad vision for the future potential of such a system (by contrast, the Mayor’s speech when launching the latest phase of citywide WiFi testing demonstrated a broad vision for enhancing city services through the use of pervasive technology).

My main interest in the city’s GIS is the potential of opening up city information for use by community organisations in location-aware applications. There is potentially considerable benefit for community organisations in being able to integrate with the city’s databases in order to pull out information about issues that affect their constituency (road closures, zoning hearings, etc) and for businesses in being able to integrate with details such as public transport stops and routes. I’m also interested in using it as a backbone for more participatory politics tools, as keeping track of ward boundaries can be a tricky process and is best managed in one place.

Sadly my questions regarding web services hooks for the GIS were met with a response that I could get hold of my own map data from their source, which wasn’t really what I was going for. I’ve followed up with emails, and hopefully will hear more soon, but don’t hold out much hope that there will be any potential for integration any time soon. It is frustrating that a relatively recently built system using tools which are touted in part for thei “open source” credentials should lack interfaces which needn’t be hard to implement and that would encourage a much broader uptake of the system to build a rich information environment.

Google Maps and Grand Rapids WiFi

For the past few weeks I’ve been meaning to play with myGmaps, and last night I finally got the opportunity. I’d introduced a map view to Grand Rapids WiFi a few months ago, but I’ve never been entirely satisfied with the map in use or the flexibility of the zoom, so I decided to explore what it would take to move that data onto a google map.

Generating the required XML was very straightforward. Between this piece at Engadget and the tools at myGmaps it was very simple to add a new Smarty template to the site and get everything up and running. It’s a shame google didn’t go with some more standardised vocabularies (it would be wonderful to be able to pipe the existing RDF version of the site straight in), but at least the format is simple.

What I did find, however, was that my browsers quickly became unstable. I’d never seen Firefox’s “A script is making Firefox become very slow, should I terminate it?” warning before last night, but plotting around 40 points on such a map triggered it. Reducing that to five points with an SQL LIMIT helped considerably, but at the cost of much of the map’s utility. The full maps is nice, but nowhere near stable enough to make a regular part of the site (I may put a link to it, but it will be with provisos).

I hope there’s a way to reduce the weight of this toolkit, as it’s definitely a far better map. If google were to launch a public API, perhaps we could start building more advanced applications which integrate directions and other tools. For now, it’s back to the drawing board for me, to try and work out a UI that lets me reduce the number of points plotted while still being useful for the user.

For those with plenty of RAM, you can find the full map at grwifi.net/gmaps/.