Hi all

I'm trying to start a map using the following function. I want to open using
some  prescribed bounds that are in long, lat (ESPG:4326)  but i'm using
google maps for the baselayer so the projection is EPSG:900913. I thought
the following code would work ok but it just loads a blank map.

Regards

Matt


function init(){
  // Map is in mercator this time, so over-ride the default
  // options that assume lat/lon.
  var options = {
       projection: new OpenLayers.Projection("EPSG:900913"),

      displayProjection: new OpenLayers.Projection("EPSG:4326"),

      units: "m",

      numZoomLevels: 20,

      maxResolution: 156543.0339,

      };

var extent = new OpenLayers.Bounds(-7.423, 50.102,
                    -0.383, 60.988).transform(
    new OpenLayers.Projection("EPSG:4326),
    new OpenLayers.Projection("EPSG:900913)

);

  // Create the map object
  map = new OpenLayers.Map('map', options);

  // create Google Maps layer
  var gmap = new OpenLayers.Layer.Google(
      "Google Streets", // the default
      {'sphericalMercator': true, numZoomLevels: 20}
  );

  // create Google Satellite layer
  var gsat = new OpenLayers.Layer.Google(
      "Google Satellite",
      {type: G_SATELLITE_MAP, 'sphericalMercator': true, numZoomLevels: 20}
  );

  // create WMS Atrina layer
  var wmslayer = new OpenLayers.Layer.WMS(
           "Atrina",
           "http://localhost:8080/geoserver/wms";,
           {'layers': 'DASSH:Atrina', 'format':'image/png',
'transparent':'true'},
           {'opacity': 1.0, 'isBaseLayer': false, 'visibility': true}
      );

  map.addLayers([gmap, gsat, wmslayer]);
  map.addControl(new OpenLayers.Control.LayerSwitcher());
  // Coordinate display at bottom of map
  map.addControl(new OpenLayers.Control.MousePosition());
  map.setCenter(extent, 5);

}
_______________________________________________
Users mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/openlayers-users

Reply via email to