I'm having trouble to add a WFS layer over an OSM map. At first I thought that my data had a problem, and I thus decided to adapt one of the example on the Openlayers website. I have no error returned, but the layer is not appearing... Instead, I see in Firebug that there is a WFS request made to the server, but it is empty
http://demo.opengeo.org/geoserver/wfs
No GET request or arguments whatsoever. I can correctly make the request and I get a xml file as a result (in eg Firefox). I thought it was maybe because of the a proxy and I set one up (the one in Openlayers FAQ), but I get the same thing.
Here is the code I use:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<script src="http://www.openlayers.org/api/2.11/OpenLayers.js"></script>
<script>
var map, layer;
var epsg900913 = new OpenLayers.Projection("EPSG:3857");
var epsg4326 = new OpenLayers.Projection("EPSG:4326");
function init(){
OpenLayers.ProxyHost = "/cgi-bin/proxy.cgi?url=";
var cent=new OpenLayers.LonLat(6.59,46.39).transform(epsg4326,epsg900913);
var osm = new OpenLayers.Layer.OSM("Open Street Map");
var wfs = new OpenLayers.Layer.Vector("States", {
strategies: [new OpenLayers.Strategy.BBOX()],
protocol: new OpenLayers.Protocol.WFS({
version: "1.0.0",
srsName: "EPSG:4326", // this is the default
url: "http://demo.opengeo.org/geoserver/wfs",
featureType: "states",
featureNS: "http://www.openplans.org/topp"
}),
projection: new OpenLayers.Projection("ESPG:4326")
});
map = new OpenLayers.Map("map",{
projection: epsg900913,
layers:[osm,wfs],
center: cent,
zoom: 10
});
map.setCenter(new OpenLayers.LonLat(lon, lat), zoom);
map.addControl( new OpenLayers.Control.LayerSwitcher() );
}
</script>
</head>
<body onload="init()">
<div style="width:500px; height:500px" id="map"></div>
<div id="coordinates"></div>
</body>
</html>