[OpenLayers-Dev] Connecting to a WFS server

Xurxo Mendez sonxurxo at gmail.com
Mon Feb 7 14:26:29 EST 2011


Hi Andrés,

I didn't test it, I'm talking from memory... Assumming the namespaces are
ok, have you tried specifying the feature prefix? Something like this:


   1. var wfslayer = new OpenLayers.Layer.Vector(
   2.         "Concellos Galicia (WFS)",
   3.         {strategies: [new OpenLayers.Strategy.BBOX()],
   4.          protocol: new OpenLayers.Protocol.WFS({
   5.              url:  "http://localhost:8080/geoserver/wfs",
   6.              featureType: "CONCELLO_25",
   7.              featurePrefix: "Galicia"
   8.              featureNS: "http://www.openplans.org/topp"
   9.          })
   10.         }
   11.     );


Best regards,

Xurxo Méndez Pérez

http://www.sonxurxo.com


2011/2/7 Andrés Maneiro <amaneiro at icarto.es>

> Hello,
>
> I'm trying to connect to a WFS server by means of OpenLayers capabilities.
>
> If it can help, I'm using geoserver 2.1 from the trunk (the one package by
> the opengeo-suite [1]). These tests on the WFS server are OK:
>
> - connect to WFS server by using a desktop client (QGIS) and get a layer
> - get a GML file directly from the browser with this query
>
> http://localhost:8080/geoserver/wfs?request=getfeature&typename=Galicia:CONCELLO_25
>
> So, it seems the WFS is ok and running. Nevertheless, when I trying to
> connect from OL I failed to use it. The map generated shows the OSM
> baselayer + WMS layer overlay. But not the WFS layer. The code I'm using:
>
>  HTML code: http://pastebin.com/S0E1Wu8C
>  Javascript code: http://pastebin.com/nzum0CbJ
>
> I can't figure out why it fails. Any idea?
>
> best,
> amaneiro
>
> [1] http://opengeo.org/technology/suite/whatsnew/
> _______________________________________________
> Dev mailing list
> Dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/openlayers-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-dev/attachments/20110207/2b229d5a/attachment.html


More information about the Dev mailing list