[GIS] Efficient Outputs for GeoServer Vector Data

geoservergeowebcacheopenlayers-2tiles

We have a mapping application at http://explorer.geowessex.com which uses OpenLayers and GeoServer for delivering the data. The data is potentially endless and we have very little control on what goes in. The data is served from an Oracle Database and published to GeoServer and also (in instances where it is necessary) cached off in GeoWebCache. The problem is trying to work out the correct image format to deliver the 256×256 tiles for these vector layers. We recently switched to PNG8 as this delivers tiles four times smaller than PNGs with what we thought was very little impact. Sadly we recently spotted that if we set the option Transparent to True in our GetMap request we lose any translucency that there should be on the layer, and since we are tiling layers over the top of each other, we need that option!

Here are two examples;

With 'transparent' set to false we can see the pink lines underneath the pink polygon looking thing, but the background is not transparent, so when put on a map it covers all the mapping behind it. Not good.

http://wms.geowessex.com/geoserver/wms?LAYERS=dev%3AALL_STYLE_TEST_TABLE4720,gis:ROUTE&CACHE=false&TRANSPARENT=false&FORMAT=image%2Fpng8&EXCEPTIONS=application%2Fvnd.ogc.se_xml&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&STYLES=&SRS=EPSG%3A900913&BBOX=-264166.03050625,6594375.6422375,-254382.0908875,6604159.5818563&WIDTH=256&HEIGHT=256&format_options=antialias:none

With 'transparent' set to True we cannot see the pink under the pink polygon looking thing, but the background is transparent, so when put on the map you can see other layers. Better, but still not good.

http://wms.geowessex.com/geoserver/wms?LAYERS=gis:ROUTE,dev%3AALL_STYLE_TEST_TABLE4720&CACHE=false&TRANSPARENT=true&FORMAT=image%2Fpng8&EXCEPTIONS=application%2Fvnd.ogc.se_xml&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&STYLES=&SRS=EPSG%3A900913&BBOX=-264166.03050625,6594375.6422375,-254382.0908875,6604159.5818563&WIDTH=256&HEIGHT=256&format_options=antialias:none

Of course, one way to solve this problem is to switch all vector data to PNGs, which work perfectly, like this

http://wms.geowessex.com/geoserver/wms?LAYERS=gis:ROUTE,dev%3AALL_STYLE_TEST_TABLE4720&CACHE=false&TRANSPARENT=true&FORMAT=image%2Fpng&EXCEPTIONS=application%2Fvnd.ogc.se_xml&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&STYLES=&SRS=EPSG%3A900913&BBOX=-264166.03050625,6594375.6422375,-254382.0908875,6604159.5818563&WIDTH=256&HEIGHT=256&format_options=antialias:none

But as you will see if you look at the size of the response, this tile on it's own is 256.6KB, where as the PNG8s were 64.4KB. There is every possibility that someone might actually want 10 layers turned on at once, with each layer maybe needing about 30 tiles each depending on the users screen size you can see the amount of data that needs to be sent starts hitting many, many Megabytes a time and over the course of one session the user might have clocked a total download running into hundreds of megabytes. This is really bad and we cannot find a solution that both provides smallish tiles sizes and the ability to be transparent and translucent at the same time. Does anyone have any ideas on this? What do other mapping systems use? FYI I have looked at the all purpose GeoServer bible 'GeoServer on Steroids' as well as a number of other similar PDFs to very little avail. None seem to hit the same problem we do and I can't work out what we are doing differently! Also FYI we will be switching our OS Basemaps/Aerial Photography and other Raster datasets to JPEG soon which will save a lot of bandwidth/frustration, but we can't do the same with vectors.

Best Answer

Support for translucency in PNG8 has been added in 2.2.x: http://geo-solutions.blogspot.it/2012/05/developers-corner-geoserver-stunning.html