[OpenLayers-Users] mapserver layer image type

Richard Greenwood richard.greenwood at gmail.com
Sun Dec 2 22:07:16 EST 2007


On Dec 2, 2007 7:12 PM, Christopher Schmidt <crschmidt at metacarta.com> wrote:
> On Sun, Dec 02, 2007 at 01:43:29PM -0700, Richard Greenwood wrote:
> > On Dec 2, 2007 1:36 PM, Gregor Mosheh <gregor at hostgis.com> wrote:
> > > Richard Greenwood wrote:
> > > > Is it possible to set a mapserver layer image type to jpeg?
> > >
> > > Boy, this has come up a few times in the last few days! Mapserver
> > > *layers* don't have an image type. Mapserver's output image has a image
> > > type. And yes, that can indeed be JPEG.
> > >
> > > Set the IMAGETYPE to jpeg and, if desired, create a OUTPUTFORMAT block
> > > with any JPEG settings such as image quality.
> >
> > I'm not referring to the map file, I'm talking about doing it in
> > Openlayers. MapServer.js has :
> >    map_imagetype: "png"
> > which gets put into the image request url AFTER my {layers:
> > "LayerName", map_imagetype: "jprg"} thus over riding my attempt to set
> > the image type.
>
> That's odd: are you saying that your request had two map_imagetype
> parameters? Can you reproduce with minimal changes to one of the examples?
> This would definitely be a bug.

Looks like maybe a case-sensitive string comparison.  In line 20 of
mapserver.html, if you put in an upper case MAP_IMAGETYPE e.g.:
    "http://labs.metacarta.com/wms/vmap0", {layers: 'basic',
MAP_IMAGETYPE: 'jpeg'},
you'll get two map_imagetype's, one upper, one lower, with the second
(lowercase) coming from MapServer.js and trumping the first.

> > I changed the image type definition on MapServer.js, but then I get
> > nothing, presumably because Openlayers is expecting a PNG.
>
> This definitely isn't the reason: OpenLayers knows nothing about the
> actual returned mime type, only the browser knows.

That's good to know. It didn't make much sense as I was writing it,
but I'm not sure then what it was I was running into.

Thanks for the help.

Rich

-- 
Richard Greenwood
richard.greenwood at gmail.com
www.greenwoodmap.com



More information about the Users mailing list