[Gfoss] Openlayers e WMS Emilia Romagna

albertobonati a libero.it albertobonati a libero.it
Mer 26 Set 2012 18:48:50 CEST


Ecco qua.

con il PCN funziona, EPSG:4326 dovrebbe essere supportato da ER...



<html>
<head>
     <title>OSM Local Tiles</title>
     <link rel="stylesheet" href="style.css" type="text/css" />
     <!-- bring in the OpenLayers javascript library
          (here we bring it from the remote site, but you could
          easily serve up this javascript yourself) -->
     <script src="OpenLayers.js"></script>

     <!-- bring in the OpenStreetMap OpenLayers layers.
          Using this hosted file will make sure we are kept up
          to date with any necessary changes -->
     <script src="OpenStreetMap.js"></script>

     <script type="text/javascript">
// Start position for the map (hardcoded here for simplicity)
         var lat=44.32;
         var lon=11.60;
         var zoom=11;

         var map; //complex object of type OpenLayers.Map

         //Initialise the 'map' object
         function init() {

             map = new OpenLayers.Map ("map", {
                 controls:[
                     new OpenLayers.Control.Navigation(),
                     new OpenLayers.Control.PanZoomBar(),
                     new OpenLayers.Control.Permalink(),
                     new OpenLayers.Control.ScaleLine(),
                     new OpenLayers.Control.Permalink('permalink'),
                     new OpenLayers.Control.MousePosition(),
                     new OpenLayers.Control.Attribution()],
                 //maxExtent: new 
OpenLayers.Bounds(-20037508.34,-20037508.34,20037508.34,20037508.34),
                 //maxResolution: 156543.0399,
                 numZoomLevels: 19,
                 //units: 'm',
                 projection: new OpenLayers.Projection("EPSG:4326"),
               displayProjection: new OpenLayers.Projection("EPSG:4326")
             } );

             var igm25 = new OpenLayers.Layer.WMS( "PCN IGM 25K",
"http://wms.pcn.minambiente.it/ogc?map=/ms_ogc/WMS_v1.3/raster/IGM_25000.map", 
{layers: 'CB.IGM25000'} );

             var ER = new OpenLayers.Layer.WMS( "Multiscala ER",
                    " 
http://servizigis.regione.emilia-romagna.it/wms/dbtr2008_ctr5?&REQUEST=GetMap, 
{layers: '2'}");

             map.addLayers([igm25, ER]);

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

             // This is the end of the layer

            if( ! map.getCenter() ){
                 var lonLat = new OpenLayers.LonLat(lon, 
lat).transform(new OpenLayers.Projection("EPSG:4326"), 
map.getProjectionObject());
             map.setCenter (lonLat, zoom);
            }
         }

     </script>
</head>

<!-- body.onload is called once the page is loaded (call the 'init' 
function) -->
<body onload="init();">

     <!-- define a DIV into which the map will appear. Make it take up 
the whole window -->
     <div style="width:100%; height:100%" id="map"></div>

</body>

</html>


Scrittoo son parole grosse...diciamo scopiazzato qua e la....
Ciao

Alberto


-------------- parte successiva --------------
Un allegato HTML è stato rimosso...
URL: <http://lists.gfoss.it/pipermail/gfoss/attachments/20120926/981a0dfc/attachment.html>


Maggiori informazioni sulla lista Gfoss