[OpenLayers-Users] Difficulties with GetFeatureInfo

mpriour mpriour at kestrelcomputer.com
Fri Dec 26 00:37:09 EST 2008


I have added it to my sandbox, opened a ticket and submitted patch.
The patch has been reviewed and modified and you can see the current progress of it at:
http://trac.openlayers.org/ticket/1812

glad to know that others are in someway interested in this.
Matt Priour 


From: Eric Lemoine (via Nabble) 
Sent: Thursday, December 25, 2008 10:43 PM
To: mpriour 
Subject: Re: Difficulties with GetFeatureInfo


Matt, i had never tried Format.GML with GetFeatureInfo responses. And 
indeed that'd be great to have support for this. Do you plan to 
contribute your work for integration into OpenLayers? Thanks. Eric 

2008/7/9, mpriour <mpriour at ...>: 

> 
> I was actually struggling with this same problem this past month. 
> You should use: 
> 
> var xmlResponse = new OpenLayers.Format.XML().read(response.responseText); 
> 
> this will convert the text into a valid xml object. 
> From there you can do whatever you want to it. 
> 
> I am writing some convience methods that extend OpenLayers.Format.GML to 
> parse the GML GetFeatureInfo response into predictable js objects. The 
> current methods for Format.GML & Format.WFS are not designed to correctly 
> parse the entire GML GetFeatureInfo response. They can parse some geometry 
> or features from portions of the response. 
> 
> Matt Priour 
> Kestrel Computer Consulting 
> www.kestrelcompter.com - homepage 
> priour.wordpress.com - blog 
> 
> 
> Eric Lemoine-3 wrote: 
>> 
>> Hi. Have you tried using OpenLayers.Format.GML for de-serializing the 
>> response text into feature objects? Eric 
>> 
>> 2008/7/8, Rick Wayne <fewayne at ...>: 
>>> Hullo all, 
>>> 
>>> I'm using OpenLayers and GeoServer, and am having some trouble with 
>>> getting XML data out of GetFeatureInfo. If I ask GeoServer for 
>>> INFO_FORMAT of application/vnd.ogc.gml, I get a response back, and it 
>>> has the data I desire. But I cannot access those data as XML. I have 
>>> to get them via responseText and parse that looking for angle brackets 
>>> and the like, which is all very boring, not to say fragile as a dried 
>>> leaf. 
>>> 
>>> Of course, I should be able to make use of the responseXML property, 
>>> but that obstinately persists in being NULL, even when the text 
>>> response is fine. In fact, the text response is perfectly good XML. As 
>>> a big honkin' string. 
>>> 
>>> I'm using GeoServer 1.5.3 and, er, whichever OL version came with 
>>> that. :-) 
>>> 
>>> Below are the relevant calls. If anyone can assuage my ignorance, good 
>>> cheer to them! 
>>> 
>>> TIA, 
>>> 
>>> Rick Wayne 
>>> UW Soil Science 
>>> 
>>>          [...] 
>>> map.events.register('click', map, function (e) { 
>>> var url =  map.baseLayer.getFullRequestString({ 
>>> REQUEST: "GetFeatureInfo", 
>>> EXCEPTIONS: "application/vnd.ogc.se_xml", 
>>> BBOX: map.getExtent().toBBOX(), 
>>> X: e.xy.x, 
>>> Y: e.xy.y, 
>>> INFO_FORMAT: 'application/vnd.ogc.gml', 
>>> // INFO_FORMAT: 'text/plain', 
>>> QUERY_LAYERS: map.baseLayer.params.LAYERS, 
>>> FEATURE_COUNT: 1, 
>>> srs: 'EPSG:26916', 
>>> styles: '', 
>>> layers: 'mmas:civil', 
>>> WIDTH: map.size.w, 
>>> HEIGHT: map.size.h}, 
>>> "/geoserver/wms" 
>>>  ); 
>>> OpenLayers.loadURL(url, '', this, zoomToFeature, zoomToFeature); 
>>> Event.stop(e); 
>>> }); 
>>> 
>>> function zoomToFeature(response) { 
>>> // lines = response.responseText.split('\n'); 
>>> var txt; 
>>> var tag; 
>>> var coord_index; 
>>> var rest; 
>>> var coord_text; 
>>> var coords; 
>>> var coord_pairs,ll,ur; 
>>> 
>>> txt = response.responseText; // here should be xml = 
>>> response.responseXML; 
>>> tag = 'gml:coordinates decimal="." cs="," ts=" ">'; 
>>> coord_index = txt.indexOf(tag); 
>>> rest = txt.substr(coord_index + tag.length); 
>>> end_coord_index = rest.indexOf('<'); 
>>>          // And so on, too ugly to reveal the rest! 
>>> 
>>> 
>>> _______________________________________________ 
>>> Users mailing list 
>>> Users at ... 
>>> http://openlayers.org/mailman/listinfo/users
>>> 
>> _______________________________________________ 
>> Users mailing list 
>> Users at ... 
>> http://openlayers.org/mailman/listinfo/users
>> 
>> 
> 
> -- 
> View this message in context: 
> http://www.nabble.com/Difficulties-with-GetFeatureInfo-tp18347813p18353488.html
> Sent from the OpenLayers Users mailing list archive at Nabble.com. 
> 
> _______________________________________________ 
> Users mailing list 
> Users at ... 
> http://openlayers.org/mailman/listinfo/users
> 
_______________________________________________ 
Users mailing list 
Users at ... 
http://openlayers.org/mailman/listinfo/users



--------------------------------------------------------------------------------

This email is a reply to your post @ http://n2.nabble.com/Difficulties-with-GetFeatureInfo-tp1829674p1829677.html
You can reply by email or by visting the link above.


-- 
View this message in context: http://n2.nabble.com/Difficulties-with-GetFeatureInfo-tp1829674p1834153.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20081225/71273cc2/attachment.html


More information about the Users mailing list