[webmap-discuss] OGC and google style tiling

Paul Spencer pspencer at dmsolutions.ca
Fri Apr 28 07:42:41 EDT 2006

In tile.php, we use two mapserver tricks to work around this issue:

1) draw an image 10 pixels larger in all dimensions than we really  
want.  The problem with this is that labels, symbols etc can end up  
in the 10 pixel buffer and get clipped, so we ...

2) apply a buffer around the edge of the map to prevent labels and  
symbols from showing up in the to-be-clipped area

The resulting image can then be tiled.

There are really two issues that I would like to see solved in  

1) producing tiles directly

2) labeling in tiled mode

Producing Tiles Directly ...

It would be relatively easy to ask mapserver to generate multiple  
images from a single map draw if you are using mapscript but I don't  
see a way to do it using the cgi.  This means that you really need to  
request single tiles and then cache them using squid or some other  
caching layer in the architecture.

To generate single tiles, you need to automatically buffer and clip  
the edges.  This could be controlled via metadata in the map file, or  
perhaps should be the built-in-default-way-of-operating.  The extra  
overhead would be minimal IMO.

Labeling in Tiled Mode ...

The bigger issue in generating excellent maps is the whole labelling  
thing.  Ultimately, the best map would come from rendering the entire  
map at each scale as a single image and then slicing it.  This is not  
practical since even a 2000x2000 pixel map really slows mapserver down.

In order to do labeling correctly, you need to consider a broader  
spatial context than that being drawn and deterministically place  
labels so that you get consistent results without duplication (or  
with duplicates at pre-determined intervals).  Labels would have to  
be able to cross tile boundaries in such a way that combining  
adjacent tiles would reconstitute the label.

I don't have a really good idea of how this could be done.  Perhaps a  
global, persistent label cache?  Or a pre-generated label layer that  
is processed at particular scales and calculates where each label  
needs to be drawn.  AFAIK there isn't a good solution to this problem :S

Google 'seems' to have solved this problem, but in my opinion, they  
have simply chosen larger meta-tile sizes and have a nearly infinite  
set of resources to pre-render the tiles at all scales prior to going  
live.  They do not generate the tiles on the fly, and I have noticed  
some label duplication in some cases.

On the subject of performance boost, the boost comes from caching the  
tiles once they are generated, not from the generation process.  IMO,  
the generation process can be relatively slow.  This is especially  
true if you want to enable antialiased thick lines and 'curved' text  
that follows streets.  The overhead of rendering far outweighs the  
overhead of cutting tiles.



On 28-Apr-06, at 7:11 AM, Steven M. Ottens wrote:

> Hi Dave,
> In my opinion the edge problem is a bug in mapserver and should be
> solved in mapserver, not with a workaround. But i'm not too  
> knowledgable
> on mapserver so I could be mistaken. Anyhow I don't think we should  
> need
> any post-rendering processing of the mapserver-images. The whole point
> of tiling is a performance boost. So if every tile needs to be recut
> after being rendered it'll generate more overhead. I'm believing in a
> WMS-server solution which creates and cuts tiles like tile.php does  
> now.
> This should solve the edge *and* labeling issues.
> Steven
> On Thu, 2006-04-27 at 15:28 -0400, dblasby at openplans.org wrote:
>> I've been thinking of tiling rendering for WMS in general, and  
>> geoserver
>> in particular (especially with OpenLayers apparently coming out soon
>> and mapbuilder also adding similar functionality).
>> Paul gave a good account of the problems that I've been thinking  
>> about:
>> a) Edge Rendering Effects
>> b) cache HTTP headers
>> c) Get capabilities (ie. tell clients about how to make requests --
>> hopefully OGC will define this)
>> d) Labeling
>> I think a-c are actually fairly easy to handle with a "dumb" proxy  
>> WMS.
>> Take a quick look at the two images I attached.
>> a) Edge Rendering Effects
>>      This can be handled simply by intercepting an incoming WMS
>> request, expanding the request bounding box and image size and  
>> sending
>> the request down to the actual WMS server.  The image returned is  
>> then
>> "cookie cut" so its the proper size/extent of the original request.
>>      You'd have to tune the expansion size, but generally you'll  
>> want it
>> to be a few pixels wider than your "widest style."  For example, if
>> your roads are 12 pixels wide you'd want to expand the image by about
>> 14 pixels in all directions (extra pixels are to account for
>> anti-aliasing).
>> b) cache HTTP headers
>>       Geoserver allows you to set the cache expire headers, but  
>> you can
>> also have the WMS proxy mangle header for servers that dont allow  
>> this.
>> c) Get capabilities
>>       At some time in the future, the WMS 'get capabilities' document
>> will contain the grid information the server wants the client to use
>> for tiling.  Once this is defined, the proxy WMS can augment the real
>> server's get capabilities so that clients make "proper" requests.
>> Unfortunately, I dont see a good solution to labeling issues (except
>> making requests for very large images) - anyone have any ideas?
>> dave
>> ----------------------------------------------------------
>> This mail sent through IMP: https://webmail.limegroup.com/
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: webmap-discuss-unsubscribe at mail.osgeo.org
>> For additional commands, e-mail: webmap-discuss-help at mail.osgeo.org
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: webmap-discuss-unsubscribe at mail.osgeo.org
> For additional commands, e-mail: webmap-discuss-help at mail.osgeo.org

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

More information about the Webmap-discuss mailing list