Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

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();

}; 
share|improve this question
1  
can you post a link to your code? –  iant Mar 15 '11 at 14:10
2  
I guess your problem is related to the use of openlayers? Is your layer displaying when you remove isBaseLayer option? –  simo Mar 15 '11 at 14:12
    
If i remove it or set it to false, all i get is the same empty map, but now im unable to see the mouse position on the map. –  1amtoo1337 Mar 15 '11 at 14:50
add comment

2 Answers

up vote 4 down vote accepted

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).

share|improve this answer
    
I think i found the solution to the problem by finding this example which didnt cross my eye until today openlayers.org/dev/examples/all-overlays.html –  1amtoo1337 Mar 16 '11 at 12:30
    
Actually that is the opposite of the question you asked. As my solution shows there is no problem adding a WFS as a baselayer. –  iant Mar 16 '11 at 13:54
add comment

I can't see the definition of myStyleMapL style. Are you sure the issue comes form isBaseLayer.

Could you try that :

var baseL = new OpenLayers.Layer.WFS(
            "Bundesländer",
            "http://vs136213:8080/geoserver/wfs",
            {typename: "BitmarckKarten:land_shp"},
            {isBaseLayer: true}
    ); 

By the way, you should have a look on firebug to see if any error message is displayed.

share|improve this answer
    
You cant see it because the code is much more big, so if i had to post the whole code it would basicly blast stackexchange away :D . its defined and there are no firebug errors. i should have mentioned that, sorry for that. Edit: your edit doesnt change it. but it makes the mouseposition work, opposed to isBaseLayer: false. –  1amtoo1337 Mar 15 '11 at 14:55
    
And have you tested if it's not a projection error? You should give a try to zoomToMaxExtent() to see if your layer is not lost somewhere. Or directly to the that specific layer extent –  simo Mar 15 '11 at 15:14
    
@shitake83 You could post the code at gist.github.com and them give us a link to it. It's rather hard to solve something without seeing the whole picture. –  R.K. Feb 11 '12 at 4:47
add comment

Your Answer

 
discard

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.