[Qgis-user] RE: Qgis-user] openlayers layers without properties is it possible to alter brightness/contrast

M.E.Dodd m.e.dodd at open.ac.uk
Tue Feb 28 02:32:24 PST 2012


Excellent, works fine, just what I wanted, thanks.

-----Original Message-----
From: Richard Duivenvoorde [mailto:rdmailings at duif.net] 
Sent: 28 February 2012 10:24
To: qgis-user at lists.osgeo.org; M.E.Dodd
Subject: Re: [Qgis-user] RE: Qgis-user] openlayers layers without properties is it possible to alter brightness/contrast

On 02/28/2012 10:42 AM, M.E.Dodd wrote:
> Thanks for the suggestion, I tried putting the opacity value here:
>
> var osm = new OpenLayers.Layer.OSM(
>                "OpenStreetMap",
>                "http://tile.openstreetmap.org/${z}/${x}/${y}.png",opacity:0.5
>                {
>
> In the openstreetmaps .html but that made the map vanish altogether so I removed the 'opacity:0.5' and osm map reappeared again.  Do I need to stick it somewhere else in the .html file?

It is a property which you should add in the 'options'-object (I'm talking OpenLayers lingua now, have a look at OpenLayers.org):

So, change this in osm.html:

             var osm = new OpenLayers.Layer.OSM(
               "OpenStreetMap",
               "http://tile.openstreetmap.org/${z}/${x}/${y}.png",
               {
                 eventListeners: {
                   "loadstart": layerLoadStart,
                   "loadend": layerLoadEnd
                 }
               }
             );

Into this:
             var osm = new OpenLayers.Layer.OSM(
               "OpenStreetMap",
               "http://tile.openstreetmap.org/${z}/${x}/${y}.png",
               {
                 eventListeners: {
                   "loadstart": layerLoadStart,
                   "loadend": layerLoadEnd
                 }
                 ,opacity:0.5
               }
             );

This should work :-)

Regards,

Richard Duivenvoorde

-- 
The Open University is incorporated by Royal Charter (RC 000391), an exempt charity in England & Wales and a charity registered in Scotland (SC 038302).




More information about the Qgis-user mailing list