[Tilecache] threshold

Eric Lemoine Eric.Lemoine at camptocamp.com
Wed Mar 14 08:59:09 EDT 2007


On 3/14/07, Schuyler Erle <sderle at metacarta.com> wrote:
> On Mon, 2007-03-12 at 10:16 -0800, Brent Pedersen wrote:
>
> > anyhoo, a quick fix is to set threshold in __init__ as something like:
> >
> > self.threshold = math.abs(bbox[2]/10e4)
> > or
> > (bbox[2] - bbox[0])/10e4
> >
> > havent done enough testing to be sure this is the case, but it seems
> > to have fixed the problems i was seeing.... and it makes sense.
>
> Brent, thanks for looking at this. Doesn't 10e4 seem kind of arbitrary?
> I think that what we really care about is: Is the difference between our
> computed tile grid and the tile extents we are being asked for
> significantly less than a pixel? Since resolution is measured in
> map-units-per-pixel, why don't we just use the resolution at the current
> zoom level (or some fraction of it) as our threshold? Can you all try
> this patch and let me know if it works for any of you?
>
> --- TileCache/Layer.py  (revision 1807)
> +++ TileCache/Layer.py  (local)
> @@ -134,15 +133,16 @@
>          x0 = (minx - self.bbox[0]) / (res * self.size[0])
>          y0 = (miny - self.bbox[1]) / (res * self.size[1])
>
> -        x = int(x0 + self.threshold / 2)
> -        y = int(y0 + self.threshold / 2)
> +        threshold = res
> +        x = int(x0 + threshold / 2)
> +        y = int(y0 + threshold / 2)
>
>          if exact:
> -            if abs(x - x0) > self.threshold:
> +            if abs(x - x0) > threshold:
>                  if self.debug:
>                      warn("x (%f) - x0 (%f) = %f" % (x, x0, abs(x-x0)))
>                  return None
> -            if abs(y - y0) > self.threshold:
> +            if abs(y - y0) > threshold:
>                  if self.debug:
>                      warn("y (%f) - y0 (%f) = %f" % (y, y0, abs(y-y0)))
>                  return None
>
>
> Debugging TileCache can be difficult, because there's both the client
> and the server to consider. I hope that this will help sort out some of
> the issues we've been seeing.

I just did a quick try and it doesn't work. The WMS server gives me a
white baselayer image (I guess white is the actual image's background
color).

-- 
Eric Lemoine

Camptocamp France SAS
Savoie Technolac, BP 352
73377 Le Bourget du Lac, Cedex

Tel : 00 33 4 79 44 44 96
Mail : eric.lemoine at camptocamp.com
http://www.camptocamp.com



More information about the Tilecache mailing list