<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html;charset=UTF-8" http-equiv="Content-Type">
  <title></title>
</head>
<body bgcolor="#ffffff" text="#000000">
Hi Tom,<br>
I used the following function on top of OL2.7 just recently with some
Geoserver 1.6 series for point data. It seemed to be acting just fine.<br>
<br>
function fetchID(e) {<br>
var ll = new OpenLayers.Pixel(e.xy.x-10,e.xy.y+10);<br>
var ur = new OpenLayers.Pixel(e.xy.x+10,e.xy.y-10); //* 20x20 px
"window"<br>
var mapll = map.getLonLatFromPixel(ll).transform(new
OpenLayers.Projection("EPSG:900913"), new
OpenLayers.Projection("EPSG:3423"));<br>
var mapur = map.getLonLatFromPixel(ur).transform(new
OpenLayers.Projection("EPSG:900913"), new
OpenLayers.Projection("EPSG:3423"));<br>
var box = new
OpenLayers.Bounds(mapll.lon,mapll.lat,mapur.lon,mapur.lat).toBBOX();<br>
var url = wfslayername.getFullRequestString({<br>
        SERVICE: 'WFS',<br>
        SRSNAME: 'EPSG:900913',<br>
        VERSION: '1.1.0',<br>
        REQUEST: 'GetFeature',<br>
        OUTPUTFORMAT: 'json',<br>
        PROPERTYNAME: 'someNS:the_geom,someNS:ID',<br>
        BBOX: box,<br>
        MAXFEATURES: 1,<br>
        TYPENAME: 'someNS:someTypeName'},<br>
<a class="moz-txt-link-rfc2396E" href="http://domain.name/geoserver/wfs">"http://domain.name/geoserver/wfs"</a><br>
        );<br>
        OpenLayers.loadURL(url,'',this,wfsJSON);<br>
        Event.stop(e);<br>
    };<br>
<br>
- mika -<br>
<br>
Tom B kirjoitti:
<blockquote cite="mid:1245878047804-3151469.post@n2.nabble.com"
 type="cite">
  <pre wrap="">Hi Andreas,

Thanks for the help.  I should've mentioned that the map also has features
that are points, and GetFeatureInfo's tolerance wasn't quite wide enough for
how we are displaying them; that was the big impetus for using GetFeature.  

Additionally, the user will be dynamically adding and removing many
different WMS layers, and the GetFeature request needs to include all of
those layers, so making a custom GetFeature request seemed much easier than
using the GetFeature control.

Yes, I've been using Firebug to double-check these requests; everything
looks good as far as I can tell.  I think I might go ahead and ask the
GeoServer list--in retrospect, it seems like that's closer to where the
problem probably lies.

Thanks again,
Tom


 

Andreas Hocevar-2 wrote:
  </pre>
  <blockquote type="cite">
    <pre wrap="">Hi,

On Wed, Jun 24, 2009 at 7:36 PM, Tom B<a class="moz-txt-link-rfc2396E" href="mailto:seileef@gmail.com">&lt;seileef@gmail.com&gt;</a> wrote:
    </pre>
    <blockquote type="cite">
      <pre wrap="">I'm trying to allows users to click on a WMS overlay and get a popup
showing
a list of features at the location they clicked.  It's a setup similar to
<a class="moz-txt-link-freetext" href="http://trac.openlayers.org/wiki/GetFeatureInfo">http://trac.openlayers.org/wiki/GetFeatureInfo</a>, but instead of a WMS
GetFeatureInfo request, I'm using WFS GetFeature, since it allows me to
make
the area queried a little larger than just the single pixel that the
mouse
clicked.
      </pre>
    </blockquote>
    <pre wrap="">First of all, if you are using GeoServer &gt;= 1.7.4, GetFeatureInfo is
smart enough to select point and line features when clicking anywhere
on the feature, not just the within two pixels of the center.

Also, there is a GetFeature control that you may want to have a look
at: <a class="moz-txt-link-freetext" href="http://www.openlayers.org/dev/examples/getfeature-wfs.html">http://www.openlayers.org/dev/examples/getfeature-wfs.html</a>

    </pre>
    <blockquote type="cite">
      <pre wrap="">When I set the CQL_FILTER param to
BBOX(geometry,'+left+','+bottom+','+right+','+top+')

and, for example, click on a county, the result often includes
neighboring
counties as well, even when left==right and top==bottom.
      </pre>
    </blockquote>
    <pre wrap="">This is weird. Have you looked at the requests in Firebug to make sure
that what gets sent to the server is what you intended to?

    </pre>
    <blockquote type="cite">
      <pre wrap="">As an alternative, I tried using INTERSECT instead of BBOX, like this:
clicked_bounds = new OpenLayers.Bounds(left, bottom, right, top);
geometryString = clicked_bounds.toGeometry().toString();
cql_filter = 'INTERSECT(geometry,'+geometryString+')';

With this, some counties show up fine when you click on them (i.e. no
neighboring counties are listed), but other counties never show up in the
results, regardless of where you click on them.
      </pre>
    </blockquote>
    <pre wrap="">Also weird. If you have more troubles with that, collect some sample
requests (e.g. by copying the request strings from the firebug
console), and ask on the geoserver users list.

Regards,
Andreas.

    </pre>
    <blockquote type="cite">
      <pre wrap="">Does any have any ideas of what might be the issue with either of these?
I'm a bit lost on where to start, and I don't have the access necessary
to
see what queries GeoServer is making against the database.

Best,
Tom
--
View this message in context:
<a class="moz-txt-link-freetext" href="http://n2.nabble.com/Spatial-constraints-of-a-WFS-GetFeature-request-tp3150234p3150234.html">http://n2.nabble.com/Spatial-constraints-of-a-WFS-GetFeature-request-tp3150234p3150234.html</a>
Sent from the OpenLayers Users mailing list archive at Nabble.com.

_______________________________________________
Users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Users@openlayers.org">Users@openlayers.org</a>
<a class="moz-txt-link-freetext" href="http://openlayers.org/mailman/listinfo/users">http://openlayers.org/mailman/listinfo/users</a>

      </pre>
    </blockquote>
    <pre wrap="">

-- 
Andreas Hocevar
OpenGeo - <a class="moz-txt-link-freetext" href="http://opengeo.org/">http://opengeo.org/</a>
Expert service straight from the developers.
_______________________________________________
Users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Users@openlayers.org">Users@openlayers.org</a>
<a class="moz-txt-link-freetext" href="http://openlayers.org/mailman/listinfo/users">http://openlayers.org/mailman/listinfo/users</a>


    </pre>
  </blockquote>
  <pre wrap=""><!---->
  </pre>
</blockquote>
</body>
</html>