problem with OpenLayers spatial.INTERSECTS filter

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

problem with OpenLayers spatial.INTERSECTS filter

Sally Buechel

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.

 

 


_______________________________________________
Users mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/openlayers-users
Reply | Threaded
Open this post in threaded view
|

Re: problem with OpenLayers spatial.INTERSECTS filter

Bart van den Eijnden
<base href="x-msg://3817/">Your value of the spatial filter should not be a WKT, but just the polygon geometry itself.

Best regards,
Bart

-- 
Bart van den Eijnden
OpenGeo - http://opengeo.org
Expert service straight from the developers.



On Sep 12, 2013, at 5:52 AM, Sally Buechel <[hidden email]> wrote:

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.
 
 
_______________________________________________
Users mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/openlayers-users


_______________________________________________
Users mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/openlayers-users