0
votes

I am new in web mapping, but I have great interest in it. I would like to ask for your help, I have encountered a problem regarding on applying wms layer into my website(html), here is my code: enter image description here

I have an OSM base layer. but when I run this the output will only show a pink tile. enter image description here

I don't know what is wrong or what to do. it would really help me a lot if someone can help me with this. thank you and regards.

oh, here is the code I have edited it, changed the layer into layers, but still the output is the same.

<html>
  <head>
 <title>OpenLayers Example</title>
   <script src="./Javascripts/OpenLayers-2.13.1/OpenLayers.js"></script>
  </head>
 <body>
  <div style="width:100%; height:100%" id="map"></div>
  <script defer="defer" type="text/javascript">
    var map = new OpenLayers.Map('map');
   var osm = new OpenLayers.Layer.OSM();

    var dm_wms = new OpenLayers.Layer.WMS(
        "zambo_data",
        "http://localhost:8080/geoserver/zamboanga/wms",
        {
            layers: 'zamboanga:zam1',
            transparent: 'true',
            format:'img/png'
        },
        {isBaseLayer: false, projection:'ESPG:4326'}
    );
    map.addLayers([osm,dm_wms]);
    map.zoomToMaxExtent();
  </script>

1
Welcome to StackOverflow! If you could post your code it would be helpful -- links to code are a little more difficult to deal with. (You can indent 4 spaces to create a code block.)jkdev
@jkdev thank you for spending time on my question, i have already posted the code above.Kath Dee

1 Answers

2
votes

It should be layers:"zamboanga:zam1", not layer : ....