How to query WFS with an irregular polygon?

3 messages Options
Embed this post
Permalink
Milan Antonovic

How to query WFS with an irregular polygon?

Reply Threaded More More options
Print post
Permalink
(This post was updated on )
Hi all,
I am new to Mapbuilder...
Does anyone knows how to make a widget like the "WfsGetFeature" that instead of quering the map with a point or a rectangle it queries the map with an (irregular) polygon?

Thanks..

rgds

Milan
Gilles Bassière

Re: How to query WFS with an irregular polygon?

Reply Threaded More More options
Print post
Permalink
Hi milan

I went into the same problem. AFAIK, there's no solution within the
scope of OGC specification. I had to develop my own webservice, it was
pretty easy in my case since I work with a PostGis backend.

On the client side, I just had to tweak the :

1) Set an appropriate mouse handler in the draw() method of the
underlying OpenLayers control. Try the following for example if you need
a circular selection tool:
                  this.handler = new OpenLayers.Handler.RegularPolygon(
                     this,
                     {done: this.selectBox},
                     {keyMask: this.keyMask, sides: 40}
                  );
The OpenLayers.Handler.Polygon handler should enable any polygon to be
drawn.

2) Adapt the selectBox method (of the same Control object) to your
webservice specification. I've been able to send my geometry as WKT
thanks to the OpenLayers.Format.WKT objects.

Hope it helps
Gilles

milan.antonovic wrote:

> Hi all,
> I am new to Mapbuilder...
> Does anyone knows how to make a widget like the "WfsGetFeature" that instead
> of quering the map with a point or a rectangle it queries the map with an
> (irregular) polygon?
>
> Thanks..
>
> rgds
>
> Milan
>  
--
Gilles Bassiere
MAKINA CORPUS
30 rue des Jeuneurs
FR-75002 PARIS
+33 (0) 1 44 82 00 80
http://www.makina-corpus.com


[gilles_bassiere.vcf]

begin:vcard
fn;quoted-printable:Gilles Bassi=C3=A8re
n;quoted-printable:Bassi=C3=A8re;Gilles
org:Makina Corpus;GIS
adr;quoted-printable:;;30 rue des Je=C3=BBneurs;Paris;;FR-75011;France
email;internet:[hidden email]
title:Web GIS developper
tel;work:+33 (0) 1 44 82 00 80
x-mozilla-html:FALSE
url:http://www.makina-corpus.com
version:2.1
end:vcard



-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
Mapbuilder-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/mapbuilder-users
Milan Antonovic

Re: How to query WFS with an irregular polygon?

Reply Threaded More More options
Print post
Permalink
Hi Gilles, Thanks for your help.
I already did something similar but it looks like more like a workaround.
My need is to make a getFeature wfs-request giving a polygon (or any other geom) as a filter and then grouping the result in a sum.

The table:

inhabitants
-----------------------
the_geom (point)
number_of_inhabitants (number of person living in the point coordinate)

The request could be something like that:

<wfs:GetFeature xmlns:wfs="http://www.opengis.net/wfs" xmlns:ogc="http://www.opengis.net/ogc" xmlns:gml="http://www.opengis.net/gml" xmlns:my="http://www.myns.ch" outputFormat="GML2" version="1.1.0" service="WFS">
  <wfs:Query typeName="my:inhabitants">
   <wfs:Function name="Collection_Sum">
     <wfs:PropertyName>number_of_inhabitants</wfs:PropertyName>
   </wfs:Function>  
   <Filter>
      <Intersects>
        <PropertyName>the_geom</PropertyName>
        <gml:Box srsName="21781">
          <gml:coordinates>701633.0,141786.0  709477.0,151000.0</gml:coordinates>
        </gml:Box>
      </Intersects>
    </Filter>
  </wfs:Query>
</wfs:GetFeature>

But it doesn't work..

Where am I wrong?

rgds

   Milan

Gilles Bassière-2 wrote:
Hi milan

I went into the same problem. AFAIK, there's no solution within the
scope of OGC specification. I had to develop my own webservice, it was
pretty easy in my case since I work with a PostGis backend.

On the client side, I just had to tweak the :

1) Set an appropriate mouse handler in the draw() method of the
underlying OpenLayers control. Try the following for example if you need
a circular selection tool:
                  this.handler = new OpenLayers.Handler.RegularPolygon(
                     this,
                     {done: this.selectBox},
                     {keyMask: this.keyMask, sides: 40}
                  );
The OpenLayers.Handler.Polygon handler should enable any polygon to be
drawn.

2) Adapt the selectBox method (of the same Control object) to your
webservice specification. I've been able to send my geometry as WKT
thanks to the OpenLayers.Format.WKT objects.

Hope it helps
Gilles

milan.antonovic wrote:
> Hi all,
> I am new to Mapbuilder...
> Does anyone knows how to make a widget like the "WfsGetFeature" that instead
> of quering the map with a point or a rectangle it queries the map with an
> (irregular) polygon?
>
> Thanks..
>
> rgds
>
> Milan
>  

--
Gilles Bassiere
MAKINA CORPUS
30 rue des Jeuneurs
FR-75002 PARIS
+33 (0) 1 44 82 00 80
http://www.makina-corpus.com


begin:vcard
fn;quoted-printable:Gilles Bassi=C3=A8re
n;quoted-printable:Bassi=C3=A8re;Gilles
org:Makina Corpus;GIS
adr;quoted-printable:;;30 rue des Je=C3=BBneurs;Paris;;FR-75011;France
email;internet:gilles.bassiere@makina-corpus.com
title:Web GIS developper
tel;work:+33 (0) 1 44 82 00 80
x-mozilla-html:FALSE
url:http://www.makina-corpus.com
version:2.1
end:vcard


-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
Mapbuilder-users mailing list
Mapbuilder-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mapbuilder-users