Hi,

your findings are correct. The feature prefix is lost because it will only be 
used if a featureNS is specified, which Protocol.WFS.fromWMSLayer does not 
know. this happens in Format.WFST.v1_1_0, lines 124-130:

var node = this.createElementNSPlus("wfs:Query", {
    attributes: {
        typeName: (options.featureNS ? options.featurePrefix + ":" : "") +
            options.featureType,
        srsName: options.srsName
    }
});

This can be considered a bug in OpenLayers. But you can always create your 
protocol without using Protocol.WFS.fromWMSLayer and specify a featureNS. Then 
you don't need a featurePrefix at all.

Regards,
Andreas.

On Jan 25, 2011, at 16:30 , Charles Galpin wrote:

> Does anyone have any idea what the problem is here? 
> OpenLayers.Protocol.WFS.fromWMSLayer is supposed to pickup the properties 
> from the WMS layer but is losing the feature prefix in the typeName sent. 
> 
> <wfs:query typeName="links" >
> 
> When It should be
> 
> <wfs:query typeName="myNS:links" >
> 
> I have stepped through the constructor and the protocol seems to have the 
> feature prefix ten. I have tried setting the featurePrefix and typeName a 
> variety of ways but nothing seems to take.
> 
> Can anyone at least confirm this works for them when using a non-default 
> namespace on the server?
> 
> thanks,
> charles
> 
> 
> On Jan 24, 2011, at 11:15 AM, Charles Galpin wrote:
> 
>> I have a GetFeature control that is constructed with a protocol created from 
>> an existing WMS layer which is working fine. However where getfeature 
>> requests are being sent the feature namespace is not sent, i.e. 'links' is 
>> sent instead of 'myNS:links'. This has been working I think because of my 
>> default namespace in geoserver, but I now want to use another namespace that 
>> is not the default, and I can see the default namespace in the response 
>> (which is not correct). I have tried setting featureNS parameters to both 
>> these constructors but it still doesn't get passed through.
>> 
>> Does anyone know how to do this?
>> 
>> var links = new OpenLayers.Layer.WMS(
>>               "Links", "/geoserver/wms",
>>               {
>>                   layers: 'myNS:links',
>>                   styles: '',
>>                   srs: 'EPSG:4326',
>>                   format: 'image/png',
>>                   tiled: 'true',
>>                   tilesOrigin : map.maxExtent.left + ',' + 
>> map.maxExtent.bottom,
>>                   transparent: true
>>               },
>>               {
>>                   visibility: false,
>>                   buffer: 0,
>>                   'opacity': 0.75, 
>>                   'isBaseLayer': false, 
>>                   'wrapDateLine': true
>>               } 
>>           );
>> 
>> var getFeatureControl = new OpenLayers.Control.GetFeature({
>>              // The request is sending coordinates in EPSG:900913
>>              protocol: OpenLayers.Protocol.WFS.fromWMSLayer(links, {srsName: 
>> "EPSG:900913"}),
>>               box: true,
>>               hover: true,
>>               multipleKey: "shiftKey",
>>               toggleKey: "ctrlKey"
>>           });
>> 
>> thanks,
>> charles
> 
> _______________________________________________
> Users mailing list
> [email protected]
> http://lists.osgeo.org/mailman/listinfo/openlayers-users



-- 
Andreas Hocevar
OpenGeo - http://opengeo.org/
Expert service straight from the developers.

_______________________________________________
Users mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/openlayers-users

Reply via email to