[OpenLayers-Users] problem with OpenLayers spatial.INTERSECTS filter

Sally Buechel swbuechel at comcast.net
Wed Sep 11 20:52:27 PDT 2013


Trying to use a hand-drawn polygon delimiter for spatial WFS query via
OpenLayers to mapserver (then postgis). 

I can get the WKT of the drawn polygon and can substitute the dynamic
values, but am having trouble getting 

the spatial query properly formatted I guess.

 

Filter defined in OpenLayers:

 

myfilter = new OpenLayers.Filter.Logical({

            type: OpenLayers.Filter.Logical.AND,

            filters: [ new OpenLayers.Filter.Spatial({

               type: OpenLayers.Filter.Spatial.INTERSECTS,

               value: curr_wkt

               }),

               new OpenLayers.Filter.Comparison({

                  type: OpenLayers.Filter.Comparison.EQUAL_TO,

                  property:  "roll",

                  value: roll

                })

              ]

         });

 

What "myfilter" looks like after created:

(INTERSECTS(footprint, '(POLYGON((-161.6625 71.073751831055,-167.625
69.498751831055,-168.3 65.673751831055,

-166.275 61.848751831055,-157.6125 64.773751831055,-161.6625
71.073751831055)))')) AND (roll = '4')

 

But in the POST output from Firebug when run, the filter gets converted to
an undefined

Box (or in this case, Envelope if using 1.1.0  I tried both 1.0.0 and
1.1.0):

 

POST result -

 

<wfs:Query typeName="feature:mytable" srsName="EPSG:4326">

<ogc:Filter xmlns:ogc="http://www.opengis.net/ogc">

<ogc:And>

<ogc:Intersects>

<ogc:PropertyName>footprint</ogc:PropertyName>

<gml:Envelope xmlns:gml="http://www.opengis.net/gml" srsName="EPSG:4326">

<gml:lowerCorner>undefined undefined</gml:lowerCorner>

<gml:upperCorner>undefined undefined</gml:upperCorner>

</gml:Envelope>

</ogc:Intersects>

<ogc:PropertyIsEqualTo matchCase="true">

<ogc:PropertyName>roll</ogc:PropertyName>

<ogc:Literal>4</ogc:Literal>

</ogc:PropertyIsEqualTo>

</ogc:And>

</ogc:Filter>

</wfs:Query>

 

Is the WKT the wrong input format to use? Why does it convert my polygon to
Box (Envelope), and poorly at that?

 

Thank-you for any help!  I'm stumped.

 

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/openlayers-users/attachments/20130911/4a1581a5/attachment.html>


More information about the Users mailing list