[OpenLayers-Users] displaying attribute content in wfs
Phil Scadden
p.scadden at gns.cri.nz
Wed Aug 1 14:16:12 PDT 2012
>
> In my map i have a wfs layer that i want display content of one
> attribute (postgis table) by feature click.
> Can you help me the better choice to that?
An alternative approach is using WFSProtocol and DrawFeature control.
Create a WFSProtocol object for your wfs layer then:
ptSelCtrl = new OpenLayers.Control.DrawFeature(selectedLayer,
OpenLayers.Handler.Point,{
handlerOptions: {
citeCompliant: true
}
});
ptSelCtrl.events.register("featureadded", this, function (e) {
// could use BBOX instead of DWITHIN for servers that dont support
DWITHIN (eg arcgis 9.3)
var pfilter = new OpenLayers.Filter.Spatial({
type: OpenLayers.Filter.Spatial.DWITHIN,
distance: 100, // you probably want to think about
scale-independent distance method for this
distanceUnits: "meters",
value: e.feature.geometry
});
wfsProtocol.read({
filter: pfilter,
callback: processTheReturn,
scope: strategy
});
Notice: This email and any attachments are confidential. If received in error please destroy and immediately notify us. Do not copy or disclose the contents.
More information about the Users
mailing list