Re: [OpenLayers-Users] Opacity of GoogleLayer, get selected layer

2010-01-15 Thread Dirk Tanneberger

Eric Lemoine schrieb:

On Fri, Jan 15, 2010 at 12:05 PM, Dirk Tanneberger
 wrote:
  

Hi Eric,  thanks for the fast reply.

With the baseLayer-object it works. I tried to apply the method directly to
the layer, maybe that was the problem.
But still I have the problem, when changing the baseLayer. In my case I got
three baseLayers and no matter which one is selected it should have a
opacity.
If I do it like this:

var map = new OpenLayers.Map(options);

var google = new OpenLayers.Layer.Google(
"Google",
{'sphericalMercator': true}
);

var OSM = new OpenLayers.Layer.OSM("OSM");

var google_t = new OpenLayers.Layer.Google(
"Google_Terrain",
{type: G_PHYSICAL_MAP, 'sphericalMercator': true}
);

map.addLayers([OSM, google, google_t]);

map.baseLayer.setOpacity(0.5);

the opacity is applied just to the initial baseLayer. The other layers don't
have a opacity after being selected.
I think, thats why I have to trigger the event, wether a layer is selected
or not and set the opacity afterwards.
Maybe it is possible to do so in the treepanel-object of the mapFish-API.
Couldn't find anything appropriate so far, but I have to dig more into it.
If you or somebody else got a hint, I would appreciate it very much.





open the firebug console, and do:

map.layers[0].setOpacity(0.2) // -> this changes the opacity of the
current base layer
map.layers[1].setOpacity(0.2) // -> this changes the opacity of the
Google Satellite layer, although it's not the current base layer

now select the Google Satellite layer in the LayerSwitcher, its
opacity is expectedly 0.2.

Maybe I don't understand the issue you're having.

  

Alright, that works.
I thought, I can do it dynamicly. Set the opacity of a layer just after 
it is selected. But to do it initially for every layer, is fine for the 
moment.


Merci
Dirk.
___
Users mailing list
Users@openlayers.org
http://openlayers.org/mailman/listinfo/users


Re: [OpenLayers-Users] Opacity of GoogleLayer, get selected layer

2010-01-15 Thread Arnd Wippermann
Hi,

OSM.setOpacity(0.1);

map.addLayers([google, OSM, google_t]);

google.setOpacity(0.1);
google_t.setOpacity(0.1); 

The Google layers have to add to the map before you can change the opacity
of the Google layers. For other layers it's possible before adding them to
the map.

Arnd


-Ursprüngliche Nachricht-
Von: users-boun...@openlayers.org [mailto:users-boun...@openlayers.org] Im
Auftrag von Eric Lemoine
Gesendet: Freitag, 15. Januar 2010 17:21
An: Dirk Tanneberger
Cc: users@openlayers.org
Betreff: Re: [OpenLayers-Users] Opacity of GoogleLayer, get selected layer

On Fri, Jan 15, 2010 at 12:05 PM, Dirk Tanneberger
 wrote:
> Hi Eric,  thanks for the fast reply.
>
> With the baseLayer-object it works. I tried to apply the method 
> directly to the layer, maybe that was the problem.
> But still I have the problem, when changing the baseLayer. In my case 
> I got three baseLayers and no matter which one is selected it should 
> have a opacity.
> If I do it like this:
>
> var map = new OpenLayers.Map(options);
>
>     var google = new OpenLayers.Layer.Google(
>             "Google",
>             {'sphericalMercator': true}
>     );
>
>     var OSM = new OpenLayers.Layer.OSM("OSM");
>
>     var google_t = new OpenLayers.Layer.Google(
>                 "Google_Terrain",
>                 {type: G_PHYSICAL_MAP, 'sphericalMercator': true}
>     );
>
>     map.addLayers([OSM, google, google_t]);
>
>     map.baseLayer.setOpacity(0.5);
>
> the opacity is applied just to the initial baseLayer. The other layers 
> don't have a opacity after being selected.
> I think, thats why I have to trigger the event, wether a layer is 
> selected or not and set the opacity afterwards.
> Maybe it is possible to do so in the treepanel-object of the mapFish-API.
> Couldn't find anything appropriate so far, but I have to dig more into it.
> If you or somebody else got a hint, I would appreciate it very much.

<http://www.openlayers.org/dev/examples/spherical-mercator.html>

open the firebug console, and do:

map.layers[0].setOpacity(0.2) // -> this changes the opacity of the current
base layer
map.layers[1].setOpacity(0.2) // -> this changes the opacity of the Google
Satellite layer, although it's not the current base layer

now select the Google Satellite layer in the LayerSwitcher, its opacity is
expectedly 0.2.

Maybe I don't understand the issue you're having.

--
Eric Lemoine

Camptocamp France SAS
Savoie Technolac, BP 352
73377 Le Bourget du Lac, Cedex

Tel : 00 33 4 79 44 44 96
Mail : eric.lemo...@camptocamp.com
http://www.camptocamp.com
___
Users mailing list
Users@openlayers.org
http://openlayers.org/mailman/listinfo/users

___
Users mailing list
Users@openlayers.org
http://openlayers.org/mailman/listinfo/users


Re: [OpenLayers-Users] Opacity of GoogleLayer, get selected layer

2010-01-15 Thread Eric Lemoine
On Fri, Jan 15, 2010 at 12:05 PM, Dirk Tanneberger
 wrote:
> Hi Eric,  thanks for the fast reply.
>
> With the baseLayer-object it works. I tried to apply the method directly to
> the layer, maybe that was the problem.
> But still I have the problem, when changing the baseLayer. In my case I got
> three baseLayers and no matter which one is selected it should have a
> opacity.
> If I do it like this:
>
> var map = new OpenLayers.Map(options);
>
>     var google = new OpenLayers.Layer.Google(
>             "Google",
>             {'sphericalMercator': true}
>     );
>
>     var OSM = new OpenLayers.Layer.OSM("OSM");
>
>     var google_t = new OpenLayers.Layer.Google(
>                 "Google_Terrain",
>                 {type: G_PHYSICAL_MAP, 'sphericalMercator': true}
>     );
>
>     map.addLayers([OSM, google, google_t]);
>
>     map.baseLayer.setOpacity(0.5);
>
> the opacity is applied just to the initial baseLayer. The other layers don't
> have a opacity after being selected.
> I think, thats why I have to trigger the event, wether a layer is selected
> or not and set the opacity afterwards.
> Maybe it is possible to do so in the treepanel-object of the mapFish-API.
> Couldn't find anything appropriate so far, but I have to dig more into it.
> If you or somebody else got a hint, I would appreciate it very much.



open the firebug console, and do:

map.layers[0].setOpacity(0.2) // -> this changes the opacity of the
current base layer
map.layers[1].setOpacity(0.2) // -> this changes the opacity of the
Google Satellite layer, although it's not the current base layer

now select the Google Satellite layer in the LayerSwitcher, its
opacity is expectedly 0.2.

Maybe I don't understand the issue you're having.

-- 
Eric Lemoine

Camptocamp France SAS
Savoie Technolac, BP 352
73377 Le Bourget du Lac, Cedex

Tel : 00 33 4 79 44 44 96
Mail : eric.lemo...@camptocamp.com
http://www.camptocamp.com
___
Users mailing list
Users@openlayers.org
http://openlayers.org/mailman/listinfo/users


Re: [OpenLayers-Users] Opacity of GoogleLayer, get selected layer

2010-01-15 Thread Dirk Tanneberger

Hi Eric,  thanks for the fast reply.

With the baseLayer-object it works. I tried to apply the method directly 
to the layer, maybe that was the problem.
But still I have the problem, when changing the baseLayer. In my case I 
got three baseLayers and no matter which one is selected it should have 
a opacity.

If I do it like this:

var map = new OpenLayers.Map(options);
  
   var google = new OpenLayers.Layer.Google(

   "Google",
   {'sphericalMercator': true}
   );
  
   var OSM = new OpenLayers.Layer.OSM("OSM");
  
   var google_t = new OpenLayers.Layer.Google(

   "Google_Terrain",
   {type: G_PHYSICAL_MAP, 'sphericalMercator': true}
   );
  
   map.addLayers([OSM, google, google_t]);
  
   map.baseLayer.setOpacity(0.5);


the opacity is applied just to the initial baseLayer. The other layers 
don't have a opacity after being selected.
I think, thats why I have to trigger the event, wether a layer is 
selected or not and set the opacity afterwards.
Maybe it is possible to do so in the treepanel-object of the 
mapFish-API. Couldn't find anything appropriate so far, but I have to 
dig more into it.

If you or somebody else got a hint, I would appreciate it very much.

Cheers
Dirk.




Eric Lemoine schrieb:

On Wed, Jan 13, 2010 at 7:05 PM, Dirk Tanneberger
 wrote:
  

Hi everybody,



Hi

  

I'm using Openlayers within MapFish. But I think the issue is specific
to Openlayers, so I post it here. Hope somebody got a clue.

What I'm trying to do is: applying a opacity to a Google-Layer with the
"setOpacity"-method.

Here is the code I'm using:

   var options = {
   projection: new OpenLayers.Projection("EPSG:900913"),
   displayProjection: new OpenLayers.Projection("EPSG:4326"),
   units: "m",
   numZoomLevels: 18,
   maxResolution: 156543.0339,
   maxExtent: new OpenLayers.Bounds(810690, 6027000,
   883240, 6118400),
   controls: []
   };

   var map = new OpenLayers.Map(options);

   var google = new OpenLayers.Layer.Google(
   "Google",
   {'sphericalMercator': true}
   );

   var OSM = new OpenLayers.Layer.OSM("OSM");

   var google_t = new OpenLayers.Layer.Google(
   "Google_Terrain",
   {type: G_PHYSICAL_MAP, 'sphericalMercator': true}
   );

   google.setOpacity(0.5);


   map.addLayers([google, OSM, google_t]);




It works fine for th OSM-layer (if specified), but either one of the
Google-layers won't take the opacity. They just show up in full bright.
Has anybody experienced similar?



No. I just opened
 and
entered map.baseLayer.setOpacity(0.2) in the FireBug console and the
Google layer's opacity did change. Do you have a live example showing
the problem?

  

Another question is: How can I obtain the selected Layer from the map?



map.baseLayer may be what you're looking for.

Cheers,

  


___
Users mailing list
Users@openlayers.org
http://openlayers.org/mailman/listinfo/users


Re: [OpenLayers-Users] Opacity of GoogleLayer, get selected layer

2010-01-13 Thread Eric Lemoine
On Wed, Jan 13, 2010 at 7:05 PM, Dirk Tanneberger
 wrote:
> Hi everybody,

Hi

>
> I'm using Openlayers within MapFish. But I think the issue is specific
> to Openlayers, so I post it here. Hope somebody got a clue.
>
> What I'm trying to do is: applying a opacity to a Google-Layer with the
> "setOpacity"-method.
>
> Here is the code I'm using:
>
>    var options = {
>            projection: new OpenLayers.Projection("EPSG:900913"),
>            displayProjection: new OpenLayers.Projection("EPSG:4326"),
>            units: "m",
>            numZoomLevels: 18,
>            maxResolution: 156543.0339,
>            maxExtent: new OpenLayers.Bounds(810690, 6027000,
>                                                883240, 6118400),
>            controls: []
>    };
>
>    var map = new OpenLayers.Map(options);
>
>    var google = new OpenLayers.Layer.Google(
>            "Google",
>            {'sphericalMercator': true}
>    );
>
>    var OSM = new OpenLayers.Layer.OSM("OSM");
>
>    var google_t = new OpenLayers.Layer.Google(
>                "Google_Terrain",
>                {type: G_PHYSICAL_MAP, 'sphericalMercator': true}
>    );
>
>    google.setOpacity(0.5);
>
>
>    map.addLayers([google, OSM, google_t]);
>
>
>
>
> It works fine for th OSM-layer (if specified), but either one of the
> Google-layers won't take the opacity. They just show up in full bright.
> Has anybody experienced similar?

No. I just opened
 and
entered map.baseLayer.setOpacity(0.2) in the FireBug console and the
Google layer's opacity did change. Do you have a live example showing
the problem?

> Another question is: How can I obtain the selected Layer from the map?

map.baseLayer may be what you're looking for.

Cheers,

-- 
Eric Lemoine

Camptocamp France SAS
Savoie Technolac, BP 352
73377 Le Bourget du Lac, Cedex

Tel : 00 33 4 79 44 44 96
Mail : eric.lemo...@camptocamp.com
http://www.camptocamp.com
___
Users mailing list
Users@openlayers.org
http://openlayers.org/mailman/listinfo/users


[OpenLayers-Users] Opacity of GoogleLayer, get selected layer

2010-01-13 Thread Dirk Tanneberger
Hi everybody,

I'm using Openlayers within MapFish. But I think the issue is specific 
to Openlayers, so I post it here. Hope somebody got a clue.

What I'm trying to do is: applying a opacity to a Google-Layer with the 
"setOpacity"-method.

Here is the code I'm using:

var options = {
projection: new OpenLayers.Projection("EPSG:900913"),
displayProjection: new OpenLayers.Projection("EPSG:4326"),
units: "m",
numZoomLevels: 18,
maxResolution: 156543.0339,
maxExtent: new OpenLayers.Bounds(810690, 6027000,
883240, 6118400),
controls: []
};

var map = new OpenLayers.Map(options);
   
var google = new OpenLayers.Layer.Google(
"Google",
{'sphericalMercator': true}
);
   
var OSM = new OpenLayers.Layer.OSM("OSM");
   
var google_t = new OpenLayers.Layer.Google(
"Google_Terrain",
{type: G_PHYSICAL_MAP, 'sphericalMercator': true}
);
   
google.setOpacity(0.5);

   
map.addLayers([google, OSM, google_t]);




It works fine for th OSM-layer (if specified), but either one of the 
Google-layers won't take the opacity. They just show up in full bright.
Has anybody experienced similar?


Another question is: How can I obtain the selected Layer from the map? I 
was looking for a method on the map- or layer-object, like 
"selectedLayer" or "isSelectedLayer". But I couldn't find any in the API.
I would like use it to change the appearence of a layer after it is 
selected.

Thanks very much for any hints.




Best regards, Dirk.

___
Users mailing list
Users@openlayers.org
http://openlayers.org/mailman/listinfo/users