[ka-Map-users] Script for creating image tiles

Paul Spencer pspencer at dmsolutions.ca
Tue May 24 14:22:09 EDT 2005


I did start working on a precache.php script but removed it as I didn't 
get it working and have no real interest in pursuing it for my current 
purposes.

The basic logic should be:

- loop through scale values for each set of map extents
   - calculate pixel extents from map extents at current scale
   - calculate which metatile the top left corner lies in
   - calculate number of metatiles at current scale
   - call tile.php for each metatile

to use existing tiles, you will need a new tile script to pick the 
correct tile based on how you have them stored.  The client code 
references by pixel location at the current scale, if you can convert 
something like top=2200, left=14600 into a reference to an existing 
tile, you would have everything you need :)

Cheers

Paul


Daniel Morissette wrote:
> All you need to prepopulate the ka-map cache is a loop that calls 
> tile.php once for each metatile and the rest happens by magic. I think 
> referencing a repository of existing tiles is a different problem.
> 
> I think Paul started working on a precache.php script but I'm not sure 
> if it was complete.
> 
> FWIW, I used the following bash command on a Linux server to regenerate 
> all existing tiles from an existing cache (and for a given scale) after 
> a change to the mapfile. You may need to do a little bit of work to make 
> it generic:
> 
> $ scale=20000; map=gmap; for tileid in `find 
> /path/to/kacache/$map/$scale -name "t*" -type d -printf "%f "`; do wget
> "http://your.host/url/tile.php?map=$map&tileid=$tileid&w=200&h=200&s=$scale&force=1" 
> 
> -O ttt.png; rm ttt.png; done
> 
> The advantage of using something like this is that you regenerate only 
> the tiles that were already in the cache, and are the most likely to 
> ever be used by your visitors, saving you disk space and processing time.
> 
> Daniel
> 
> 
> Steve Lime wrote:
> 
>> I imagine work would need to be done to make the code work from the
>> pre-computed pile of images- that is, it's not enough to just create
>> them you have to have a way to reference them. I have 300,000 quad map
>> tiles I'd love to leverage with a ka-map frontend...
>>
>> Steve
>>
>>
>>>>> Armin Burger <armin.burger at gmx.net> 5/24/2005 12:13:48 PM >>>
>>
>>
>> Hello,
>>
>> is anybody already working on a script that can create, ie.
>> pre-process, all the image tiles so that they do not have to be created
>> first when a user zooms to this extent/zoom level? Would be nice
>> especially if one modifies the map file.
>>
>> Armin
>>
> _______________________________________________
> ka-Map-users mailing list
> ka-Map-users at lists.maptools.org
> http://lists.maptools.org/mailman/listinfo/ka-map-users
> 

-- 
+-----------------------------------------------------------------+
|Paul Spencer                           pspencer at dmsolutions.ca   |
+-----------------------------------------------------------------+
|Applications & Software Development                              |
|DM Solutions Group Inc                 http://www.dmsolutions.ca/|
+-----------------------------------------------------------------+


More information about the ka-Map-users mailing list