At A Glance Main Projects Tutorials Resume

Contact


Email: palen1c at gmail.com




GPSDrives gpsfetchmap Ubuntu Script Tutorial

Sun, 09 Nov 2008 15:10:03 EST

Its obvious how natural it is to drive while holding a laptop to navigate Charles in a car with the eeepc
GPSDrive is a sweet gps navigation program, but it is pretty much useless unless you can figure out how to configure it and download maps. The single map download functionality is nice, but way to hard to get all the maps for a certain area. I am going to explain how to get the multiple map download script gpsfetchmap.pl working on ubuntu.

You need Perl in order to run a .pl script. Im going to assume you already have it. The next thing you need is image magick, then the image magick extension for Perl called perlMagick most likely seen in errors for gpsfetchmap.pl as Image::Magick

You have to install both ImageMagick and perlMagick from the command line. Its really simple thanks to apt in ubuntu. The commands to run assuming you already have GPSdrive installed from ubuntu add ⁄ remove programs and Perl installed. Perl should be installed by default are as follows
sudo apt—get install imagemagick

sudo apt—get install perlmagick

This will fix the error with gpsfetchmap.pl that complains about Can't locate Image ⁄ Magick.pm. So now lets take a big leap and assume that you can actually run gpsfetchmap.pl I live in Massachusetts and want to download maps for the whole state. Whats the command to do it? The first thing we need to do is figure out the latitude and longitude boundaries of the state. I went to itouchmap and zoomed in on Massachusetts then dragged the little red icon to each of the four corners of the state and recorded each latitude and longitude (in the box on the left below the map). The results I got were as follows:
Top Left:
Lat: 42.7389
Long: —73.2788

Bottom Left:
Lat: 42.0533
Long: —73.4985

Top Right:
Lat: 42.7026
Long: —70.8123

Bottom Right:
Lat: 41.5414
Long: —70.3344


Now we need to construct the command for gpsfetchmap.pl
In order to get a list of the available command line switches we run:
perl gpsfetchmap.pl ——help

There are some options that we need to use. —p : rest 1 second between server requests — use this. I have written web spiders before and if you hammer a server it will just stop responding to you or may think your preforming a DDOS attack.

—sc a range of scales (min: 2250 max: a lot!. This is good. Lets use 2250 — 152000 NOTE: This wasnt working properly. So I specified single scales and ran the command multiple times.

—F force the application not to prompt you on each map download

—d prints out diagnostic information in case of errors we want to see this

I want to use these for driving around not the landsat maps(default) for topology. So we need to switch the map server to use openstreetmap

——mapserver openstreetmap_tah

We want to specify a start latitude, start longitude, end latitude and end longitude which make up two opposite corners of a square. So from the measurements above that we used google maps for, we will be using the Top Left and Bottom Right values. The associated commands are:
——start—lat
——end—lat
——start—lon
——end—lon
Your reward for all the hard work gpsfetchmap debug output as it downloads maps






Here is the full command to get a very detailed street map of Massachusetts:
perl gpsfetchmap.pl ——start—lat 42.7389 ——start—lon —73.2788 ——end—lat 41.5414 ——end—lon —70.334 —p —F —d —sc 2250 ——mapserver openstreetmap_tah

These .png images will be written to whatever you set your default map directory to in gpsdrive I would recommend that you run the command above a few times with multiple sc values so you can zoom in and out if you have room for it. I used —sc values of 2250 (probably too close), 36000, and 18000
I hope this has helped shed some light on how to actually make GPSDrive usable.

Charles Palen has been involved in the technology sector for several years. His formal education focused on Enterprise Database Administration. He currently works as the principal software architect and manager at Transcending Digital where he can be hired for your next contract project. Charles is a full stack developer who has been on the front lines of small business and enterprise for over 10 years. Charles current expertise covers the areas of .NET, Java, PHP, Node.js, Javascript, HTML, and CSS. Charles created Technogumbo in 2008 as a way to share lessons learned while making original products.

Comments

nutznboltz
nutznboltz
February 12, 2011 08:59 am

I put the Sun, 19 Sep 2010 svn checkout of GPSdrive 2.11pre into a PPA for easy installation, see:
https://launchpad.net/~nutznboltz/+archive/gpsdrive

Charles
Charles
November 21, 2008 06:02 am

Thanks for the nice comment Carl. It made my day. As long as you stick with it, im confident that you can do anything you want to. We are all equal in what our brains can do, its just some people (like me) have poor memory and have to spend a lot of our time being persistent.

Charles
Charles
November 21, 2008 06:00 am

Thanks for the nice comment Carl. As long as you stick with it, im sure you'll be a pro some day.

Carl
Carl
November 20, 2008 10:59 pm

This is kick ass, too bad I'm too stupid to understand! One day I will be smart enough to build these cool things you do!

Comments are currently disabled.