[OpenLayers-Users] Overlay and BaseLayer problem

Christian Braun christian.braun at tudor.lu
Wed Jun 25 08:36:10 EDT 2008


Hi List,

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"),
                                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.
Furthermore a need a flag to set transparency of some png's.
I found some flags dealing with 'isBaseLayer' and 'opacity' but I dont
know how to incorporate them correctly.
Hopefully someone of you could post some code that I could use.

A soultion by WMS isnt an option because of the nature of the datasets.

Thanks in advance,
Christian





More information about the Users mailing list