[OpenLayers-Dev] WMS: jpeg override

Christopher Schmidt crschmidt at metacarta.com
Thu Mar 12 08:42:01 EDT 2009


On Thu, Mar 12, 2009 at 12:38:18PM +0100, bartvde at osgis.nl wrote:
> Hi Chris,
> 
> I do remember Cameron wanting to change jpeg to png (or gif) as the
> default image format for WMS layers. Would that not be an option instead?

I don't prefer that option.

> Otherwise, I'll be happy to write a patch for the noMagic option.

I'll be happy to review it.

-- Chris

> Best regards,
> Bart
> 
> > On Thu, Mar 12, 2009 at 09:43:27AM +0100, bartvde at osgis.nl wrote:
> >> Okay, let me give an example why this bothers me.
> >>
> >> When reading in a WMC document with layerParams:
> >>
> >> var format = new OpenLayers.Format.WMC({layerParams: {transparent:
> >> 'TRUE'}, layerOptions: {isBaseLayer: false, singleTile: true, buffer: 0,
> >> ratio: 1, displayOutsideMaxExtent: true}});
> >>
> >> I want all WMS overlays to be transparent. But there can be 1 layer at
> >> the
> >> bottom of the stack which is a jpeg aerial photograph in the WMC.
> >
> > If you know this, why can't you just 'del layers[0].params.transparent'
> > from the results of the WMC?
> >
> > The reason that the automatic changing is in there is that for a while,
> > the most common question received on the OL list was "Why can't I see
> > through my  overlays!?" The fact that jpg is the default format means
> > that many people had no idea they were using jpegs at all, and so they
> > had no idea why they just got black imagery.
> >
> > I would say that your use case is a corner case; not the common one.
> > I would be willing to have a non-default layer option like 'noMagic'
> > which turns off the magical work that is done here, since I agree it can
> > be a problem in rare cases, but by default, it helps us avoid a lot of
> > questions.
> >
> > THanks for the use case. It does help focus the discussions.
> >
> >> So I would need some kind of conditional layerParams, which is currently
> >> not possible and a bit of a hassle to implement.
> >>
> >> That's why I am advocating removing the jpeg override.
> >
> >
> >
> >> Best regards,
> >> Bart
> >>
> >> > Hi list,
> >> >
> >> > currently when using a WMS layer as jpeg and transparent true, OL
> >> > "automagically" override the image format to png or gif. This has
> >> caused
> >> > me quite a few headaches in the past weeks to be honest.
> >> >
> >> > I would rather have that transparent true is just ignored, and that
> >> the
> >> > image format remains jpeg. In the end, this is what a WMS does when it
> >> > receives &format=image/jpeg&transparent=TRUE. So why not leave this up
> >> to
> >> > the WMS to deal with it, and maybe write a warning message to the
> >> console
> >> > for the app developer in debug mode?
> >> >
> >> > Btw, I am talking about this piece of code:
> >> >
> >> >             // jpegs can never be transparent, so intelligently switch
> >> the
> >> >             //  format, depending on teh browser's capabilities
> >> >             if (this.params.FORMAT == "image/jpeg") {
> >> >                 this.params.FORMAT = OpenLayers.Util.alphaHack() ?
> >> > "image/gif"
> >> >                                                                  :
> >> > "image/png";
> >> >             }
> >> >
> >> > What do others think?
> >> >
> >> > Best regards,
> >> > Bart
> >> >
> >> > _______________________________________________
> >> > Dev mailing list
> >> > Dev at openlayers.org
> >> > http://openlayers.org/mailman/listinfo/dev
> >> >
> >>
> >>
> >> _______________________________________________
> >> Dev mailing list
> >> Dev at openlayers.org
> >> http://openlayers.org/mailman/listinfo/dev
> >
> > --
> > Christopher Schmidt
> > MetaCarta
> >
> 
> 

-- 
Christopher Schmidt
MetaCarta



More information about the Dev mailing list