Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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="">
        <gml:Envelope xmlns:gml="" srsName="EPSG:900913">
            <gml:lowerCorner>-161672.38316912 6970834.4247659</gml:lowerCorner>
            <gml:upperCorner>-161290.19802775 6971216.6099073</gml:upperCorner>

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="">
        <gml:Polygon xmlns:gml="" srsName="EPSG:900913">
                    <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

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


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

Browse other questions tagged or ask your own question.