[OpenLayers-Users] Is there any way to avoid loading spatial data when using OpenLayers.Control.GetFeature?

Eric Lemoine eric.lemoine at camptocamp.com
Wed Aug 12 01:47:48 EDT 2009


On Tue, Aug 11, 2009 at 6:01 PM, Michael
O'Cleirigh<michael.ocleirigh at rivulet.ca> wrote:
> Hello,
>
> I have a WMS layer containing various polygons that are used to
> subdivide a map.  The boundaries run along the street center line and
> rivers, etc. It is a transparent layer sitting on top of google maps.
>
> When the user clicks on the map I want to use WFS to get the zone number
> of the polygon that contains the clicked point.
>
> But the problem is that I don't need the geographic detail of the zone.
> I add the zone number into the WMS layer logical filter which toggles
> the polygon visibility.
>
> Because the performance is slow I want to avoid fetching the spatial
> data as part of the WFS request.
>
> In the browser I can add a 'propertyName' parameter and this will
> constrain the attributes returned to only include the zone number (i.e.
> to exclude the spatial column).  But I can't figure out how to do this
> to a OpenLayers.Protocol.WFS object.
>
> Does anyone have an example of how I can do this? or do I need to craft
> a custom OpenLayers.Request call?
>
> Thanks for your help,
>
> Mike
>
> References:
>
> The control is registered as:
>
> control = new OpenLayers.Control.GetFeature( {
>        protocol : OpenLayers.Protocol.WFS.fromWMSLayer(wmsLayer),

You can try

    OpenLayers.Protocol.WFS.fromWMSLayer(wmsLayer, {
        formatOptions: {
            propertyNames: ["name1", "name2"]
        }
    })

I haven't tested it myself but that may work.


Cheers,

-- 
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