[OpenLayers-Users] WMS GetFeatureInfo - difficult to click exactly on a point

Bill Thoen bthoen at gisnet.com
Thu Jan 29 16:39:25 EST 2009


David,
I just had this problem myself and found that switching my MapServer 
from ver 4.10.0 to 5.2.1 solved the problem. Also, what appears to 
happen is that getFeatureInfo() returns the *nearest* object(s) to where 
you click (even if the layer is invisible.)  And I suspect that you get 
the first FEATURE_COUNT objects  from the layer that has the nearest 
object, then the closest FEATURE_COUNT objects in the layer that was 
second nearest. I'm not sure this is really what it does because the 
evidence at this point is anecdotal, but when I set FEATURE_COUNT to 1 
and click on a polyline in one query layer crossing a polygon in another 
query layer, I get the nearest record from each, with the line record 
listed first only if I click very exactly on the line. Otherwise it 
appears second in the returned data.

- Bill Thoen

Kimball, David (DCR) wrote:
> Hi everyone,
>
> I'm using a WMS GetFeatureInfo to simultaneously query the attributes of
> a line layer and a point layer (from GeoServer).  Unfortunately you have
> to click *exactly* on the center of a point to get it to send you the
> point attributes.
>
> http://maps.massgis.state.ma.us/dcr/trails/DCR_RoadTrail10.html
>
>
> 	map.events.register('click', map, function (e) {
> 		var url =  map.layers[0].getFullRequestString(
> 		{
> 			REQUEST: "GetFeatureInfo",
> 			EXCEPTIONS: "application/vnd.ogc.se_xml",
> 			BBOX: map.getExtent().toBBOX(),
> 			X: e.xy.x,
> 			Y: e.xy.y,
> 			INFO_FORMAT: 'text/html',
> 			QUERY_LAYERS: map.layers[8].params.LAYERS + ","
> + map.layers[9].params.LAYERS,
> 			FEATURE_COUNT: 50,
> 			WIDTH: map.size.w,
> 			HEIGHT: map.size.h
> 		},
> 	
> "http://giswebservices.massgis.state.ma.us/geoserver/wms");
> 		OpenLayers.loadURL(url, '', this, setHTML, setHTML);
> 		OpenLayers.Event.stop(e);
>
>
> I searched a bunch for this and all I could find were suggestions to do
> a WFS getfeature instead of a WMS GetFeatureInfo, or to set some options
> on the server (not an option in this case).  I'd rather use the WMS
> request because I'd rather not rewrite all my parsing Javascript, and
> there might be a performance hit - some of the lines have hundreds of
> vertices, and when I tried a similar approach recently with large
> polygons it was slow because of the large amount of data sent back.
>
> So, is there any (client-side) radius/tolerance option for
> GetFeatureInfo?
>
> Thanks a lot,
>
> David
>
>
> ||||||| David Kimball
> ||||||| GIS Specialist
> ||||||| MA Department of Conservation and Recreation
> ||||||| http://www.mass.gov/dcr/stewardship/gis/
> ||||||| david.kimball at state.ma.us
> ||||||| 617.626.1447 phone
> ||||||| 617.626.1349 fax
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users
>
>   




More information about the Users mailing list