Hi,

If you use OpenLayers.ProxyHost, perhaps the problem lies there.

Arnd Wippermann
http://gis.ibbeck.de/ginfo/

-----Ursprüngliche Nachricht-----
Von: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Im
Auftrag von Rick Wayne
Gesendet: Dienstag, 8. Juli 2008 22:01
An: users@openlayers.org
Betreff: [OpenLayers-Users] Difficulties with GetFeatureInfo

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@openlayers.org
http://openlayers.org/mailman/listinfo/users

_______________________________________________
Users mailing list
Users@openlayers.org
http://openlayers.org/mailman/listinfo/users

Reply via email to