[Openstreetmap-dev] Experiments with AJAX

Lars Aronsson lars at aronsson.se
Sat Aug 13 23:07:50 BST 2005


nick at hogweed.org wrote:
> Features which will be difficult:
> 
> 1. Google-style scrolling maps. Only likely to be feasible if the maps are 
> purely static rather than being dynamically created from a database; this 
> would need, say, nightly regeneration of maps, and storage of proportions 
> which probably only someone like Google could manage, not your average 
> hosting provider.

The first step would be to allow only fixed levels of zooming, 
latitude, and longitude.  Today the OSM maps often have the like 
of scale=8.999999999999999E-4.  This ugliness could easily be 
avoided by rounding the scale to the nearest number in a series 
such as 1-2-5-10-20-50 and redirecting to the preferred URL.

I think you can (and that Google Maps does) cache generated images 
as static files on the server and redraw them on the fly when the 
cache is missing (with a "RewriteCond %{REQUEST_FILENAME} !-f" 
line in .htaccess).  The typical cache hit-to-miss ratio will 
assure the server load is kept low enough. Thus you don't need 
nightly rebuilds, only nightly purges of the cache.  Or even 
better, purge the relevant images from the cache when new objects 
are added to the database.


-- 
  Lars Aronsson (lars at aronsson.se)
  Aronsson Datateknik - http://aronsson.se




More information about the dev mailing list