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

Richard Duivenvoorde rdmailings at duif.net
Tue Feb 28 02:23:41 PST 2012


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



More information about the Qgis-user mailing list