Skip to main content

GeoServer 101 : how to find the URL of a layer?

I'm a basic/novice user with GeoServer. I've installed it and have loaded a sample shapefile, which I can view using the Layer Preview option.

enter image description here

Now I want to add this shapefile (as a WMS layer) to a simple OpenLayers map using the methodology listed at http://dev.openlayers.org/docs/files/OpenLayers/Layer/WMS-js.html:

var wms = new OpenLayers.Layer.WMS("NASA Global Mosaic",
    "http://wms.jpl.nasa.gov/wms.cgi",
    {
    layers: "modis,global_mosaic",
    transparent: true
    }, {
    opacity: 0.5,
    singleTile: true
}); 

How do I find the URL which corresponds to one of the layers in the screenshot above?

If I use the Preview Layer option and choose JPG as the format, the URL is in the form:

http://localhost:8080/geoserver/cite/wms?service=WMS&version=1.1.0&request=GetMap&layers=cite:States2006 ... rather than the /wms.cgi form listed above.

Thanks for any advice on getting started with GeoServer and OpenLayers.

Stephen Lead
  • 21.2k
  • 18
  • 114
  • 241