Hello, I wrote a small cgi script to let JOSM SlippyMap plugin use the OSM tiles cached in ~/.viking-maps. Handy for offline use of JOSM. I thought someone else might find this useful as well.
You need 1) apache with cgi support, copy the below perl code to your cgi-bin dir e.g. on debian /usr/lib/cgi-bin/map.cgi 2) make sure the perl module CGI.pm is installed 3) make your ~/.viking-maps accessible by the user who runs the httpd: chmod -R a+r ~/.viking-maps find ~/.viking-maps -type d | xargs chmod a+rx 4) in JOSM -> Edit -> Preferences -> SlippyMap -> Tile Sources -> http://localhost/cgi-bin/map.cgi?tile= /var/log/apache2/access.log should shows this while using map tiles in JOSM with SlippyMap 127.0.0.1 - - [16/Sep/2009:17:35:22 +0200] "GET /cgi-bin/map.cgi?tile=/15/17070/10823.png HTTP/1.1" 200 6685 "-" "JOSM/1.5 (2143 en) Java/1.5.0_16" 127.0.0.1 - - [16/Sep/2009:17:35:22 +0200] "GET /cgi-bin/map.cgi?tile=/15/17069/10824.png HTTP/1.1" 200 8845 "-" "JOSM/1.5 (2143 en) Java/1.5.0_16" 127.0.0.1 - - [16/Sep/2009:17:35:22 +0200] "GET /cgi-bin/map.cgi?tile=/15/17069/10826.png HTTP/1.1" 200 7317 "-" "JOSM/1.5 (2143 en) Java/1.5.0_16" 127.0.0.1 - - [16/Sep/2009:17:35:22 +0200] "GET /cgi-bin/map.cgi?tile=/15/17069/10825.png HTTP/1.1" 200 7243 "-" "JOSM/1.5 (2143 en) Java/1.5.0_16" 127.0.0.1 - - [16/Sep/2009:17:35:22 +0200] "GET /cgi-bin/map.cgi?tile=/15/17069/10823.png HTTP/1.1" 200 7166 "-" "JOSM/1.5 (2143 en) Java/1.5.0_16" 127.0.0.1 - - [16/Sep/2009:17:35:22 +0200] "GET /cgi-bin/map.cgi?tile=/15/17068/10828.png HTTP/1.1" 200 2535 "-" "JOSM/1.5 (2143 en) Java/1.5.0_16" 127.0.0.1 - - [16/Sep/2009:17:35:22 +0200] "GET /cgi-bin/map.cgi?tile=/15/17069/10822.png HTTP/1.1" 200 6817 "-" "JOSM/1.5 (2143 en) Java/1.5.0_16 This will probably also work with other map tiles types than OSM, you just would have to change t7 to something else and probably have to change -type=>image/png to image/jpg. #!/usr/bin/perl use strict; use CGI qw/:standard/; # put the location of your viking-maps directory here my $viking_maps = '/home/YOUR_USERNAME/.viking-maps'; my $tile = param('tile'); my ($z,$y,$x) = $tile =~ m/\/(\d+)\/(\d+)\/(\d+).png/; my $v = 17 - $z; my $filepath = $viking_maps . "/t7s${v}z0/$y/$x"; if ( -e $filepath ) { print header(-type=>'image/png'); print `cat $filepath`; } else { print header(-status=>'404'); } Have fun Lixus
<<attachment: josm.png>>
------------------------------------------------------------------------------ Come build with us! The BlackBerry® Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9-12, 2009. Register now! http://p.sf.net/sfu/devconf
_______________________________________________ Viking-devel mailing list Viking-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/viking-devel Viking home page: http://viking.sf.net/