WMSGetFeatureInfo returns zero features but correct response.

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

WMSGetFeatureInfo returns zero features but correct response.

Paul Meems
I'm trying to format the attributes of a WMS layer myself.
The WMS layer is made from a shapefile using Geoserver.
Using Google I found this piece of code:

            var infoControl = new OpenLayers.Control.WMSGetFeatureInfo({
              url: serverLocation,
              title: 'Get data',
              queryVisible: true,
              infoFormat: 'application/vnd.ogc.gml',
              output: 'features',
              eventListeners: {
                getfeatureinfo: function(event) {
                  console.log(event.features.length);
                  for (var i = 0; i < event.features.length; i++) {
                    var feature = event.features[i];
                    var attributes = feature.attributes;
                    console.log(attributes);
                    document.getElementById('info').innerHTML = attributes[0];
                  }
                }
             }
          });
          map.addControl(infoControl);
          infoControl.activate();

This doesn't do anything because event.features.length is zero.
When I change the infoFormat to text and put event.text in my div I get the default formatted table.
So the response is correct.
When I use Firebug and look at the response of the GET that is send, I see my data in xml format.

So what am I missing that I cannot parse that xml into the event.features class.

Thanks,

Paul

_______________________________________________
Users mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/openlayers-users
Reply | Threaded
Open this post in threaded view
|

Re: WMSGetFeatureInfo returns zero features but correct response.

Phil Scadden
That looks very like code I have working okay. However, I have had
trouble with malformed GML from an incorrect geoserver configuration.
Can you post the GML that you getting back?

Notice: This email and any attachments are confidential.
If received in error please destroy and immediately notify us.
Do not copy or disclose the contents.

_______________________________________________
Users mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/openlayers-users
Reply | Threaded
Open this post in threaded view
|

Re: WMSGetFeatureInfo returns zero features but correct response.

Paul Meems
Hi Phil,

Thanks for the response.
Here is the GML that I get back:

<?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:MyWorkspace="MyWorkspace"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="MyWorkspace http://MyIP/geoserver/MyWorkspace/wfs?service=WFS&amp;version=1.0.0&amp;request=DescribeFeatureType&amp;typeName=MyWorkspace%3A2013_10pt http://www.opengis.net/wfs http://MyIP/geoserver/schemas/wfs/1.0.0/WFS-basic.xsd">
    <gml:boundedBy>
      <gml:null>unknown</gml:null>
    </gml:boundedBy>
    <gml:featureMember>
      <MyWorkspace:2013_10pt fid="2013_10pt.4">
        <MyWorkspace:the_geom>
          <gml:Point srsName="http://www.opengis.net/gml/srs/epsg.xml#3857">
            <gml:coordinates xmlns:gml="http://www.opengis.net/gml" decimal="." cs="," ts=" ">542435.223,6825228.891</gml:coordinates>
          </gml:Point>
        </MyWorkspace:the_geom>
        <MyWorkspace:NAAM>MyName</MyWorkspace:NAAM>
        <MyWorkspace:ProfNr>MyID</MyWorkspace:ProfNr>
        <MyWorkspace:hotlink>http://www.myserver.com/1062.png</MyWorkspace:hotlink>
        <MyWorkspace:datum>13-08-2013</MyWorkspace:datum>
        <MyWorkspace:tekort>145</MyWorkspace:tekort>
      </MyWorkspace:2013_10pt>
    </gml:featureMember>
  </wfs:FeatureCollection>

I don't see what is malformed. Do you have some suggestions?

Thanks,

Paul



2013/8/13 Phil Scadden <[hidden email]>
That looks very like code I have working okay. However, I have had trouble with malformed GML from an incorrect geoserver configuration. Can you post the GML that you getting back?

Notice: This email and any attachments are confidential.
If received in error please destroy and immediately notify us.
Do not copy or disclose the contents.

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


_______________________________________________
Users mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/openlayers-users
Reply | Threaded
Open this post in threaded view
|

Re: WMSGetFeatureInfo returns zero features but correct response.

Bart van den Eijnden
I don't think XML elements are allowed to start with digits:

2013_10pt

Best regards,
Bart

-- 
Bart van den Eijnden
OpenGeo - http://opengeo.org
Expert service straight from the developers.



On Aug 14, 2013, at 8:47 AM, Paul Meems <[hidden email]> wrote:

Hi Phil,

Thanks for the response.
Here is the GML that I get back:

<?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:MyWorkspace="MyWorkspace"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="MyWorkspace http://MyIP/geoserver/MyWorkspace/wfs?service=WFS&amp;version=1.0.0&amp;request=DescribeFeatureType&amp;typeName=MyWorkspace%3A2013_10pt http://www.opengis.net/wfs http://MyIP/geoserver/schemas/wfs/1.0.0/WFS-basic.xsd">
    <gml:boundedBy>
      <gml:null>unknown</gml:null>
    </gml:boundedBy>
    <gml:featureMember>
      <MyWorkspace:2013_10pt fid="2013_10pt.4">
        <MyWorkspace:the_geom>
          <gml:Point srsName="http://www.opengis.net/gml/srs/epsg.xml#3857">
            <gml:coordinates xmlns:gml="http://www.opengis.net/gml" decimal="." cs="," ts=" ">542435.223,6825228.891</gml:coordinates>
          </gml:Point>
        </MyWorkspace:the_geom>
        <MyWorkspace:NAAM>MyName</MyWorkspace:NAAM>
        <MyWorkspace:ProfNr>MyID</MyWorkspace:ProfNr>
        <MyWorkspace:hotlink>http://www.myserver.com/1062.png</MyWorkspace:hotlink>
        <MyWorkspace:datum>13-08-2013</MyWorkspace:datum>
        <MyWorkspace:tekort>145</MyWorkspace:tekort>
      </MyWorkspace:2013_10pt>
    </gml:featureMember>
  </wfs:FeatureCollection>

I don't see what is malformed. Do you have some suggestions?

Thanks,

Paul



2013/8/13 Phil Scadden <[hidden email]>
That looks very like code I have working okay. However, I have had trouble with malformed GML from an incorrect geoserver configuration. Can you post the GML that you getting back?

Notice: This email and any attachments are confidential.
If received in error please destroy and immediately notify us.
Do not copy or disclose the contents.

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

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


_______________________________________________
Users mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/openlayers-users
Reply | Threaded
Open this post in threaded view
|

Re: WMSGetFeatureInfo returns zero features but correct response.

Paul Meems
Hi Bart,

Thanks for your suggestion. That was indeed the problem.
I changed the name of the layer and now it is working as expected.

Thanks,
Paul


2013/8/14 Bart van den Eijnden <[hidden email]>
I don't think XML elements are allowed to start with digits:

2013_10pt

Best regards,
Bart

-- 
Bart van den Eijnden
OpenGeo - http://opengeo.org
Expert service straight from the developers.



On Aug 14, 2013, at 8:47 AM, Paul Meems <[hidden email]> wrote:

Hi Phil,

Thanks for the response.
Here is the GML that I get back:

<?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:MyWorkspace="MyWorkspace"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="MyWorkspace http://MyIP/geoserver/MyWorkspace/wfs?service=WFS&amp;version=1.0.0&amp;request=DescribeFeatureType&amp;typeName=MyWorkspace%3A2013_10pt http://www.opengis.net/wfs http://MyIP/geoserver/schemas/wfs/1.0.0/WFS-basic.xsd">
    <gml:boundedBy>
      <gml:null>unknown</gml:null>
    </gml:boundedBy>
    <gml:featureMember>
      <MyWorkspace:2013_10pt fid="2013_10pt.4">
        <MyWorkspace:the_geom>
          <gml:Point srsName="http://www.opengis.net/gml/srs/epsg.xml#3857">
            <gml:coordinates xmlns:gml="http://www.opengis.net/gml" decimal="." cs="," ts=" ">542435.223,<a href="tel:6825228.891" value="+16825228891" target="_blank">6825228.891</gml:coordinates>
          </gml:Point>
        </MyWorkspace:the_geom>
        <MyWorkspace:NAAM>MyName</MyWorkspace:NAAM>
        <MyWorkspace:ProfNr>MyID</MyWorkspace:ProfNr>
        <MyWorkspace:hotlink>http://www.myserver.com/1062.png</MyWorkspace:hotlink>
        <MyWorkspace:datum>13-08-2013</MyWorkspace:datum>
        <MyWorkspace:tekort>145</MyWorkspace:tekort>
      </MyWorkspace:2013_10pt>
    </gml:featureMember>
  </wfs:FeatureCollection>

I don't see what is malformed. Do you have some suggestions?

Thanks,

Paul



2013/8/13 Phil Scadden <[hidden email]>
That looks very like code I have working okay. However, I have had trouble with malformed GML from an incorrect geoserver configuration. Can you post the GML that you getting back?

Notice: This email and any attachments are confidential.
If received in error please destroy and immediately notify us.
Do not copy or disclose the contents.

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

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



_______________________________________________
Users mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/openlayers-users
Reply | Threaded
Open this post in threaded view
|

Re: WMSGetFeatureInfo returns zero features but correct response.

Phil Scadden
And just a further note - you can use
http://cite.opengeospatial.org/test_engine/gml/2.1.2/validator/
to test gml.

Notice: This email and any attachments are confidential.
If received in error please destroy and immediately notify us.
Do not copy or disclose the contents.

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