Status

Location
London, England
Subscribe to GeoRSS Subscribe to KML


Web

Sunlight Datakit - Congress in your App

Published in Mashup, Programming, Ruby, Web


Sunlight Labs has released a public API, their Sunlight Datakit. It’s a straight-forward, simple API for getting access to their Civic data, like Congressional Representatives, zipcodes, timezones, and some geographic information.

There is some basic information about elected representatives that makes politico mashups easier: the ability to tie a name to a state, the district and zip codes that they represent, their office telephone number, and so on. We have put together a simple labs “datakit” that does this for us, drawing from several publicaly available data sources. We are making this fully available and have provided a fully documented API for the methods we have developed for those sources. Find out about the datakit here.

Of course, any API needs a nice little client to tie it into your applications. Here is my Ruby client. It’s very simple, because is uses the fallback method_missing to handle any function passed to the class. This also allows the class to be extended by implementing specific methods if more processing of the response is needed.

require 'open-uri'
require 'rexml/document'
require 'cgi'
SUNLIGHT_HOST = 'http://sunlightlabs.com/datakit/'

class Sunlight
  def self.method_missing(service_method, *args)
    params = args[0].collect {|k,v| CGI.escape(k.to_s) + '=' + CGI.escape(v.to_s)}.join('&')
    url = SUNLIGHT_HOST + service_method.to_s + "?" + params
    open(url).read.split("|")
  end
end

resp = Sunlight.getDistrictFromZip5({:zip => 20740})
puts resp.inspect
  # MD:5
  # MD:4

resp = Sunlight.getRepresentativeNameFromCityState({:city => 'Detroit', :state => "MI"})
puts resp.inspect
  # Kilpatrick, Carolyn C.
  # Conyers, John  Jr.
  # Levin, Sander M.
  # McCotter, Thaddeus G.
  # Dingell, John D.

The Sunlight Datakit currently offers the following functions. Check out the documentation for information on the parameters and returned values.

  • getDistrictFromZip5
  • getStateFromZip5
  • getDistrictFromZip9
  • getStateFromZip9.php
  • getRepresentativeNameFromDistrict
  • getRepresentativePhoneNumberFromDistrict
  • getRepresentativeRoomNumberFromDistrict
  • getCityFromZip5
  • getCityStateFromZip5
  • getLatitudeFromCityState
  • getLongitudeFromCityState
  • getZipCodesFromCityState
  • getTimezoneFromCityState
  • getRepresentativeNameFromCityState
  • getRepresentativeNameFromState
  • getStateAbbreviationFromStateName
  • getStateNameFromStateAbbreviation

Mapping the text in books

Published in Geo, Google


Gutenkarte was an amazing thing to see, mapping the locations within a book. However, it is only able to map and share public domain material.

Now GoogleBooks supports mapping of locations mentioned in books they’ve archived. See Lonely Planet USA for the locations mentioned in this travel guide. A great way to preview what locations the book focuses on and covers. (via hobu, via import cartography)

Or for fictional books, such as Neal Stephenson’s Quicksilver it can help you decipher what happened where.

Google has the benefit of being able to store and share the text for currently copyright material, which is a definite benefit. But the integration of maps really adds to the information and understanding of the material.


Google’s ‘Geographic Web’ and conflicting interfaces

Published in Geo, GeoRSS, Google


Brady points out on O’Reilly Radar some of the new layers in GoogleEarth. Most interesting though is his recap of feedback from Flickr’s Dan Catt on why Google isn’t currently displaying Flickr photos (despite perhaps the obvious that (Flickr! < Yahoo!) != Google).

His claim is that they take their bounding box parameters in different order: bbox=x1,y1,x2,y2. vs. box=x1,y1,x2,y2. However, based on my research of the API's, they look comparable. For example, Google Earth's view based refresh will do a bounding box request:

longitude_west, latitude_south, longitude_east, latitude_north

and the Flickr photo search expects the following BBox:

minimum_longitude, minimum_latitude, maximum_longitude, maximum_latitude

You can see that minimum_longitude is the same parameter as longitude_west, and so on. So I’m not sure why Dan Catt uses that as his explanation that the parameters don’t line up.

However, as Brady points out, what would really help everyone is if the services all spoke common languages, like Flickr outputting KML, or GoogleEarth consuming GeoRSS (since Flickr can output GeoRSS). My money would be on the latter, since there seems less impetus for a company like Flickr/Yahoo to export their data in a proprietary format.

Of course, the translation between the two formats, especially for basic geometry such as points, is trivial, so implementing both on both sides, or simple conversion utilities in the middle, would be straight-forward.

Extra Credit

For extra credit, implement said conversion utility to convert KML <=> GeoRSS using XSLT, or other language of your choice.

There are also various other Flickr/GoogleEarth utilities out there like displaying grids of the # of Flickr images in GoogleEarth.

Pleasant Surprise

While researching parts of this post, I found a new Flickr API method that I didn’t know existed before:

flickr.photos.getWithGeoData - “Returns a list of your geo-tagged photos.” However, you can’t do a search within this set other than by date. But at least now you can pull up a trail of your travels based on your photos.

“Where were you on the night of the 13th?!”

In the past, when using my Feed URL to get geotagged photos, I just made sure that photos had a tag “geotagged” and then grabbed all the photos with that tag.


C-list blogger & searching

Published in Web


w00t, I’m a — wait, that’s low right? C-List Blogger

Now how do I compare to those around me (vs. globally) - or within my “genre”? not that real “ranking” matters, but in general having ‘authoritativeness’ in search results is very useful, and supposedly how the back-end algorithms at Google (and I’m sure many other search engines) work. The more link-love you get from authoritative blogs, then the higher ranked you are.

Now, if this is the case, why when I search for various howtos and problems in programming do I just get links to Forum posts asking the same question, but not to the blog entry, IBM/Apple doc or whatever with the solution?

I want something like Amazon’s: 37% of the people that viewed this product, bought this other product

But instead, I want: 70% of people that viewed this webpage, found their solution (stopped searching) by going to this other webpage.


More Web3.0 “The Desktop” links

Published in Cocoa, Programming, Project, Rails, Web


I talked a little while ago about the enlightening insight of understanding more about how the next phase of Applications will be “desktop-deployed web applications”. This was inspired/aided by listening to the brilliance of people like Matt Webb. Using standardized, hopefully cross-platform technologies, it’s possible to develop your application once, and “push” it to any number of devices.

Ajaxian discusses Adobe’s new “Apollo”:

Apollo is client-based software that will run Flash applications separately from a browser, whether online or offline

The image shows an example travel application developed in Flash, and deployed to a desktop via Apollo. (via Digital Backcountry)

I also saw that Chris Messina is helping out on a project WebKit on Rails, whose goal is to make it easier to deploy Apple’s WebKit and also to “come up with new ideas and practices that leverage the WebKit platform”. WebKit is an excellent platform to develop desktop web apps, as it can be baked straight into a Cocoa application, but be accessing a “web application” that may be running locally on the users’ machine.

rails-app-installer allows you to bundle and install/uninstall a Rails application, including required gems.

$ gem install my_app
$ my_app install /some/path