[Geoserver-users] GeoWebCache 1.1.3

Version 1.1.3 introduces new features and fixes minor bugs

Go to http://geowebcache.org/trac/wiki/Version1.1.3 to see a nicely formatted version of this document

GeoWebCache 1.1.3 adds some great new features sponsored by Statens Kartverk, the Norwegian Mapping and Cadastre Authority ( http://www.statkart.no ). Thanks to their generous support we have been able to implement two items from the menu, as well as a "gutter", a buffer of pixels around metatiles that is sliced away. The two other items are "format modifiers" and the ability to adjust JPEG compression. You can read more about these features below, but the most important thing is that they make your tiles look better when using JPEG. The key technique is to not retrieve JPEGs from the WMS server, but use TIFF or PNG, and then only apply JPEG compression in the last step. The ability to adjust the quality ratio offers additional control.

You can see OpenLayers, GeoWebCache and MapServer in action right on the front page of their website.

You may have noticed that there was no explicit release of 1.1.2. The latter was rushed into GeoServer 1.7.5, and since the work on 1.1.3 was expected to start shortly thereafter I skipped the release of 1.1.2.

Summary of changes, in reverse order of appearance
    * Fixed content type check for image/png formats. Anything that starts with image/png is now accepted as a reponse from the WMS server
    * Fixed image/png mode=24bit; , the space in this format was previously no correctly encoded
    * Fixed metatiling bug in seeder. The tiler did not start at the closest metatile boundary and could stop prematurely. This mean that slightly less than one metatile could be missing on the upper and right hand edges of the area that was requested to be seed. This would then get dynamically seeded in most cases, so it was difficult to notice.
    * Added support for format modifiers. See below
    * Added support for gutter. See below
    * Switched H2 database to auto mode by default. In theory this means that more one GWC instance can use the same cache directory.
    * Added GWC_BLANK_TILE_PATH , a variable that can be set in the environment or web.xml. It allows you to specify what image file is to be used instead of the standard 8 bit transparent PNG. Note that content type response is currently hardcoded to say image/png.
    * Fixed KML service linking to tiles below the specified zoom level. The hierarchy now stops as defined in the EPSG:4326 grid

Format Modifiers

WMS allows certain settings that make more sense for some formats than for others. In particular, TRANSPARENT is only meaningful if the formats supports transparency, and BGROUND (background) only makes sense if the format is not transparent. To get the best of both worlds, for two different formats, you previously had to define as two separate layers in the GeoWebCache configuration. Additionally, you can tell GeoWebCache to use a different format when requesting the metatiles from the backend.

The example below is from. Note that format modifiers can be inserted on a per-layer basis (following </mimeFormats>) or on the global level (before <layers>). See the XSD documentation for details, http://geowebcache.org/schema/docs/1.1.3

<formatModifiers>
  <formatModifier>
    <!-- Mandatory, the format requested by client -->
    <responseFormat>image/jpeg</responseFormat>
    <!-- Optional, the format GWC will use to get metatiles from backend,
      This allows you to avoid lossy compression, such as JPEG, to be
      applied twice. Use image/png; mode=24bit for MapServer -->
    <requestFormat>image/png</requestFormat>
    <!-- Optional, override transparent parameter in WMS request -->
    <transparent>false</transparent>
    <!-- Optional, override or set backgroud color for WMS request.
           The following uses a light grey background -->
    <bgColor>0xDDDDDD</bgColor>
    <!-- Optional, override or set palette parameter for WMS request -->
    <palette>webSafePalette</palette>
    <!-- Optional, adjust the compression ratio used when saving
      the tiles. For minimum compression use 1.0 -->
    <compressionQuality>1.0</compressionQuality>
  </formatModifier>
</formatModifiers>

JPEG Quality Control

The JPEG encoder that ships with Java appears to default to a quality ratio of 0.75. This can be adjusted by using a format modifier, the suggested configuration for high quality tiles is

<formatModifiers>
  <formatModifier>
    <responseFormat>image/jpeg</responseFormat>
    <requestFormat>image/png</requestFormat>
    <compressionQuality>0.85</compressionQuality>
  <formatModifier>
</formatModifiers>

If the layer is potentially transparent, you should add the following before <compressionQuality>:

    <transparent>false</transparent>
    <bgColor>0xFFFFFF</bgColor>

Gutter

The gutter is defined on a per-layer basis. It is a buffer that is added to the WMS request to the backend, and then sliced away when the tiles are saved to disk. This feature can improve the appearance by avoiding edge effects. It may cause problems if you have polygons that are labeled multiple times. In particular, it was implemented for use with MapServer?.

So if you have 3x3 metatiling and the tiles are 256x256, the metatile would normally be 768x768. With a 20px buffer this changes to 808x808. Note that GeoWebCache respects the layer bounds, to avoid exceeding the bounds that the WMS server can handle.

--
Arne Kepp
OpenGeo - http://opengeo.org
Expert service straight from the developers

Arne thanks for your detailed listing of all the new enhancements to geowebcache!

I have a question specifically regarding the outputting of jpeg format to the client. I like the format of jpeg to the client since for raster imagery it is about 1/9 smaller than png and the quality looks similar but I could not use that format unless it was the bottom layer because it is was always opaque to the client meaning that it completely covers the lower layers even in areas where it has not data. One of enhancements to geowebcache appears to be the ability to output as jpeg as a transparent layer.
Is my assumption correct?

I have pasted the area that I am referring from your email below:

Thanks,

John Mitchell

JPEG Quality Control

The JPEG encoder that ships with Java appears to default to a quality
ratio of 0.75. This can be adjusted by using a format modifier, the
suggested configuration for high quality tiles is



image/jpeg</
responseFormat>
*image/png</*requestFormat>
*0.85</*compressionQuality>

If the layer is potentially transparent, you should add the following
before :

false</ transparent>
0xFFFFFF

Correction I meant to say jpeg is 9 times smaller than png

On Fri, Jun 19, 2009 at 5:19 AM, John Mitchell <mitchelljj98@anonymised.com> wrote:

Arne thanks for your detailed listing of all the new enhancements to geowebcache!

I have a question specifically regarding the outputting of jpeg format to the client. I like the format of jpeg to the client since for raster imagery it is about 1/9 smaller than png and the quality looks similar but I could not use that format unless it was the bottom layer because it is was always opaque to the client meaning that it completely covers the lower layers even in areas where it has not data. One of enhancements to geowebcache appears to be the ability to output as jpeg as a transparent layer.
Is my assumption correct?

I have pasted the area that I am referring from your email below:

Thanks,

John Mitchell

JPEG Quality Control

The JPEG encoder that ships with Java appears to default to a quality
ratio of 0.75. This can be adjusted by using a format modifier, the
suggested configuration for high quality tiles is



image/jpeg</
responseFormat>
*image/png</*requestFormat>
*0.85</*compressionQuality>

If the layer is potentially transparent, you should add the following
before :

false</ transparent>
0xFFFFFF


John J. Mitchell

Sorry John, I see where your interpretation is coming from, but it's not correct.

Standard JPEG does not support alpha channels (transparency) in any form. The example below actually encourages you to disable the alpha channel in the PNG, because there is no way to correctly encode it in the JPEG. JPEG 2000, the next generation of JPEG, does support transparency. But there is no encoder for it in standard Java, and most browsers and applications do not support it anyway.

If you are interested in funding it I can make a menu item for supporting JPEG 2000 through an external plugin, but I believe that licensing / patent restrictions make it impossible to support this format out of the box. (Correct me if I am wrong, anyone).

A really fancy solution would detect PNGs with transparency and output those as PNGs, only use JPEGs for fully covered tiles. But that's a lot of work.

-Arne

ps. I will only respond to the geowebcache list in further replies. Sorry about the cross posting, I will send two separate emails next time

John Mitchell wrote:

Arne thanks for your detailed listing of all the new enhancements to geowebcache!

I have a question specifically regarding the outputting of jpeg format to the client. I like the format of jpeg to the client since for raster imagery it is about 1/9 smaller than png and the quality looks similar but I could not use that format unless it was the bottom layer because it is was always opaque to the client meaning that it completely covers the lower layers even in areas where it has not data. One of enhancements to geowebcache appears to be the ability to output as jpeg as a transparent layer.
Is my assumption correct?

I have pasted the area that I am referring from your email below:

Thanks,

John Mitchell

/JPEG Quality Control

The JPEG encoder that ships with Java appears to default to a quality
ratio of 0.75. This can be adjusted by using a format modifier, the
suggested configuration for high quality tiles is

<formatModifiers>
<formatModifier>
   <responseFormat>image/jpeg<//
/responseFormat>
   <requestFormat>image/png<///requestFormat>
   <compressionQuality>0.85<///compressionQuality>
<formatModifier>
</formatModifiers>

If the layer is potentially transparent, you should add the following
before <compressionQuality>:

   <transparent>false<// /transparent>
   <bgColor>0xFFFFFF</bgColor>
/
------------------------------------------------------------------------

------------------------------------------------------------------------------
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables unlimited
royalty-free distribution of the report engine for externally facing server and web deployment.
http://p.sf.net/sfu/businessobjects
------------------------------------------------------------------------

_______________________________________________
Geowebcache-users mailing list
Geowebcache-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geowebcache-users
  
--
Arne Kepp
OpenGeo - http://opengeo.org
Expert service straight from the developers

Arne,

Another enhancement to geowebcache that I have listed below:

Switched H2 database to auto mode by default. In theory this means
that more than one GWC instance can use the same cache directory.

In practice what would be the problems if I did this?

As an example if one instance of geowebcahe is from the seeding server and another instance is from the production
server which does dynamic seeding as clients request areas and both instances point to the same cache directory.

Thanks,

John Mitchell