[Tilecache] Using Tilecache WMS from Win32 app

Christopher Schmidt crschmidt at metacarta.com
Thu Dec 6 07:42:31 EST 2007


On Thu, Dec 06, 2007 at 08:43:01AM +0100, David E. Reksten wrote:
> On 05/12/2007, Christopher Schmidt <crschmidt at metacarta.com> wrote:
> > On Wed, Dec 05, 2007 at 06:03:49PM +0100, David E. Reksten wrote:
> > > Thanks for your reply. We've got Tilecache up and running smoothly
> > > with Openlayers on Windows 2003 Server (Apache + mod_python), no
> > > problem there.
> > >
> > > What we want is to access the Tilecache WMS from an application rather
> > > than a browser.
> >
> > "An application" meaning "An existing application which uses WMS", or
> > "an application" meaning "An application written in house?"
> 
> In this context, I was thinking of a Windows-based application written
> in-house. Sorry for not being entirely clear on this.
> 
> > TileCache is a tile server *only*: it does not serve standard WMS
> > requests. Any application wanting to connect to it must speak one of:
> >   * WMS-C
> >   * WorldWind
> >   * TileService (very similar to WorldWind)
> >   * TMS
> >
> > Nothing else will work.
> 
> I suspected as much. Do you know if there are any open source
> libraries or code examples that demonstrates how to implement any of
> these?

Well, they're all pretty simple, so I'm not sure exactly what you're
looking for. The basic principle is essentially encapsulated in:

http://trac.openlayers.org/browser/trunk/openlayers/lib/OpenLayers/Layer/Grid.js#L306

though it's a bit complex for the common case. Basically, you want to
divide the world into a grid, starting in the lower left corner of your bbox. 
Each grid cell is resolution * tileWidth geographic units wide: the
default TileCache zoom level is .706125, so if you start off in the
lower left corner, you have one grid cell which is:

-180, -90, -180 + .706125 * 256 (0), -90 + .706125 * 256 (90)

and another:

0, -90, 0 + .706125 * 256 (180), -90 + .706125 * 256 (90)

Then, you essentially have to figure out where to position these tiles
in your window, based on where they fit into your grid: so if your view
is -170, -80, 170, 80, then you have something which places each tile
10px outside the border of the window: that means that the positinoing
of the first tile relative to the lower left window corner is
-10/.706125: -14.1617985 px outside in each direction.

Does that make sense? Is it something to start with? 

Regards,
-- 
Christopher Schmidt
MetaCarta



More information about the Tilecache mailing list