[OpenLayers-Dev] GeoWebCache layer

Iván Sánchez Ortega ivan at sanchezortega.es
Mon Nov 22 17:39:27 EST 2010


Hi all,

I'm working in a project that involves running GeoServer+GeoWebCache to 
generate a whole bunch of tiles, then copying all the unmodified cached tiles 
to a frontend., then put openlayers on top.

The trick is that GWC's way of naming cached tiles looks like this:

EPSG_$projection_$namespace_$layer_08/05_04/0161_0146.png

Here, 08 is z, 0161 is x, and 0146 is y. But the zero-padding and that 
mid-level directory prevents us from using XYZ or TMS.


Worry no more! The brand-new GWC layer allows to load a mirrored copy of GWC's 
tile cache with no hassle, even accounting for GWC's bugs! Looky here: 
http://ivan.sanchezortega.es/GWC.js


Usage is pretty straightforward:

	var gwc = new OpenLayers.Layer.GWC({});

	gwc.url = "path_to_cache_dir/EPSG_12345_namespace_layer_";
	gwc.type = 'png';
	gwc.name = "foobar"

	map.addLayer(gwc);

Best,
-- 
----------------------------------
Iván Sánchez Ortega <ivan at sanchezortega.es> <ivan at geonerd.org>

http://ivan.sanchezortega.es
Proudly running Debian Linux with 2.6.35-trunk-amd64 kernel, KDE 3.5.10, and 
PHP 5.3.3-4 generating this signature.
Uptime: 23:28:21 up 22 days, 10:10,  6 users,  load average: 2.38, 2.04, 1.47


More information about the Dev mailing list