Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Idea for a program: Map download utility
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Unsupported Software
View previous topic :: View next topic  
Author Message
ttuttle
Tux's lil' helper
Tux's lil' helper


Joined: 03 Oct 2004
Posts: 131

PostPosted: Wed Jun 29, 2005 1:06 am    Post subject: Idea for a program: Map download utility Reply with quote

I just bought an Earthmate LT-20 GPS (it's USB, but it uses NMEA, so it works with gpsd), and I've been trying out plenty of Linux software. One thing I've noticed is that each program has to reinvent the wheel when it comes to downloading maps. Another problem is that, as online map providers change their URL formats (perhaps to avoid the very geeks who leech their maps), older or less-well-maintained programs are left useless.

So I'm proposing an idea for a program. It would be a small utility that could download, assemble, resize, and otherwise process maps. There would be a plugin (probably Perl, since it's what I write) architecture that allows the program to quickly and easily adapt to new map services.

Basically the idea here is that, instead of each program (gpsdrive, gpsmap, xastir, roadmap, and so on) having to put the effort into decoding each service's URLs, one person who knows each service well can keep its plugin maintained, and all programs can benefit from it.

I guess the best way for this to work is like so:

A program requests a map of a certain set of dimensions.
The utility calls a user-selectable map service plugin to download the maps for that area.
The plugin downloads the maps. The maps will not necessarily be the right size, because most services offer just the size their service needs. The maps will be indexed or listed somehow so the utility knows what its dimensions are.
The utility will stitch the maps together, crop them, and resize them to fit what the program asked for.
The program will receive the requested map.

What do you guys think?
Back to top
View user's profile Send private message
ReefShark
n00b
n00b


Joined: 22 Mar 2003
Posts: 67
Location: the Netherlands

PostPosted: Wed Jun 29, 2005 8:26 pm    Post subject: Reply with quote

Great idea!!! :P
_________________
BEWARE ! - if you play the Win-XP CD backwards you'll hear satanic messages.
BUT EVEN SCARIER : If you play it foreward, it installs WIN-XP !
Back to top
View user's profile Send private message
ttuttle
Tux's lil' helper
Tux's lil' helper


Joined: 03 Oct 2004
Posts: 131

PostPosted: Thu Jun 30, 2005 5:29 pm    Post subject: Reply with quote

Update: I now have a system that can download, cache, and assemble maps. It has a plugin for Google Maps, and will soon have one for Google Satellite.

The major part of the code is contained in Mapper::Source. It contains all the functions for converting coordinates from and to pixels, tiles, and lat/lon. To make a map download plugin, this is all you have to do:

Code:

package Mapper::Source::Example;

use strict;
use warnings;

my @ISA = qw/Mapper::Source::HTTP/;

# width and height of tiles
sub width { return 256; }
sub height { return 256; }
# zoom levels, expressed as degrees longitude per pixel
sub scales { return (1, 0.5, 0.25, 0.125); }
# ratio between degrees latitude per pixel and degrees longitude per pixel
sub scale_lon_to_lat { return 1; }
# "center" latitude and longitude
sub scale_zero_lat { return 0; }
sub scale_zero_lon { return 0; }
# URL of tiles
sub locate_tile_map {
my ($self, $x, $y, $zoom) = @_;
return "http://mapimages.example.com/getmap?x=$x&y=$y&zoom=$zoom";
}

1;


Obviously, that's just an example, but that's how easy it is to plug in a new map server. I'll probably include an example like this when I release it.

Things left to do/"bugs":

  • Write a Mapper::Stitcher class that does the grunt work of retrieving tiles, stitching them together, and cropping maps.
  • Write a "blank map" plugin, just to be pragmatically complete.
  • Write Google Satellite, Mapquest, Terraserver, Tigermap, etc... plugins. Suggestions for map servers, especially ones accompanied by specifications for URL syntax, are greatly appreciated
  • Write a background daemon that downloads "nearby" maps (i.e., one tile in each direction from where you are, maybe more, maybe other zoom levels) to keep things fast.
  • Write a script that uses the utility to download maps for gpsdrive.
  • Implement rate-limiting, copyright/TOS notifications (to warn people what they're doing), and other helpful ways not to get sued.
  • Investigate ways to speed up ImageMagick's montage. Right now it takes about 20 seconds to stitch together a large (15+ by 15+ tiles) map. This is fine for generating large maps, but it needs to be faster for real-time mapping.
Back to top
View user's profile Send private message
das_leid
n00b
n00b


Joined: 11 Apr 2004
Posts: 63
Location: Bochum / Germany

PostPosted: Mon Aug 08, 2005 9:32 pm    Post subject: Map downloading Reply with quote

..well, take a look at "gpsfetchmap.pl".

It's included in the gpsdrive package.
You might be able to re-use some of those routines.


Cheers
Das Leid
_________________
emerge vim

OH EVIL !
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Unsupported Software All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum