think logo

Site Info

Categories

Archives

Meta

Author

Geo

Museum

Recent Posts

Recent Comments

 

May 2008
S M T W T F S
« Jan    
 123
45678910
11121314151617
18192021222324
25262728293031

Geocoder.us

January 30, 2008

Today I found myself sitting in a classroom discussion when the need arose to figure out how far each of 344 survey respondents had come to the place where the survey was being conducted. The survey included the home zip code of the subjects, and we knew, of course, the zip code of the survey location.

While I was Googling for how to best geocode the zip codes, I happened to also ask in the #geo irc channel (on oftc.net) whether there were any free distance calculation web services. Rich Gibson, who constructed geocoder.us piped up and said he was adding to the API for its web services and did people have any requests. What luck! I asked for something that given two zip codes would return a distance.

Not long thereafter, here’s what he came up with:

  http://geocoder.us/service/distance?zip1=41080&zip2=02139

which would return the distance between Petersburg, KY and Cambridge, MA.

So I was off to the races! I copied the list of zip codes from the Excel spreadsheet and pasted them into an Emacs buffer, then saved them as ‘zips’. Then in the shell (I use tcsh…):

First to get rid of duplicates:

% sort zips | uniq > zips2

Then, loop through them. I put line breaks with continuation characters into the geocoder line to fit inside this blog post.

% foreach zip ( `cat zips2` )
foreach? echo ${zip} `curl \
“http://geocoder.us/service/distance?zip1=41080&zip2=${zip}” \
 | sed -e ’s/.*=//’ | sed -e ’s/ miles$//’` >> distances
foreach? end

And that’s it! I pasted the results back into the spreadsheet, got rid of the three bogus zipcodes in the data that resulted in errors from geocoder.us, used VLOOKUP to pull out the distances and I was done.

The service returned errors three times. I used the USPO zip code reverse lookup to verify that the codes were indeed bogus.

That’s my kind of web service. No WSDL, WADL, or WS-anything.

(Yes, I could have used Perl, Python, Ruby, etc. but I learned shell commands in 1981 before we had all that fancy stuff and it’s the first thing I try.)

Air, not yet.

January 21, 2008

One thing I didn’t buy yesterday was a MacBook Air. I went to the Chestnut Hill Mall Apple store to see what it looked like but they didn’t have any to show. The store won’t have any to look at for two more weeks.

Instead I ordered a MacBook from the Apple Education for MIT site (they are about $100 less there, and there’s a savings on AppleCare). When it gets here in a few days, I’ll clone my MacBook Pro’s hard drive to the MacBook and send the MBP to my son. They only thing I’ll miss, I suspect is the lighted keyboard, something I’ve come to like a lot. I ordered the 250GB drive and I’ll shop around for a RAM upgrade.

Then, with the savings, I’m thinking pretty seriously about an iPhone, something that would be fun to play with for the Museum Without Walls.

The iPhones I looked at at the Apple store had the new location detection firmware. The store is here but the phone indicated it was a good 1000′ southeast of the store, south of what’s labeled Holyhood Cemetery. That’s not exactly pinpoint accuracy. But the Skyhook wifi database may not have included the mall, and thus the iPhone was probably using the Google cell-tower locations to find itself. Skyhook claims 10-20m accuracy in urban areas. That sounds pretty reasonable to me.

Think Again

So I’m going to blame my recent lack of postings on my blog to the fact that, like Hobu, I was finding that a Plone-based blog was not so easy to deal with. I decided to jump into the blogging mainstream with WordPress, so here we go.

Along with the switch to WordPress, I’m going to expand from mostly geo-related topics to things I’m dealing with at MIT as well. So for those of you who want exclusively geo-news, link to the geo category and the geo feed in Atom, RSS, or RSS2.

I still have to switch over the Feedburner feeds and tweak a few more bits and pieces, but overall the new version is ready to go.

As I mention in the About page, I’ve kept the old blog intact so that all the permalinks still work.