Hello,

I made progress on "How to clean up the map cache"
and wrote a perl script to do that.

This http://wiki.openstreetmap.org/wiki/Slippy_map_tilenames 
gave me the needed information.

Taking Osmarender tiles as example,
this is how tile are stored on the server:

  http://tah.openstreetmap.org/Tiles/tile/$z/$x/$y.png 

and this is how viking stores the same tile on disk:

  $v = 17 - $z
  $ENV{HOME}/.viking-maps/t12s${v}z0/$x/$y\n"

Explained in detail: 

- t12 stands for Osmarender tiles, as far as i know these types are also 
defined:

    "OpenStreetMap (Osmarender)" => 12,
    "OpenStreetMap (Mapnik)"   => 13,
    "OpenStreetMap (Maplint)"  => 14,
    "OpenStreetMap (Cycle)"    => 17,

- s$v e.g s13 stands for the zoom level, viking somehow reverses it like this 
$v = 17 - $z
  unfortunately therefore it's not possible to have zoom levels greater than 17 
in viking.

- tile $x $y is then stored in $x/$y 

- z0 is not z for zoom level, it's just always z0


The attached perl script lists all map tiles that are not in the specified 
areas.
I get the area definitions by browsing http://www.openstreetmap.org
and then select the "Export" Tab, then I take the North South West East values 
from the "Area to Export" field e.g. 
http://www.openstreetmap.org/export/?lat=49.452&lon=10.959&zoom=10&layers=B000FTFT

see @areas array of array in attached perl script:

# bounding box of areas to keep map tiles
# Format is: North South West East
my @areas = (
    [qw/52.0279 51.8842 7.4984 7.7498/],    # some area in germany
    [qw/57.675 57.173 13.354 14.36/],       # some area in sweden
);

list_unwanted_viking.pl just gives a list of path names of tiles that
exist in the filesystem but are not in the areas defined in the @areas array.

You can make use of the list like this to clean up your ~/.viking-maps map 
cache:

  perl list_unwanted_viking.pl | tar --remove-files -cvf bakup_$(date +%s).tar 
-T -

This will remove the unwanted tiles from /.viking-maps but also create a backup 
tar file.

As far as I can see there is no risk but be aware: Use at your own risk.

Cheers
Lixus



Am Thu, 28 Feb 2008 19:03:31 +0100 schrieb Lixus Zoran <g...@muellers.ms> :
 
> > 3/ Is it possible to remove map tiles from the cache? Something like the 
> > "download maps" tool but "reversed" ("remove maps"). Or export an area 
> > to another map cache?
> 
> I asked this question as well, didn't find a solution yet but got the
> below reply. Perhaps someone could write a script to clean up ~/.viking-maps



Attachment: list_unwanted_viking.pl
Description: Perl program

------------------------------------------------------------------------------
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time, 
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge
_______________________________________________
Viking-devel mailing list
Viking-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/viking-devel
Viking home page: http://viking.sf.net/

Reply via email to