[OpenLayers-Users] Problem with a WFS request

Bart van den Eijnden (OSGIS) bartvde at osgis.nl
Sun Aug 23 05:58:28 EDT 2009


Hi Eric,

you're right, this does seem a bit strange, so the following config 
would work because of the auto-detection setting the namespace and 
guessing featureNS:

var p = new OpenLayers.Protocol.WFS({
    ...
    featureType: "aster_gdem",
    featurePrefix: "ms"
});

I think we would need to raise a bug for this, because specifying 
featureNS together with featurePrefix should work as well IMHO.

Best regards,
Bart

Eric Lemoine wrote:
> 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
>>
>>     
>
>   


-- 
Bart van den Eijnden
OSGIS, Open Source GIS
bartvde at osgis.nl
http://www.osgis.nl




More information about the Users mailing list