Changes between Initial Version and Version 1 of SQLiteTilesImportPerlScriptEN


Ignore:
Timestamp:
Jul 27, 2011, 8:05:46 PM (13 years ago)
Author:
Martin Kolman
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • SQLiteTilesImportPerlScriptEN

    v1 v1  
     1= Sqlite batch import script =
     2[http://talk.maemo.org/showpost.php?p=1058668&postcount=788 original source]
     3
     4OK, I've got a working Perl script to import map tiles into the database.
     5
     6At the moment, it won't run on the N900 itself, as I'm having a few problems getting the SQLite module to build on my scratchbox installation; I'll work on that over the next few days when I have spare time and see if I can get that working.
     7
     8'''Dependencies:''' You'll need to install the '''Perl DBI''' and '''DBD-SQLite''' modules. These should be available from your disto's repositories (otherwise, get them from CPAN).
     9
     10It took about 75 minutes to import my 200 000 tiles into the database on my dual-core Athlon machine; obviously this will vary depending on the speed of the machine it's done on. The script is interruptible - just hit '''Control-C''' and it'll shut down cleanly. Then restart at your leisure.
     11
     12Getting it to work on an OS other than Linux is left as an exercise for the reader, as I'm happily Microsoft-free.
     13
     14It demonstrates well the oft-mentioned clustering problem with FAT partitions; my tile files allocated '''12.5GB''' of space, whereas the store file is '''only 543MB'''.
     15
     16'''Instructions:'''
     17
     18Download the script from http://www.beermad.org.uk/mapconvert
     19
     20Either copy your '''~/MyDocs/.maps''' directory to your Linux box or mount your '''!MyDocs''' partition on it. Try to preserve the timestamps if copying (as they're recorded in the database, I assume they're used to work out if a new copy of any tile is needed if they've changed on the tile server) - for example, if using scp:
     21{{{
     22scp -pr ~/MyDocs/.maps mycomputer:/tmp
     23}}}
     24The script only works on tiles in the current working directory, so for each map-type, cd into the relevant directory:
     25{{{
     26cd /path/to/tile_directory
     27}}}
     28Then run the script (no parameters needed).
     29
     30If necessary, copy the '''lookup.sqlite''' and '''store.sqlite.*''' files back to your N900.
     31
     32If there are any tiles already in the database, it leaves them there and it doesn't try to over-write any if one it finds already exists (at some time I should change this so it does over-write if the tile file is newer).
     33
     34If you already have tiles in a database, I recommend making a copy first, just in case anything goes wrong. I've tested the script a fair bit, but can't guarantee something won't screw up.