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

christopher.schmidt at nokia.com christopher.schmidt at nokia.com
Mon Sep 19 12:30:38 EDT 2011


On Sep 19, 2011, at 8:53 AM, ext Jürgen Dankoweit wrote:

> -----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.

Set maxExtent: new OpenLayers.Bounds(-20037508.34,-20037508.34,20037508.34,20037508.34)

on your map.

-- Chris

> 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-----
> _______________________________________________
> Users mailing list
> Users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/openlayers-users



More information about the Users mailing list