[OpenLayers-Users] Include WMS in openlayers map

Arnd Wippermann arnd.wippermann at web.de
Mon Aug 25 12:34:29 PDT 2014


Hi Niccolò,

As you say, you can get the layers to use from the GetCapabilites:

<html>
<head>
  <title>OpenLayers Example</title>
    <script src="http://openlayers.org/api/OpenLayers.js"></script>
</head>
    <body>
      <div style="width:100%; height:100%" id="map"></div>
      <script defer="defer" type="text/javascript">

      //default projection ESPG:4326 with maxExtent:-180,-90,180,90
      var map = new OpenLayers.Map('map');

      var wms_vmap0 = new OpenLayers.Layer.WMS( "OpenLayers WMS",
"http://vmap0.tiles.osgeo.org/wms/vmap0",
          {layers: 'basic'} );

      var wms_piemonte = new OpenLayers.Layer.WMS( "OpenLayers WMS",
"http://geomap.reteunitaria.piemonte.it/ws/siccms/coto-01/wmsg01/wms_sicc01_
dati_di_base?",
          {layers:
'Confine,CartaTecnica,OpereInfrastruttura,PorticiEcc,Sintesi,SintesiSempl,Co
struito,CostruitoSempl,Viario,ViarioCorsi,NPianiEdifici,NCivici,NCiviciLabel
',
           transparent:true
          },
          {isBaseLayer:false
          }
      );

      map.addLayers([wms_vmap0,wms_piemonte]);
      map.addControl(new OpenLayers.Control.LayerSwitcher());

      //map.zoomToMaxExtent();
      map.setCenter(new OpenLayers.LonLat(7.6818466186524,45.066947937012),
12);

    </script>
</body>
</html>

Try this GetCapabilities Viewer to see what the service will provide:
https://geoportal.bayern.de/getcapabilities/CapabilitiesViewer?ows_url=http:
//geomap.reteunitaria.piemonte.it/ws/siccms/coto-01/wmsg01/wms_sicc01_dati_d
i_base&service=WMS&version=1.1.1&format=html&id=Za7DM64WWpNh48FcRf3k7A%3D%3D

Good luck,
Arnd 


-----Ursprüngliche Nachricht-----
Von: openlayers-users-bounces at lists.osgeo.org
[mailto:openlayers-users-bounces at lists.osgeo.org] Im Auftrag von dalsa90
Gesendet: Sonntag, 24. August 2014 12:22
An: openlayers-users at lists.osgeo.org
Betreff: [OpenLayers-Users] Include WMS in openlayers map

Hello everybody, 

I am pretty new with OpenLayers and I have some very easy questions on how
to include a WMS map I am interested in, inside my application.

I'd like to add a map coming from Torino (Italy) website
http://www.comune.torino.it/geoportale/ser_professionali_2.htm#tabs-3

for instance the section "CARTOGRAFIA DI BASE".

I have used this code I have found 

<html>
<head>
  <title>OpenLayers Example</title>
    
    </head>
    <body>
      <div style="width:100%; height:100%" id="map"></div>
      

</body>
</html>

and it works fine, but when I substitute the url of this map with the one I
am interested in, then nothing happens ( for instance the url
"http://geomap.reteunitaria.piemonte.it/ws/siccms/coto-01/wmsg01/wms_sicc01_
dati_di_base?"
)

I can only see an image with empty boxes. I think this is due to the fact I
have to make a request to other data I can see in the same Torino website (
getcapabilities or metadato ) but how is this possible in openlayers? 

Thank you very much for your help!

Kind regards

Niccolò






--
View this message in context:
http://osgeo-org.1560.x6.nabble.com/Include-WMS-in-openlayers-map-tp5158038.
html
Sent from the OpenLayers Users mailing list archive at Nabble.com.
_______________________________________________
Users mailing list
Users at lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/openlayers-users


---
Diese E-Mail ist frei von Viren und Malware, denn der avast! Antivirus Schutz ist aktiv.
http://www.avast.com



More information about the Users mailing list