Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I am trying to get a selection of points in my dataset, by selecting a polygon and returning all points inside it. I am using an OGC fiter, and currently I am testing it directly in the OpenLayers view of the data on geoserver.

When I use the construct:

<ogc:Filter xmlns:ogc="http://www.opengis.net/ogc">
    <ogc:Intersects>
        <ogc:PropertyName>Geom</ogc:PropertyName>
        <gml:Envelope xmlns:gml="http://www.opengis.net/gml" srsName="EPSG:900913">
            <gml:lowerCorner>-161672.38316912 6970834.4247659</gml:lowerCorner>
            <gml:upperCorner>-161290.19802775 6971216.6099073</gml:upperCorner>
        </gml:Envelope>
    </ogc:Intersects>
</ogc:Filter>

only the points inside the box are returned, as expected. However, I want to use a polygon, so as a test I constructed the same box with the gml:

<ogc:Filter xmlns:ogc="http://www.opengis.net/ogc">
    <ogc:Intersects>
        <ogc:PropertyName>Geom</ogc:PropertyName>
        <gml:Polygon xmlns:gml="http://www.opengis.net/gml" srsName="EPSG:900913">
            <gml:outerBoundaryIs>
                <gml:LinearRing>
                    <gml:coordinates decimal="." cs="," ts=" ">
                        -161672.38316912,6970834.4247659 -161290.19802775,6970834.4247659 -161290.19802775,6971216.6099073 -161672.38316912,,6971216.6099073 -161672.38316912,6970834.4247659
                    </gml:coordinates>
                </gml:LinearRing>
            </gml:outerBoundaryIs>
        </gml:Polygon>
    </ogc:Intersects>
</ogc:Filter>

When I use this filter, however, no points are returned (neither points inside the polygon nor outside). The eventual polygon I want to use is more complex than this but I thought I'd start with a simple one. Does anyone know why this is not returning any points?

share|improve this question
    
how are you using this filter (from your tags WMS?)? on a get request, post? –  iant Jun 28 '13 at 7:24
    
Geoserver admin -> layer preview -> openLayers -> paste it into the filters box. In the final site we're using openLayers to send it as a post request (it's too long for get) but I need to get the thing working first. –  James Jun 28 '13 at 14:01
    
It might be getting truncated in the preview box. Can you check what is sent? –  iant Jun 29 '13 at 13:43
    
Just checked using firebug, the entire filter is getting sent by the search box... –  James Jul 1 '13 at 9:53
    
Weirdly, it works when using a CQL filter to do the same thing, so we're switching over to that for now. Would still like to know why this fails... –  James Jul 1 '13 at 13:26

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.