Dear All
I Have a HTML just to show 2 layer Googlemap (API V.3) and WMS (GeoServer) Layer
No I want to try the GetFeatureInfo, I Add (inside the init()) :
//---------Start GFI---
               map.events.register('click', map, function (e) {
OpenLayers.Util.getElement('nodeList').innerHTML = "Loading... please wait...";
                   var url =  wmslayer0.getFullRequestString({
                       REQUEST: "GetFeatureInfo",
                       EXCEPTIONS: "application/vnd.ogc.se_xml",
                       BBOX: wmslayer0.map.getExtent().toBBOX(),
                       X: e.xy.x,
                       Y: e.xy.y,
                       INFO_FORMAT: 'application/vnd.ogc.gml',
                       QUERY_LAYERS: 'spoin:points',
                       WIDTH: wmslayer0.map.size.w,
                       HEIGHT: wmslayer0.map.size.h,
                   });

                   function setHTML(response) {
                       html = ""
                       g =  new OpenLayers.Format.GML();
                       features = g.read(response.responseText);
                       for(var feat in features) {
html += "Feature: Geometry: "+ features[feat].geometry+",";
                           html += "<ul>";
                               for (var j in features[feat].attributes) {
html += "<li>"+j+":"+features[feat].attributes[j]+"</li>";
                               }
                           html += "</ul>"
                       }
document.getElementById('nodeList').innerHTML = html;
                   }

                   OpenLayers.loadURL(url, '', this, setHTML);
                   OpenLayers.Event.stop(e);
               });

//---------Stop GFI----

Codes above is adopted from http://openlayers.org/dev/examples/GMLParser.html
I Load the page in my FireFox.
The map displayed .
I try to click a points :
1. Nothing happend
2. The FireBug Said there is one error

From the FireBug Console :
1. It report --> no element found
2. It also give me url , and I open the url in a new tab , firefox ask me to save , and I got XML file like :
//-----START-XML
<?xml version="1.0" encoding="UTF-8"?>
<wfs:FeatureCollection xmlns="http://www.opengis.net/wfs"; xmlns:wfs="http://www.opengis.net/wfs"; xmlns:gml="http://www.opengis.net/gml"; xmlns:spoin="http://jabber.int/spoin"; xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; xsi:schemaLocation="http://jabber.int/spoin http://192.168.10.233:8080/geoserver/wfs?service=WFS&amp;version=1.0.0&amp;request=DescribeFeatureType&amp;typeName=spoin%3Apoints http://www.opengis.net/wfs http://192.168.10.233:8080/geoserver/schemas/wfs/1.0.0/WFS-basic.xsd";>
   <gml:boundedBy>
       <gml:null>unknown</gml:null>
   </gml:boundedBy>
   <gml:featureMember>
       <spoin:points fid="points.205508">
           <spoin:label>NGUPASAN</spoin:label>
           <spoin:type>0xd00</spoin:type>
           <spoin:level>1</spoin:level>
           <spoin:the_geom>
<gml:Point srsName="http://www.opengis.net/gml/srs/epsg.xml#4326";> <gml:coordinates xmlns:gml="http://www.opengis.net/gml"; decimal="." cs="," ts=" ">110.36599,-7.80068</gml:coordinates>
               </gml:Point>
           </spoin:the_geom>
       </spoin:points>
   </gml:featureMember>
</wfs:FeatureCollection>
//-----STOP-XML

With that xml output ... i'm sure that the data is there.
I think the parser function (function setHTML(response) ) not doing proper handling of the output-data

Do I did something wrong ?
Kindly please give me any of your enlightments.

Sincerely
-bino-
_______________________________________________
Users mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/openlayers-users

Reply via email to