[OpenLayers-Users] Re: Questions about Filtering WFS

Phil Scadden p.scadden at gns.cri.nz
Thu Dec 8 15:50:36 EST 2011


On 8/12/2011 6:02 p.m., Diego M. wrote:
>
> *Strongly consider using WMS to display and WFS to query instead. *
> is there any example to explane how to do that ?
Add the layer to the map as a WMS layer styled with a SLD. A simple 
query (click on the object) can be done then wmsgetfeature (see OL 
examples). For polygon, within-radius-of-click, text search,
you create a wfsProtocol object, set the appropriate filter (polygon, 
dwithin or a logically query depending on application) and do  a read on 
the protocol, with a call back to process the result.

Look at examples and search mailing list for wfsprotocol.

>
> *You need to convert the distance into native projection (application
> knowledge). *
> also how i can do that ?
>
> I'm really stuck here.
Something like:
pt1 = e.features.geometry; // assuming you are doing this a registered event
pt2 = pt1.clone();
pt2.x += myDistance // in display projection units)
pt1.transform(displayprojection, nativeproject);
pt2.trasnform(displayprojection, nativeproject);
myDistance = Math.abs(pt1.x-pt2.x);

However, you need to know what native projection is. Get that from the 
server.


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