Hi all, I am working from the Image Layer Example: http://openlayers.org/dev/examples/image-layer.html
Goal is to switch to an image layer showing a picture (e.g. of a Church). I managed to switch from the original map to the image layer using map.setBaseLayer(image-layer); Problem is how to calculate OpenLayers.Bounds? Simply replacing new OpenLayers.Bounds(-180, -88.759, 180, 88.759), by new OpenLayers.Bounds(-20037508, -20037508, 20037508, 20037508.34) did not work. (It just blows up a single pixel to cover the whole map-div.) And even when the example states: ..."If you construct it without any resolution related options [Does this mean Bounds???], the layer will be given a single resolution based on the extent/size."... Commenting out the "new OpenLayers.Bounds( ..." line does not work, it just gives an error in both OL 2.7 and 2.8: this.extent.getHeight is not a function http://localhost/js/OpenLayers.js Line 1187 So how to calculate OpenLayers.Bounds to display the image at its original 100% size? Or to fit in the map-div? Thanks, Jan Image Layer Example Code (Cleaned up a bit): <script type="text/javascript"> var map; function init(){ map = new OpenLayers.Map('map'); var options = {numZoomLevels: 3}; var graphic = new OpenLayers.Layer.Image( 'City Lights', 'http://earthtrends.wri.org/images/maps/4_m_citylights_lg.gif', new OpenLayers.Bounds(-180, -88.759, 180, 88.759), new OpenLayers.Size(580, 288), options ); var jpl_wms = new OpenLayers.Layer.WMS( "NASA Global Mosaic", "http://t1.hypercube.telascience.org/cgi-bin/landsat7", {layers: "landsat7"}, options); map.addLayers([graphic, jpl_wms]); map.addControl(new OpenLayers.Control.LayerSwitcher()); map.zoomToMaxExtent(); } </script>
_______________________________________________ Users mailing list [email protected] http://openlayers.org/mailman/listinfo/users
