Create direct links to GPS location-specific webpages

Very few websites have implemented the new javascript GPS geolocation features that were intruduced with HTML 5. However, there are a few sites that use latitude and longitude directly in their URLs.
I first wanted a quick way to get my current latitude and longitude while looking at Heavens Above. It’s a great site that allows you to find visible satellites based upon your current location. Here’s the bookmarklet that I created:
javascript:navigator.geolocation.getCurrentPosition(function(g){c=g.coords;z=c.altitude;z=z?z:0;d=new Date(2009,0,1,0,0,0,0).toLocaleString().substr(-3,3);window.location="http://www.heavens-above.com/?lat="+c.latitude+"&lng="+c.longitude+"&alt="+z+"&loc=iPhone&tz="+d;},function(){alert("Permission denied.")});
Copy this to your bookmarks, and then when accessed on an iPhone, it will directly load the site with your current location entered!
I had to jump through several hoops here. When the altitude is not available (when only using cell-tower triangulation), the javascript code returns null. The website only supports numeric values, so z=z?z:0 replaces the null with a 0. Secondly, the website needs the local timezone, but unfortunately it only accepts a small subset of the three letter codes (and not the numeric offset from UTC). Even worse, the daylight savings version of the code (EDT/CDT/MDT/PDT) are unsupported – the site just assumes that you follow the trend (sorry Arizona). So I grab the code from January 1, 2009 (when daylight savings is not in effect), and parse the three letter code from that string.
For most sites, you’d only need something of the form (The NOAA’s weather forecast, for example):
javascript:navigator.geolocation.getCurrentPosition(function(g){c=g.coords;window.location="http://forecast.weather.gov/MapClick.php?lat="+c.latitude+"&lon="+c.longitude;},function(){alert("Permission denied.")});
Now if only I could find a way to save the javascript bookmark to the Home Screen, I’d be set!
Posted by Matt on Aug 06, 2009
(also: how to fix Consolas' baseline)

With the release of Windows Vista, Microsoft included six new fonts that they commissioned for the occasion. They are the new defaults for Vista and Office. They’ve also made them available for Mac through Office as well as a handful of free (as in beer) utilities. I got them by following these instructions.
These new modern fonts are explicitly designed for display on computer screens with ClearType. Although Apple has a different philosophy on font rendering, the same basic premise is used in OS X. Besides all that (or, rather, because of it) these fonts are very pretty.
But there’s a problem, and you can see it in the image above. When packaging these fonts up for the Mac, Microsoft goofed on the baseline for Consolas. The icon previews below show it much more obviously.

In short: it’s annoying. And wrong. And the fix is after the break.
Continue Reading…
Posted by Matt on Mar 15, 2009
Every once and a while, someone figures out a creative and astute way to represent the data behind some of those talking points. Here are a few I’ve run across over the past few months:
Whose taxes?

Drill, Baby, Drill.

All those overpriced “overhead” projectors

Posted by Matt on Oct 20, 2008

Dad and Ben came down to Chicago for the Blues Festival. It was quite a blast, and dad put up some of the pictures on his website. Boy, did they wear me out! I tell ya’ — it’s a lot of work bouncing around the city every day!
Posted by Matt on Jun 10, 2007

Well, not quite. This picture is on my way home from biking the Lake Shore Drive. It was wet and rainy until they kicked us off the road, at which point the sun immediately emerged and the clouds completely cleared from the sky. I got two flats, as well. (The first was from a shard of glass, which I fixed with the spare I brought along. I went to the bike-fixing-station to get it pumped up, and the guy there promptly broke the valve.) Even so, it was great to get back on the bike and just cruise without interruption.
And yes, I am missing a tooth.
Continue Reading…
Posted by Matt on May 29, 2007