TileCache uses a tile origin parameter to define the starting point of the grid. The WMS-C recommendation says " A WMS-C service would likely only deliver images for bounding boxes aligned to a given rectangular origin and grid, and only at particular scale levels.". I think the origin is defined as the bottom left corner, but I'm not sure on that. The main advantage to having an origin is that you can specify tiles by integer X, integer Y instead of dealing with BBOXes for each tile. It shouldn't be needed as long as requests always come in as BBOXes. (As an aside, my code has some parameter matching for tile origins, that should be removed since it has no practical need.)
Regarding the resolutions / tile "alignment"-- I think there are two sensible ways to handle this.
1. Try to find the closest tile that matches the requested box. TileCache takes this approach. In order to make this option viable, you either have to a client that does not allow the creation of arbitrary requests, or one that knows that it should snap the arbitrary request to a tile. (For example, if you do an arbitrary request on an OpenLayers Google Maps layer, it snaps the request to Google's tiles.)
or
2. Same as before: define a set of resolutions that requests must fall on. If no resolutions are specified, arbitrary requests are allowed. But, add a second option that controls whether errors (such as off-resolution requests) should be sent to the WMS. If true, the result from the WMS request is sent back to the user but not cached.
So:
resolutions off, proxying on: arbitrary requests cached (requires a cache that uses BBOXes, not grids) -- possible cache polluting by nefarious users but could be useful for internal sites
resolutions off, proxying off: all requests result in errors since there are no resolutions
resolutions on, proxying on: requests on a resolution grid are cached, arbitrary requests are proxied from the WMS but not cached. This also allows passing requests that a tilecache would not understand (such as for a different image format, a WFS request, etc), while still having the benefits of a cache for the on-grid requests
resolutions on, proxying off: requests on the resolution grid are sent to the user, off-grid requests result in an error message.
My plan for JTileCache was to follow #2 (and JTileCache is sort-of implemented to follow that). I really didn't like the idea of snapping a request to a tile behind the scenes since that doesn't seem like truly "honoring" a request.
That, combined with a warning if the
adjustment exceeds 1% (arbitrary choice), seems like a pretty good
strategy. I haven't considered projection issues, I'm not even sure
there are any, given the way resolution is defined
As far as I understand, there shouldn't be any projection issues. Possibly useful side note-- in JTileCache, the request resolution (BBOX / image size) is defined as equal to a resolution constraint if both resolutions are pixel equivalent. In other words, for a given BBOX, there a range of possible floating-point resolutions that would cause no change in the resulting image size (due to rounding). If both the request resolution and the resolution constraint are in the same range, then the resolution is equal.
-- Chris Whitney
On Nov 30, 2007, at 8:30 AM, Chris Holmes wrote:
I have already made some changes (replaced ImageTile with RawTile and improved streaming when til was not cached). This brought the response time down to less than 2 ms (using the JCS backend). I'll check that in once we know where the code will live.
Im currently looking at the python sources of TileCache for aligning / rounding the wms requested bbox to defined zoomlevels/resolutions.
This is probaly the one feature that makes tilecache different from eg squid. It seems that when using openlayers, the "origin tile" is not requested with the coordinates (tilesorgin-parameter) specified in the layer. This basically forces a resolutions check and request alignment to be done in the cache.
What tilesorigin-parameter are you talking about?
Chris
<cholmes.vcf>-------------------------------------------------------------------------
SF.Net email is sponsored by: The Future of Linux Business White Paper
from Novell. From the desktop to the data center, Linux is going
mainstream. Let it simplify your IT future.
http://altfarm.mediaplex.com/ad/ck/8857-50307-18918-4