[OpenLayers-Users] Extent with Spherical Mercator

Albin Blaschka albin.blaschka at standortsanalyse.net
Sun May 3 05:55:15 EDT 2009


Dear List,

I have the following code:

var map;
function initMap() {
     var proj = new OpenLayers.Projection("EPSG:4326");

     var options = {
         projection: new OpenLayers.Projection("EPSG:900913"),
         displayProjection: new OpenLayers.Projection("EPSG:4326"),
         units: "m"
     };

     map = new OpenLayers.Map('map', options);

     var gsat = new OpenLayers.Layer.Google(
         "Google Satellite",
         {type: G_SATELLITE_MAP,
	'sphericalMercator': true,
	 numZoomLevels: 22}
     );
     var ghyb = new OpenLayers.Layer.Google(
         "Google Hybrid",
         {type: G_HYBRID_MAP,
	 'sphericalMercator': true}
     );
     map.addLayers([gsat, ghyb]);

     var bounds = new OpenLayers.Bounds(12.5, 47.0, 13.5, 48.0);
     bounds.transform(proj, map.getProjectionObject());

     var point = new OpenLayers.LonLat(13.0, 47.41);
     point.transform(proj, map.getProjectionObject());
     map.setCenter(point);
}
I have the following problem: I do not get my wished extent, but the
whole world two times... Online at http://maps.sabotag.at

What did I wrong? Any tips appreciated...

Thank you in advance,
best wishes from Salzburg, Austria,

Albin

-- 
---------------------------------------------------------------------
| Albin Blaschka, Mag. rer.nat - Salzburg, Austria
| http://www.albinblaschka.info   http://www.thinkanimal.info
| It's hard to live in the mountains, hard, but not hopeless!
---------------------------------------------------------------------




More information about the Users mailing list