[OpenLayers-Users] Enabling Panning on OpenLayers.Layer.Google with Satellite-Map

Jürgen Dankoweit Juergen.Dankoweit at T-Online.de
Mon Sep 19 08:53:34 EDT 2011


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Hello to the list.

How to enable panning on OpenLayers.Layer.Google with G_SATELLITE_MAP?
Panning with OpenLayers.Layer.OSM.CycleMap works perfect.
I'm using OpenLayers 2.10.

Thank you very much for the answers

Juergen

Here is my code:
- ----------------
function OSM_Karte_zeigen(tourname, kmlfile) {
 var sphericalMercator = new OpenLayers.Projection('EPSG:900913');
 var epsg4326 = new OpenLayers.Projection('EPSG:4326');

 map = new OpenLayers.Map('mapdiv', {
   projection: sphericalMercator,
   displayProjection: epsg4326,
   units: 'm',
   theme: tourname,
    controls: [
     new OpenLayers.Control.PanZoomBar(),
     new OpenLayers.Control.ScaleLine(),
     new OpenLayers.Control.MouseDefaults()
     ]
  });

 var mapnik = new OpenLayers.Layer.OSM.Mapnik('Standardkarte', {
  });
 map.addLayer(mapnik);

 var gsat = new OpenLayers.Layer.Google(
   'Google Satellitenbild' , {
    type: G_SATELLITE_MAP,
    sphericalMercator: true,
    displayOutsideMaxExtent: true,
    wrapDateLine: true,
    numZoomLevels: 20
  });
 map.addLayer(gsat);

 var natur = new OpenLayers.Layer.GML('Wanderroute', kmlfile, {
   format: OpenLayers.Format.KML,
   formatOptions: {
    extractStyles:true,
    extractAttributes:true
   },
   projection: map.displayProjection
  });
 map.addLayer(natur);

 natur.events.register('loadend', this,
  function(e) {
   map.zoomToExtent(natur.getDataExtent());
  });

 map.zoomToMaxExtent(true);

 map.addControl(new OpenLayers.Control.LayerSwitcher());

 return false;
}
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org/

iF4EAREIAAYFAk53O00ACgkQP1cqIDNixQJfKgEAy5MDSWI+spabjVzNBfPyawsg
+RrSyjVrhSvFfom1ZE0A/RyJK3EDwNTSeBj1M1su8lVGge1xKsPMlk9itUxXjeZh
=hBae
-----END PGP SIGNATURE-----


More information about the Users mailing list