Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Please help me on how can get my map from Geoserver. I want create my country web but I can nott see it in my browser but I can see in Geoserver. Please help me I am very new openlayers and Geoserver.

  <title>OpenLayers Example</title>
    <script src=""></script>
      <div style="width:100%; height:100%" id="map"></div>
      <script defer="defer" type="text/javascript">
        var map = new OpenLayers.Map('map');
       new OpenLayers.Map("map");
        var wms = new OpenLayers.Layer.WMS( "OpenLayers WMS",
        map.addLayers([wms, dm_wms]);
share|improve this question

Not sure how GeoJSON ended up in the mix of terms in the heading, but check out the "Preview Layers" tab in the GeoServer administration GUI. One of the preview modes is "OpenLayers". This opens up a web page with a pre-configured OpenLayers implementation with the layers that you added to GeoServer.

share|improve this answer

The URL you are using is wrong. Change your WMS object to:

var wms = new OpenLayers.Layer.WMS(
    "OpenLayers WMS",
        layers: "trgm:iller",
        format: "image/png"
        isBaseLayer: false

You can play around with the various properties, the key thing is that the url is just the base GeoServer WMS service and then everything else you put in the first object hash. All the properties in here are appended to the WMS request.

Also, you have the line map.addLayers([wms, dm_wms]); yet you have not defined dm_wms in the code block you provided. Unless you have this defined somewhere else then your code will cause an error and you won't see a map.

share|improve this answer
How can i add dm_wms can u give some example please CHenderson – Rusty Aug 5 '12 at 8:46
Looking at the code you posted it looks like you are using an example from the OpenLayers website. In which case the definition for dm_wms can be found in the example.js file. However, if you simply remove dm_wms from your map.addLayers method then the map will work. If you want background mapping then you could add OpenStreetMap layer and your WMS data will then overlay that. – CHenderson Aug 6 '12 at 12:51

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.