[OSM-dev] mod_tile svn's project variables 1)hardcoded 2)in many files

Frederik Ramm frederik at remote.org
Wed Feb 3 00:45:42 GMT 2010


Hi,

Jonathan-David SCHRODER wrote:
> for the render_expired.c program (;-) )..

Uh-oh, that's my nasty little secret I believe.

render_expired is more or less a version of render_list, but it 
processes an expiry list coming from osm2pgsql. Because osm2pgsql has no 
knowledge about meta tiles, the expire list might contain up to 64 tiles 
that fall onto the same meta tile. render_list tries to keep track of 
meta tiles already requested for rendering, to avoid requesting the same 
tile multiple times.

It does so in a bit array which is manipulated with these beastly things 
(which anyone is welcome to replace by something that is more en vogue):

> #define TILE_REQUESTED(z,x,y) \
> (tile_requested[z][((x)*twopow[z]+(y))/(8*sizeof(int))]>>(((x)*twopow[z]+(y))%(8*sizeof(int))))&0x01

> #define SET_TILE_REQUESTED(z,x,y) \
>    tile_requested[z][((x)*twopow[z]+(y))/(8*sizeof(int))] |= (0x01 << 
> (((x)*twopow[z]+(y))%(8*sizeof(int))));

You should be able to simply pre-compute the twopow array to something 
higher and it should work.

HOWEVER #1:

These macros are used only at the meta tile level, i.e. the "z" in these 
macros is always the real zoom level minus 3. If they break with z=19 
then that means that the script cannot handle tiles on zoom level 22. 
Are you *sure* you want to handle tiles on zoom level 22? On that zoom 
level, one pixel corresponds to 4 centimetres on the surface of the 
earth (at the equator). One tile corresponds to less than 100 square 
metres. You'll be rapidly approaching a situation where OSM's accuracy 
becomes a problem...

HOWEVER #2:

You will need roughly 2^(2*maxzoom-39) GB of RAM to run this program. So 
if you want to go down to zoom level 22, then that's 32 GB RAM.

For your application, you might want to use a different approach, one 
that keeps rendered tiles in a tree or list like osm2pgsql does and not 
one that makes an array like render_expired.

Bye
Frederik

-- 
Frederik Ramm  ##  eMail frederik at remote.org  ##  N49°00'09" E008°23'33"




More information about the dev mailing list