Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am a student enginner in GIS , I want to load my features from geoserver using WFS protocol. I'm using this code but it's not appearing in my browser

    OpenLayers.ProxyHost = "/cgi-bin/proxy.cgi?url=";
var map,wfs;

function init() {
//-11593508, 5509847, -11505759, 5557774
    var extent = new OpenLayers.Bounds(
        474813,  211897, 491713, 227436.5
map = new OpenLayers.Map('map', {
    controls: [
        new OpenLayers.Control.PanZoom(),
        new OpenLayers.Control.Navigation(),
        new OpenLayers.Control.LayerSwitcher({'ascending':false}),
  var wms = new OpenLayers.Layer.WMS(
                    "test_postgres:territoire", "http://mylocalhost:8080/geoserver/test_postgres/wms",
                        LAYERS: 'test_postgres:territoire',
                        STYLES: '',
            format: 'image/svg',
                        isBaseLayer: true,
  var wfsLayer = new OpenLayers.Layer.Vector("WFS", {
        strategies: [new OpenLayers.Strategy.BBOX()],
        styleMap: new OpenLayers.StyleMap({
            strokeWidth: 3,
            strokeColor: "#333333"


share|improve this question
up vote 1 down vote accepted

You have not specified the required parameters for making a WFS request. see this Syntax of WFS request in OpenLayers , the parameters are defined in the protocol.

you will also need to setup a proxy for making WFS request, otherwise you will get cross-domain-allow-origin problem. If you came across this see How to proxy Geoserver through Apache in Windows

WFS is always difficult for starters so don't lose your hope soon.

UPDATE My allowed host list

allowedHosts = ['', '', 
            '', '', 
            '', '',
            '', '',
            '', '',
            '', '', 
            '', '',
            '', '',
            'localhost:8888', 'localhost'

also check whether the proxy is working or not for this goto


in your browser, this should open up the OpenLayers website

share|improve this answer
Thank's byom for your reply to my question ! i added the protocole & all required parameters but it is not work – Yahia El Haddad Apr 11 '13 at 18:06

Your Answer


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.