I'm trying to use the WMS service documented here in a leaflet map. The documentation shows an example for openlayers:
var wms = new OpenLayers.Layer.WMS(
"Population Density",
"http://sedac.ciesin.columbia.edu/geoserver/gwc/service/wms",
{layers: 'gpw-v3:gpw-v3-population-density_2000'}
);
but I want to use this with leaflet. My own WMS hosted layers work fine with the following syntax:
var wmsRivers = L.tileLayer.wms("http://zzz.zzz.zzz.zz:8080/geoserver/opengeo/wms", {
layers: 'opengeo:rivers',
format: 'image/png',
transparent: true,
version: '1.1.0',
attribution: ""
}).addTo(map);
The following does not:
var wmsFootprint = new L.tileLayer.wms("http://sedac.ciesin.columbia.edu/geoserver/gwc/service/wms", {
layers: 'gpw-v3:gpw-v3-population-density_2000',
format: 'image/png',
version: '1.1.0',
transparent: true,
attribution: ""
}).addTo(map);
After several minutes waiting for sedac.ciesen.colombia.edu, I get a 400 Failed to load resource: the server responded with a status of 400 (Bad Request)
Is there a way to ping the server to know it's functioning? What about version, I assume this refers to geoserver; how do I know what version they are running? Any other parameters I may be missing?
Best Answer
When exploring a new WMS you should always do a getcapablities request to start with - this will give you all sorts of useful information (including if the server is working). So first we try
http://sedac.ciesin.columbia.edu/geoserver/gwc/service/wms?request=getcapabilities
which responds with an xml document - so the server is up, opening the file it starts with
so you should probably ask for version 1.1.1
searching for the layer name gives me:
so you can only request maps in epsg:4326 or epsg:900913 - you haven't shown enough code for me to see what projection you are using.
Finally look in firebug (or other debugger) to see what the url being requested is and try opening it in your browser - may be there is an error message being returned?