[Tilecache] BBOX of WMS requests

Christopher Schmidt crschmidt at metacarta.com
Tue Mar 4 09:14:23 EST 2008


On Tue, Mar 04, 2008 at 09:39:41AM +0100, Holger Jaekel wrote:
> Hi everyone,
> 
> I am currently implementing a WMS-C client for GeoTools and I use your
> TileCache-installation on http://labs.metacarta.com/wms-c/Basic.py as a
> test system. I found the following problem:
> 
> I want to send a request to layer "satellite" in resolution 0.000085831
> (level 13), column 8535, row 6534. 

The problem is that that resolution isn't actually accurate enough from
the metadata to use it. The actual resolution is:

.703125 / (2^13)
.00008583068847656250

As you can see, there is significant detail lost. I'm not sure what to
do about this, really: all existin clients essentially just divide the
top level by 2 as far down as they need to go, or have an explicit list
of 'rounded' scales/resolutions. (TileCache is bad if you don't have
apriori knowledge of your dataset.)

I've just changed the code in TileCache/WMS.py and TileCache/TMS.py to
bump the resolution up to 20 in SVN. You can test with this by:
 
 
 svn co http://svn.tilecache.org/trunk/tilecache/
 cd tilecache
 ./tilecache_http_server.py

This will require installing paste and (if you're using Python  < 2.5)
wsgiref: easy_install should get them both for you (easy_install Paste;
easy_install wsgiref) if you're on a Linuxy system. Alternatively, you
can set it up under CGI with no additional dependancies. I"ve also
manually modified the wms-c/Basic.py service, but in general, testing
against that one is probably less likely to be what you want, since it's
running Very Old Code. 

> minx = 0.000085831 * 256 * 8534 - 180 = 7.515329024 -> rounded to six
> places:  7.515329
> miny = 0.000085831 * 256 * 6534 - 90 = 53.569857024 -> rounded to six
> places: 53.569857
> maxx = 0.000085831 * 256 * 8535 - 180 = 7.53730176  -> rounded to six
> places:  7.537302
> maxy = 0.000085831 * 256 * 6535 - 90 = 53.59182976  -> rounded to six
> places: 53.59183
> 
> 
> This would be the WMS request:
> http://labs.metacarta.com/wms-c/Basic.py?SERVICE=WMS&LAYERS=satellite&EX
> CEPTIONS=application/vnd.ogc.se_inimage&FORMAT=image/jpeg&HEIGHT=256&REQ
> UEST=GetMap&WIDTH=256&BBOX=7.515329,53.569857,7.537302,53.59183&STYLES=&
> SRS=EPSG:4326&VERSION=1.1.1
> 
> This request gives me the error message: "An error occurred: Current x
> value 7.515329 is too far from tile corner x 7.514648"

Using the new number, I get:

.00008583068847656250 * 256 * 8534 - 180
7.51464843750000000000

Which looks like it will round, at 6 decimal places, to 7.514648, so it
looks like you should be good.

Regards,
-- 
Christopher Schmidt
MetaCarta



More information about the Tilecache mailing list