Hi Eric,
Thank you for this tip for a fake backgroundlayer
var fake = new OpenLayers.Layer('fake', {displayInLayerSwitcher: false});
map.addLayer(fake);
I added {isBaseLayer:true}
var fake = new OpenLayers.Layer('fake', {isBaseLayer: true});
Now (in the layerswitcher or otherwise) the backgroundlayer can be
selected as a backgroundlayer (if all real backgroundlayers must be out)
Cheers, Huub
On 6/25/2008 4:27 PM, Eric Lemoine wrote:
On Wed, Jun 25, 2008 at 2:36 PM, Christian Braun
<[email protected]> wrote:
Hi List,
Hello,
I am just starting with OpenLayers and I am a looser ;-) in _javascript_,
so please be patient.
I want to overlay different png images in a rudimentary map. Therefore I
created the following code embedded in my standard html:
var map;
function init(){
map = new OpenLayers.Map ("map", {
controls:[
new OpenLayers.Control.Navigation(),
new OpenLayers.Control.PanZoomBar(),
new OpenLayers.Control.Attribution(),
new OpenLayers.Control.MousePosition(),
new OpenLayers.Control.ScaleLine(),
],
numZoomLevels: 5,
maxExtent: new OpenLayers.Bounds(57500, 57500, 106600,
101800),
maxResolution: 'auto',
units: 'm',
projection: new OpenLayers.Projection("EPSG:2169")
} );
layer1 =
newOpenLayers.Layer.Image('LAN1','/lan_output/schedule_baseline_normal_weather/schedule_baseline_normal_weather_L_den.png',
new OpenLayers.Bounds(57500, 57500,
106600, 101800),
new OpenLayers.Projection("EPSG:2169"),
new OpenLayers.Size(491,443)
);
layer2 = new OpenLayers.Layer.Image(
'LAN2','/lan_output/schedule_baseline_normal_weather/schedule_baseline_normal_weather_L_day.png',
new OpenLayers.Bounds(57500, 57500,
106600, 101800),
new OpenLayers.Projection("EPSG:2169"),
The third argument should be the size. Furthermore you don't need to
pass a projection object to the layer as it's already set in the map
options.
new OpenLayers.Size(491,443)
);
map.addLayers([layer1, layer2]);
map.addControl(new OpenLayers.Control.LayerSwitcher());
map.zoomToMaxExtent();
I want to show the images as overlays rather than with an "or" checkbox.
So you don't want your image layers to be "baselayers", you want them
to be "overlays". To make them overlays you need to set the
isBaseLayer option to false:
layer2 = new OpenLayers.Layer.Image(
'LAN2',
'/lan_output/schedule_baseline_normal_weather/schedule_baseline_normal_weather_L_day.png',
new OpenLayers.Bounds(57500, 57500, 106600, 101800),
new OpenLayers.Size(491,443), {
isBaseLayer: false
}
);
That being said, it is to be noted that OpenLayers works with at least
one base layer. If you don't want really need one you can create a
fake one using:
var fake = new OpenLayers.Layer('fake', {displayInLayerSwitcher: false});
map.addLayer(fake);
Furthermore a need a flag to set transparency of some png's.
It seems to me that either your png images are transparent or they
aren't. OpenLayers can't help you with that.
Hope this helps,
--
Eric
_______________________________________________
Users mailing list
[email protected]
http://openlayers.org/mailman/listinfo/users
--
=====================================
Geodan IT b.v.
Buitenhaven 27-A
5211 TP 's-Hertogenbosch (NL)
-------------------------------------
Tel: +31 (0)73 - 692 5151
Fax: +31 (0)73 - 692 5150
Mobiel:
-------------------------------------
Postadres / mailing address
President Kennedylaan 1
1079 MB Amsterdam (NL)
-------------------------------------
E-mail: [email protected]
Website: www.geodan.nl
Disclaimer: www.geodan.nl/disclaimer
-------------------------------------
|