[OSM-talk] layers and rendering

David Earl david at frankieandshadow.com
Wed Nov 19 23:43:05 GMT 2008


On 19/11/2008 23:09, Dave Stubbs wrote:
> The problem is that you either serve the information to the browser,
> which then slows down hugely, or else you have to render bitmaps for
> every different layer, and either way you probably require way more
> server resources.
> 
> The reason we do it the way it's currently done is that the process
> scales very well for many people looking at the map (we just keeping
> sending out the same prerendered image tiles). When everybody is
> trying to look at a different map, we need about a 1000 times as many
> servers, which doesn't work so well.

There is a hybrid solution to this which I am sure would work. I've 
mentioned it before on this list. Unfortunately it needs changes to 
OpenLayers to support it (though those changes would be beneficial in 
general as well, I think).

Basically: pre-render highways, areas etc as at present. But pre-render 
POI icons and captions as absolutely positioned HTML elements (text and 
small img's) within tile size clip areas, and overlay the PNG tiles with 
these HTML tiles - which the browser completes the rasterization of. The 
HTML "tiles" can be stored, delivered and overlaid in pretty much the 
same way as other tiles. The missing bit is that openlayers doesn't know 
how to handle them, but it can't be that different positioning divs 
rather than imgs. Since the tiles are pretty simple text, they'll be 
pretty small and the image icons they refer to will be constant and cached.

Then it becomes possible simply by Javascript DOM assignments like
for (i in pubs) { pubs[i].style.display = "none"; }
(where pubs is determined from all elements with pub class) to turn them 
on and off. Or you could poke the style itself from javascript to do all 
pubs at once go - once you have an HTML tile, there's lots of different 
ways of approaching the dynamic display part of the problem.

David




More information about the talk mailing list