Good practice for programmatically fetching tiles

Hi;

I’ve started working on a script for making maps browsable on a Palm PDA (using the free MapView app) from OpenStreetMap tiles. It’s still at the very rudimentary stages, though code will be posted once it’s in better form.

I was wondering what good practice is for automatically fetching large numbers of tiles. My script will start with tiles at a high-level zoom (i.e., a city or town) and then fetch their subtiles at a few levels of zoom below that (possibly skipping every second one to keep things manageable). Given that the number of tiles increases exponentially with each zoom level, this can put quite a load on the server.

My script currently throttles its requests by pausing for 5 seconds after every 16 tiles have been downloaded (simulating a browser window showing (part of) 4x4 tiles at once). Is this acceptable? Could I go wild and do away with the throttling altogether?

Also, I’ve noticed that the tile URLs start with ‘a.tile.openstreetmap.org’. Should the ‘a’ be omitted? If it is, will requests automatically be rotated between tile servers?

Thanks,

– acb

If your application is going to attract a reasonable following then the OSM server admin’s won’t be very happy with your chosen solution. In such a case it is better to host your own tileserver. That said, using the OSM servers for testing purposes is just fine, in that case throttling should not be necessary.

Regarding the URL’s: if you look at the source of some webbased mapservers based on OpenLayers you will see they cycle through 4 servers a, b, c and d to get the tiles in parallel.