Christopher, I change to INFO_FORMAT: 'application/vnd.ogc.gml' , now work ok, but I consider that the request is slow exist other solution more fast ?
regards, salas ----- Original Message ----- From: "Christopher Schmidt" <[email protected]> To: "fsalas" <[email protected]> Cc: <[email protected]> Sent: Wednesday, September 23, 2009 11:15 AM Subject: Re: [OpenLayers-Users] Problems to obtain feature value > On Wed, Sep 23, 2009 at 12:04:38PM -0500, fsalas wrote: >> Hi, all >> >> I have following problem: >> >> I am trying to obtain the value of a field, but is null >> >> is The variable features.length is zero, how can I resolv this problem? > > My guess is that your'e not returning GML from your GetFeatureInfo. > Did you check what youer' returning via console.log or some such? > > -- Chris > >> >> function setHTML(response) { >> var format = new OpenLayers.Format.GML(); >> var features = format.read(response.responseXML || >> response.responseText); >> for (var i=0, len=features.length; i<len; i++) { >> var feature = features[i]; >> for (attribute in feature.attributes) { >> var value = feature.attributes[attribute]; >> console.log(attribute + ": " + value); >> } >> } >> } >> >> >> tiled = new OpenLayers.Layer.WMS( >> "topp:cuba - Tiled", "http://deltha:8080/geoserver/wms", >> { >> width: '800', >> srs: 'EPSG:4267', >> layers: 'topp:cuba', >> height: '300', >> styles: '', >> format: 'image/png', >> tiled: 'true', >> tilesOrigin : "-86.09241054242432,19.388371083287836" >> }, >> {buffer: 0} >> ); >> >> >> // support GetFeatureInfo >> map.events.register('click', map, function (e) { >> document.getElementById('nodelist').innerHTML = >> "Loading... please wait..."; >> 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: 'application/vnd.ogc.se_xml', >> QUERY_LAYERS: map.layers[0].params.LAYERS, >> FEATURE_COUNT: 50, >> WIDTH: map.size.w, >> HEIGHT: map.size.h >> }, >> "http://deltha:8080/geoserver/wms" >> ); >> OpenLayers.loadURL(url, '', this, setHTML, setHTML); >> OpenLayers.Event.stop(e); >> }); >> >> ___________________________________ >> Dirección de Comunicaciones >> Grupo Empresarial GEOCUBA >> Este mensaje esta libre de virus. >> Revisado por Kaspersky Antivirus >> ---------------------------------------------------------------------- >> Definition count: 2618974 >> Definition date: 9/23/2009 >> SecurityPlus version: 3.0.5 >> > >> _______________________________________________ >> Users mailing list >> [email protected] >> http://openlayers.org/mailman/listinfo/users > > > -- > Christopher Schmidt > MetaCarta > ___________________________________ Dirección de Comunicaciones Grupo Empresarial GEOCUBA Este mensaje esta libre de virus. Revisado por Kaspersky Antivirus ---------------------------------------------------------------------- Definition count: 2618974 Definition date: 9/23/2009 SecurityPlus version: 3.0.5 _______________________________________________ Users mailing list [email protected] http://openlayers.org/mailman/listinfo/users
