Status

Location
Arlington, VA
Subscribe to GeoRSS Subscribe to KML


Howto

Bluelogger GPS

Published in Gadgets, Geolocation, Howto, Open-Source, Technology


For the past several months I’ve been playing with the Delorme Bluelogger GPS. It’s a very nice GPS receiver in its own right, but has the unique feature (for BT receivers) of including onboard logging. This is an great feature as it allows me to turn on the unit, toss it in my bag (somewhere on top, so it can still get a view of the sky) and forget about it. I don’t need to grab multiple devices, such as the receiver and a PDA or computer in order to receive and store my GPS waypoints.

This article will give a short overview of how to use the BlueLogger for a variety of applications. I use it primarily for geolocating photographs, but it’s also nice for any location-based activity.

The Bluelogger comes with the following:

  • Bluelogger device
  • Carrying case (with belt loop)
  • Car charger
  • Wall charger
  • Charging stand (can work with either car or wall charger)
  • Bluelogger Windows software

Connecting to GPS

To connect to the Bluelogger, you will need a bluetooth adapter. Many computers now come with bluetooth built-in or as an add-on option. If this isn’t the case, I would recommend the D-Link DBT-120. It’s probably the only D-Link product I can recommend, but I’ve had great luck with them, and never run into any device that it hasn’t worked with (and I have had problems with other BT adapters, especially on my Mac).

Once you have a bluetooth adapter, you will need to setup a connection to the device by pairing them. See your devices’/operating systems’ manuals on how to do this.

A very slick option is to run gpsd, which is a service-daemon running in the background that allows multiple connections to the single GPS device. Normally, only 1 software instance can connect at a time. With GPSd, you can “serve” your location. What would be really cool is to have GPSd be able to connect in with Geolocation by IP or Wifi as well as an actual GPS device to seamlessly switch between location technique.

GPSUtility is a nice, compact, graphical GPS application for Mac OS X. It can connect either directly to the GPS bluetooth port, or via gpsd. You can view location, satellite strengths, verbose NMEA output, and speed.

KisMac, while not a GPS-specific applicaiton, has excellent GPS support. KisMac is actually a wireless stumbler, which can also mark the latitude, longitude, and strength of detected networks and plot these on a map.

Storing & Viewing tracks

The Bluelogger software (currently Windows only) can export the tracks as GPL files. GPSBabel can convert these to a more useful format, such as GPX, which an XML format for GPS data.

Since using the bluelogger usually entails turning it on and off often, the entire track log will contain many separate trips. GPSBabel supports splitting up tracks based on a time separation. Each segment will be a self-contained track.

The following example will convert a GPL file to a GPX file, and make a individual track for any separation of 4 hours between points.


$ gpsbabel
  -i gpl -f Track_2005_11_23.gpl
  -x track,pack,split=4h,title="LOG # %c"
  -o gpx -F Track_2005_11_23.gpx

Displaying tracks

There are several options for displaying your tracks:

GPX Tracks

GPXLoader

GPS and Nokia 770

ThoughtFix has a fairly comprehensive tutorial on setting up GPSDrive with a Bluetooth GPS receiver. They went with the i-Blue High Sensitivity Bluetooth GPS, which looks like a nice unit, but lacks logging.

Resources


GreaseRoute - Mapping the web

Published in Geolocation, Google, Howto, Javascript, Maps, Open-Source, Programming, Technology, Web


I’ve been fairly quiet for the past couple of weeks. I’ve been focused on some projects, including entries to the MapQuest OpenAPI developers’ competition.

One of my entries, which may or may not actually be considered a “mashup”, is a Firefox GreaseMonkey script called GreaseRoute that creates map and route icons for an Microformat formatted adr or geo locations. These are often used in an hcard.

One of the cooler parts is that the extension automatically determines the location of the person viewing the page. Using the HostIP IP-to-Location database, the user’s location is automatically entered as the starting location. So when a user is viewing the webpage of, for example, a store or business, they can click the “route” link and get turn-by-turn directions to that location. No more copy & pasting street/city/state to a form or asking the person next to you “where are we?”

Microformats are a stepping stone on the way to the semantic web. They are a simple way to encode useful information for viewing and mining by users and other applications (ala mashups).

Example adr

The proper format of the adr is as follows:

<div class="adr">
 <div class="street-address">1517 N. Main St.</div>
 <div class="extended-address">Box 203</div>
 <span class="locality">Royal Oak</span>,
 <span class="region">MI</span>
 <span class="postal-code">48067</span>
 <div class="country-name">US</div>
</div>

which will then be displayed as:

1517 N. Main St.
Box 203

Royal Oak,
MI
48067

US

Example geo

Instead of an address, one can instead just encode the latitude and longitude:

N 37° 24.491
W 122° 08.313

The Result

GreaseRoute has 2 version, the lite version and the embed version. The lite version displays a map and route icon next to the addresses found on the webpage:

The embed version displays a “route” link. When clicked, a pop-up map is displayed between the users location and the encoded address.

Give GreaseRoute a try and let me know what you think.

You can also go over to Userscripts.org, the GreaseMonkey script repository, and rate them and leave comments.


Creating inline (embedded) PNG images

Published in Howto, Javascript, Open-Source, Programming, Web


Sometimes it’s necessary, or nice, to be able to directly embed an image in code. Like a modern form of ASCII art, you then don’t have to distribute icons and images with your source, because the image is in the source itself. The method uses Base64 encoding. See the RFC for Data URI.

“Base64″ format used by MIME-encoded documents such as electronic mail messages with embedded images and audio files.

To convert a PNG (for example) image to Base64, you will need some utility. base64 is an open-source converter that does just this.

Do the configure, compile jig:

$ ./configure
$ make
$ sudo make install

Then encode your image:

base64 -e my_image.png my_image.png.base64

Open the my_image.png.base64 file in a text editor and then copy it into your code. An example is shown below, written in Javascript.

const png_image_src = 'data:image/png;base64,'+
'iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAABGdBTUEAANbY1E9YMgAAABl0' +
'RVh0U29mdHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAAGAUExURcDYv1C8WdPrtIDAeWqk' +
'Oqnd2VLWaOX0x7ftwZzZlIjGxr7gxanLkdfu1FumybHSsJ3Cutbyx4S9fm2paMrq0Lfo1L/a' +
'o6PHiozL11aZJpnW2oG0ZLTcm5zjvovbvM3qtcror2q5vUaIRHLGZWWkR0aQGSR/BYy5baHY' +
'imrbd/z+/HO9bPb69m29xHy8c2OeMUGJPZDThZPPi3ivdGazzZbBgCuCEd3x2jaICs7ksqLZ' +
'mTp/N6zwtWu/YLDWvZHHeqLS0affzKfvsWDYpn7CvJHJh0+cSGWbY6PQka/Xkvj894W2a4DQ' +
'qIrDhF+hQ8fexJDN24PYgYGzWnXJy6zXpp3Fm5jCg37NdI++dWejWmCwVnSrT6nuyTuLELvh' +
'pV2gO6DSwI3qnd3wv6rQxK/fz1OZxrTvtaLim3rRr+bv5TuCN+jw557FiK7NlWzRkHDGhHLd' +
'fnHWmm2zx7Xe1m21zW65z9Ts0HTHaHrGb3vJb3yvVbTaxVGUTITLtV6w0////94DUpYAAACA' +
'dFJOU///////////////////////////////////////////////////////////////////' +
'////////////////////////////////////////////////////////////////////////' +
'//////////////////////////////8AOAVLZwAAAQxJREFUeNpiqAcCc87wcuVKTl4Qm6G+' +
'XstKOU6eu9ouxNbICySgZajBzluWUuzgkOyqpwMUsNJIEuQVYWUNkOCysxeqZzBXZk+z4RCV' +
'kiopquVUcPNn4JSRd4oRkZAwUSwsKPAQN2YIZ0pPFBUpNQnWZGNj0xOrYShPCtSUdeTTlXNm' +
'0WcUtjRgUE4Kz5Plq0vVzWAJkoy0zGKokDeU4+JjYWHRr+KJVhVTYjDylMn34WPJzeXhiRBX' +
'sXBnKIti0tZW1M9VV/eWlg6LV2Oo943wZHaR5BEXz/EOUzHTYajXEfZWSJBUVY2NN1UxywR5' +
'TsfYIFRAQIDfws8sG+xbICGsZG2tpKamBWQDBBgAU049f2kd9aAAAAAASUVORK5CYII=';

var my_link = document.createElement('a');
my_link.title = "Go to example.com"
my_image = document.createElement('img');
my_image.src = png_image_src;
route_image.border = 0;
my_link.href  = "http://example.com";
my_link.appendChild(my_image);

document.body.insertBefore(my_link, document.body.lastChild);


Javascript XML parsing for GML and you

Published in Geolocation, Howto, Javascript, Programming


You find the need to determine the locations of your visitors, and you wonder how to do this? Surely it’s impossible. Alas, it is not. Services like HostIP provide the ability to locate your users given their IP address. The slick way to do this is via javascript. Unfortunately, the HostIP API doesn’t provide a JSON interface.

But of course, the response is in XML, so you’re also wondering how to parse this XML response for something meaningful? The answer is the DOMParser and namespaces. There is a really nice function, getElementsByTagNameNS that allows you to parse out elements given a namespace. I kept trying getElementsByTagNameNS("gml","name"), which didn’t work. The answer seems to be that you need to include a valid uri for the namespace.

var dom = new DOMParser ( ) .parseFromString ( responseText,
                            "application/xml" ) ;

var location = dom.getElementsByTagNameNS (
   "http://www.opengis.net/gml", "name" ) [1].firstChild.data
    if location == " ( Unknown city ) "
        return "";


Publish iCal to Google Calendar

Published in Article, Google, Howto, Technology, Web


Let me attempt to redeem my prior remarks about Google Calendar by offering this bit of how to publish your iCal (via iCal or Mozilla Sunbird) to Google. This was inspired by How to subscribe to Google Calendar in iCal.

Create your calendar

You have numerous options for creating your calendar: iCal (Mac), Mozilla Sunbird (Mac, Windows, Linux), Outlook2iCal (Windows), etc.

Setup a public server to host your calendar

You have several options to publish your iCal calendar:

Publish your calendar

Using one of the prescribed methods above, you will then want to actually publish your calendar to the host (or upload via FTP/SSH/SFTP/carrier pigeon on 5.25″ floppy disk). You can turn on “Publish Changes Automatically” to have your changes on your computer automatically uploaded to Google Calendar.

Subscribe to your calendar in Google Calendar

Do the following:

  1. Manage Calendars
  2. then under “Other Calendars”, click “Add calendar”
  3. Fill in the URL of your published calendar - this is probably supplied by the hosting server (like iCal Exchange, .Mac, or you can figure it out for your own server)
  4. Click “Ok” and wait a little bit for it to be uploaded

Add Calendar

Subscribe to the Calendar

Bask in the warming, glowing warmth…

You’re now done and have a Google Calendar version of your local iCal calendar. Unfortunately, at this point, Google Calendar doesn’t let you edit this “public” calendar, though you can add events from this calendar to one of your Google Calendar calendars (if that makes sense, you’re astute). Now you can just publish when you’ll be available to stop at the local pub for a brew!