[OpenLayers-Users] using tiff (or other uncompressed file type) as the format for a WMS layer

michaeladamkatz michaeladamkatz at yahoo.com
Sat Oct 29 07:24:36 EDT 2011


I am using OpenLayers with a custom python server, and in my case the server
is actually running on the local machine. I am using a custom WMS layer. I
previously was using

    format: "image/png"

as the format of the WMS layer. The server would return the contents of a
.png file, and it all worked.

In order to speed up the server a bit, I would like to use an uncompressed
file format instead of .png, because I have discovered that simply
compressing the .png file is taking the majority of the time in serving a
request, in many cases. (I am using the Python Image Library to actually
write the image data. My understanding is that there isn't an option for me
to create a "non-compressed" .png file in order to save on compression time.
If there was such an option I'd be done.)

I thought I'd be able to use the .tiff format to achieve this. Indeed, on
the server side I can very quickly create the TIFF output (again, this is
using PIL):

        f = StringIO.StringIO()
        composite_image.save( f, "TIFF" ) # saves much faster than "PNG"
        bytes = f.getvalue()
        f.close()
       
        return bytes

But it seems like the OpenLayers client isn't happy with that. It does not
display the .tiff output, and instead makes repeated requests to the server
(presumably trying to get what it considers a valid response, since I have
OpenLayers.IMAGE_RELOAD_ATTEMPTS = 3;).

Below is the relevant OpenLayers code. Is it possible to serve my WMS layer
as .tiff in this way? If not, what uncompressed file format can I use?



OpenLayers.Layer.MyWms = OpenLayers.Class( OpenLayers.Layer.WMS,
{
    .
    .
    .
    wrapDateLine: true,
    CLASS_NAME: "OpenLayers.Layer.MyWms"
});

    var localWMSOverlay = new OpenLayers.Layer.MyWms(
        "Local WMS Overlay",
        "http://localhost/wms",
        { layers: "basic", format: "image/tiff" },
        { isBaseLayer : false, singleTile: true }
    );
    map.addLayers( [ gmap, localWMSOverlay ] );


--
View this message in context: http://osgeo-org.1803224.n2.nabble.com/using-tiff-or-other-uncompressed-file-type-as-the-format-for-a-WMS-layer-tp6943119p6943119.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.


More information about the Users mailing list