[OpenLayers-Users] WFS server response OK, but not appearing

Eric Lemoine eric.lemoine at camptocamp.com
Sun Aug 23 05:14:43 EDT 2009


On Friday, July 24, 2009, Maxime Phaneuf <maxime.phaneuf at usherbrooke.ca> wrote:
>
> Hi list
>
> I  am working on WFS-T currently, and I based my project on
> http://openlayers.org/dev/examples/wfs-protocol-transactions.html.
>
> My problem is that the WFS loads correctly. I can see the GML response in
> firebug. But, the layer is not appearing on the map at all.
>
> Here is the .html:
>
>         function init() {
>             OpenLayers.ProxyHost = "../cgi-bin/proxy.cgi?url=";
>             map = new OpenLayers.Map('map', {
>                 projection: new OpenLayers.Projection("EPSG:27582"),
>                                 maxExtent: new OpenLayers.Bounds(5638.000000,1620431.000000,
> 1197822.000000,2677441.000000),
>                                 maxResolution: (2677441 - 1620431)/512,
>                 units: "m",
>                 controls: [
>                     new OpenLayers.Control.PanZoom()
>                 ]
>             });
>
>                         var wms = new OpenLayers.Layer.WMS("France",
>                         "http://www.geosignal.org/cgi-bin/wmsmap?", {layers: 'regions',
> srs:'EPSG:27582', format:'image/png'}, {buffer: 0});
>
>             var saveStrategy = new OpenLayers.Strategy.Save();
>
>             wfs = new OpenLayers.Layer.Vector("France", {
>                 strategies: [new OpenLayers.Strategy.BBOX(), saveStrategy],
>                 protocol: new OpenLayers.Protocol.WFS({
>                                         version:       "1.0.0",
>                                         url:           "http://**.***.**.***/cgi-bin/tinyows",
>                                         featureType:   "france_dept",
>                                         srsName:       "EPSG:27582",
>                                         featureNS:     "**.***.**.***",
>                                         //featurePrefix: "tows",
>                                         geometryName:  "the_geom",
>                                         schema:
> "http://**.***.**.***/cgi-bin/tinyows?service=WFS&version=1.0.0&request=DescribeFeatureType&TypeName=tows:france_dept"
>                 })
>             });
>
>             var panel = new OpenLayers.Control.Panel(
>                 {'displayClass': 'customEditingToolbar'}
>             );
>
>             var navigate = new OpenLayers.Control.Navigation({
>                 title: "Pan Map",
>             });
>
>             var draw = new OpenLayers.Control.DrawFeature(
>                 wfs, OpenLayers.Handler.Polygon,
>                 {
>                     title: "Draw Feature",
>                     displayClass: "olControlDrawFeaturePolygon",
>                     handlerOptions: {multi: true}
>                 }
>             );
>
>             var edit = new OpenLayers.Control.ModifyFeature(wfs, {
>                 title: "Modify Feature",
>                 displayClass: "olControlModifyFeature",
>             });
>
>             var del = new DeleteFeature(wfs, {title: "Delete Feature"});
>
>             var save = new OpenLayers.Control.Button({
>                 title: "Save Changes",
>                 trigger: function() {
>                     if(edit.feature) {
>                         edit.selectControl.unselectAll();
>                     }
>                     saveStrategy.save();
>                 },
>                 displayClass: "olControlSaveFeatures"
>             });
>
>             panel.addControls([navigate, save, del, edit, draw]);
>             panel.defaultControl = navigate;
>                         map.addControl(new OpenLayers.Control.LayerSwitcher());
>             map.addControl(panel);
>                         map.addLayers([wms, wfs]);
>                         //map.setCenter(new OpenLayers.LonLat(-59457,1374886),1);
>             map.zoomToMaxExtent();
>
>         }
>
> The WFS server is TinyOWS. I don't think this is the problem beacuase when I
> do a getfeature request in firefox, I get a valid GML response.
>
> Do you see what I'm doing wrong here because I can't? hehe
>
> Thank you and have a nice weekend.
> Maxime Phaneuf


Hi. Look up the feature namespace URI from the GML response and try
setting this it in the format instance.

var p = new OpenLayers.Protocol.WFS({
    url: "yourURL",
    featureType: "yourType",
    featurePrefix: null,
    srsName: "EPSG:xxxxx"
});
p.format.setNamespace("feature", "http://your.namespace.uri");

I'm not sure it'll help but this may be worth trying.

Cheers,

PS: the WFST format constructor does not do
this.setNamespace("feature", this.featureNS) when it is given a
featureNS. I don't understand why it doesn't. Does anyone know?




> --
> View this message in context: http://n2.nabble.com/WFS-server-response-OK%2C-but-not-appearing-tp3316670p3316670.html
> Sent from the OpenLayers Users mailing list archive at Nabble.com.
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users
>

-- 
Eric Lemoine

Camptocamp France SAS
Savoie Technolac, BP 352
73377 Le Bourget du Lac, Cedex

Tel : 00 33 4 79 44 44 96
Mail : eric.lemoine at camptocamp.com
http://www.camptocamp.com



More information about the Users mailing list