[OpenLayers-Users] problem with OpenLayers spatial.INTERSECTS filter
Bart van den Eijnden
bartvde at opengeo.org
Thu Sep 12 00:16:22 PDT 2013
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 <swbuechel at comcast.net> 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
> Users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/openlayers-users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/openlayers-users/attachments/20130912/09df2728/attachment-0001.html>
More information about the Users
mailing list