[OpenLayers-Users] Problem with a WFS request

Eric Lemoine eric.lemoine at camptocamp.com
Sun Aug 23 05:42:35 EDT 2009


On Friday, August 21, 2009,  <bartvde at osgis.nl> wrote:
> Hi,
>
> is there any prefix used in your GML, again Mapserver defaults to ms:, so
> in that case you need to add:
>
> featureType: "aster_gdem",
> featureNS: "http://mapserver.gis.umn.edu/mapserver",
> featurePrefix: "ms"

Bart, does setting featureNS actually help in anything here? I've
noticed that, as opposed to the GML format, the WFST format does not
call this.setNamespace(). The WFS protocol includes code for
auto-detecting the feature namespace, but with the above protocol
config the auto-detection mechanism will not trigger because featureNS
is set. To workaround the fact that the WFST format doesn't call
setNamespace I've ended up doing:

var p = new OpenLayers.Protocol.WFS({
    ...
    featureType: "myType",
    featurePrefix: null
});
p.format.setNamespace("feature", "http://mapserver.gis.umn.edu/mapserver");

What do you think?

Thanks,





>
> Best regards,
> Bart
>
>> Thank you !
>>
>> Now I think I am close but it's still not working... Vectors are not
>> displayed. Do you see where I am wrong ?
>>
>> var map, wms, test_WFS;
>> function init()
>> {
>>     map = new OpenLayers.Map('map', {
>>         controls: [new OpenLayers.Control.Navigation(),
>>             new OpenLayers.Control.PanZoom(),
>>             new OpenLayers.Control.LayerSwitcher()
>>         ]
>>     });
>>
>>     wms = new OpenLayers.Layer.WMS("OpenLayers WMS",
>>         "http://labs.metacarta.com/wms/vmap0", {
>>             layers:'basic'
>>         }
>>     );
>>
>>     test_WFS = new OpenLayers.Layer.Vector("test WFS", {
>>         strategies: [new OpenLayers.Strategy.BBOX()],
>>         protocol: new OpenLayers.Protocol.WFS({
>>             url:
>> "http://IP-address/cgi-bin/mapserv_5.4.1?map=/var/www/html/WFS_server/test.map",
>>             featureType: "aster_gdem",
>>             featureNS: "http://mapserver.gis.umn.edu/mapserver"
>>         })
>>     });
>>
>>     map.addLayers([wms, test_WFS]);
>>
>>     map.zoomToMaxExtent();
>> }
>>
>> Best regards,
>>
>> Arthur
>>
>> bartvde at osgis.nl a écrit :
>>> Hi Arthur,
>>>
>>> yes the BBOX strategy will take care of that.
>>>
>>> The GML version is determined by the protocol version, WFS 1.0 is tied
>>> to
>>> GML2, whereas WFS 1.1 is tied to GML3. The WFS protocol version defaults
>>> to 1.0, so you will get the Format.GML.v2 parser. So you should not need
>>> to change anything.
>>>
>>> You can retrieve the url for featureNS from a WFS DescribeFeatureType
>>> request (intranet url, for example only):
>>>
>>> http://test.intranet.rijkswaterstaat.nl/services/geoservices/overzichtskaartnl?service=WFS&request=DescribeFeatureType&version=1.0.0
>>>
>>> then check the source and look for targetNamespace, by default this is
>>> http://mapserver.gis.umn.edu/mapserver
>>>
>>> Best regards,
>>> Bart
>>>
>>
>
>
> _______________________________________________
> 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