[OpenLayers-Users] Map and overlay are not properly aligned

Willy gruppi at willygroup.org
Thu Jun 3 11:16:12 EDT 2010


Hi,
I'm still trying to use geoscopio layer over google maps with spherical
Mercator.
The best result I've obtained is this:
http://img513.imageshack.us/img513/2284/geoscopiovsgoogle.png

I'm using the following code, someone is able to make this work?


<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <title>OpenLayers Google Layer Example</title>
    <link rel="stylesheet" href="./theme/default/style.
css" type="text/css" />
    <link rel="stylesheet" href="./theme/default/google.css" type="text/css"
/>
    <link rel="stylesheet" href="style.css" type="text/css" />
    <!-- this gmaps key generated for http://openlayers.org/dev/ -->
    <script src='
http://maps.google.com/maps?file=api&amp;v=2&amp;key=ABQIAAAAjpkAC9ePGem0lIq5XcMiuhR_wWLPFku8Ix9i2SXYRVK3e45q1BQUd_beF8dtzKET_EteAjPdGDwqpQ<http://maps.google.com/maps?file=api&v=2&key=ABQIAAAAjpkAC9ePGem0lIq5XcMiuhR_wWLPFku8Ix9i2SXYRVK3e45q1BQUd_beF8dtzKET_EteAjPdGDwqpQ>
'></script>
    <script src="./lib/OpenLayers.js"></script>
    <script type="text/javascript">
        var map;
        function init() {
        var options1 = {
        maxExtent: new OpenLayers.Bounds(-20037508.34, -20037508.34,
                                                 20037508.34, 20037508.34)
        }
            map = new OpenLayers.Map('map', options1);
            map.addControl(new OpenLayers.Control.LayerSwitcher());
            var gmap = new OpenLayers.Layer.Google(
                "Google Streets", // the default
                {numZoomLevels: 20, sphericalMercator:true}
            );

            var wms = new OpenLayers.Layer.WMS("Comuni della Toscana",
                                   "
http://web.rete.toscana.it/sgrwms/com.rt.wms.RTmap?servicename=_rt_wms&version=1.1.1&SRS=EPSG:3003
",
                                   {
                                       displayProjection: new
OpenLayers.Projection("EPSG:4326"),
                                       isBaseLayer: false,
                                       layers: 'idcomuni',
                                       transparent: 'true',
                                       maxExtent: new
OpenLayers.Bounds(-20037508.34, -20037508.34,
                                                     20037508.34,
20037508.34)
                                   });

            map.addLayers([gmap, wms]);

            map.setCenter(new
OpenLayers.LonLat(1330615.7882031,5361598.9112891), 5);

        }

</script>
  </head>
  <body onload="init()">
    <div id="map" class="smallmap"></div>
  </body>
</html>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20100603/538edb34/attachment.html


More information about the Users mailing list