I've looked around the net and I've looked for examples, but I just can't seem to find a way to make a WFS layer be the baselayer. I set up the projection the right way and I set isBaseLayer: true . When I open my map it's empty. Only the controls are present and there is a white map.
Could it be that it's simply not supported (but since there is the option to set it as isBaseLayer: true, this wouldn't make no sense) ?!
Thanks for your help.
P.S.: The only thing I've changed can be seen inside of the code.
EDIT:
Here is my code:
function myInit2(){
var geographic = new OpenLayers.Projection("EPSG:4326");
var mercator = new OpenLayers.Projection("EPSG:900913");
var world = new OpenLayers.Bounds(-180, -89, 180, 89).transform(
geographic, mercator
);
var deutschl = new OpenLayers.Bounds(5, 50, 15, 56).transform(
geographic, mercator
);
var dortmund= new OpenLayers.LonLat(7.46, 51.51).transform(
geographic, mercator
);
map = new OpenLayers.Map("map_location", {
maxExtent: new OpenLayers.Bounds(5, 50, 15, 56).transform(
geographic, mercator)
});
//var osm = new OpenLayers.Layer.OSM();
// this was the old baselayer
var baseL = new OpenLayers.Layer.WFS(
"Bundesländer",
"http://vs136213:8080/geoserver/wfs",
{typename: "BitmarckKarten:land_shp"},
{isBaseLayer: true, extractAttributes: true, styleMap: myStyleMapL}
);
//initialize the base layer here
//map.addLayers([osm]);
//old add of baselayer
map.addLayers([baseL]);
map.addControl(new OpenLayers.Control.LayerSwitcher());
// map.addControl(new OpenLayers.Control.Permalink());
map.addControl(new OpenLayers.Control.MousePosition());
map.addControl(new OpenLayers.Control.PanZoomBar());
map.addControl(new OpenLayers.Control.Navigation());
map.setCenter(dortmund, 6);
getDivInfos();
};
Best Answer
I've just made a quick test http://ian01.geog.psu.edu/geoserver/www/wfs/wfs-baselayer.html and you can use a WFS as a baselayer. I suspect your problem is probably a Same-Origin problem - check with FireBug that the response to the request is there (if it works when you open it in a new tab but fails in the map then you need a proxy).