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

Arnd Wippermann arnd.wippermann at web.de
Sat Oct 29 08:23:56 EDT 2011


It's not a question of OpenLayers. It's up to the browsers.

OpenLayers does only set the src of the image tag. The browsers are
responsible for displaying the images.

<img src="urltoimage"> 

As far a i know browsers support png, gif and jpg, but absolutly not tif.

Arnd


-----Ursprüngliche Nachricht-----
Von: openlayers-users-bounces at lists.osgeo.org
[mailto:openlayers-users-bounces at lists.osgeo.org] Im Auftrag von
michaeladamkatz
Gesendet: Samstag, 29. Oktober 2011 13:25
An: users at openlayers.org
Betreff: [OpenLayers-Users] using tiff (or other uncompressed file type) as
the format for a WMS layer

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.
_______________________________________________
Users mailing list
Users at lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/openlayers-users



More information about the Users mailing list