Try removing the parameter "resultType: "hits". (Your issue is the opposite of this one:
http://gis.stackexchange.com/questions/45101/only-return-the-numberoffeatures-in-a-wfs-query On Mon, May 12, 2014 at 1:24 PM, rickm81 <rick...@yahoo.com> wrote: > Hello Alll, > > I am trying to retrieve feature data from a WMS layer hosted by GeoServer > using a Vector layer drawn on a map. Unfortunately, I am only receiving the > NumberOfFeatures selected. For example, I draw a polygon on the map that > intersects 10 polygon features in the WMS layer. The NumberOfFeatures value > returned is 10, but none of the feature data ("ID", "ADDRESS", > "POLYNUMBER", > etc.) is returned. > > Here is the code I am using to query the WMS Layer. > > // Create WMS Layer > census_blocks = new OpenLayers.Layer.WMS("Census Block Groups", > "http://localhost:8080/geoserver/US_Census_Blocks_CensusSummary/wms", > { 'layers': > '2010_BlockGroups_US_CensusSummary:2010_BlockGroups_US_CensusSummary', > transparent: true, format: 'image/png' }, > { isBaseLayer: false }); > > // Create Filter Using Polygon Drawn on Map > var pfilter = new OpenLayers.Filter.Spatial({ > type: OpenLayers.Filter.Spatial.INTERSECTS, > value: e.feature.geometry // <== This is the polygon drawn on map > }); > > // Create WFS From WMS, Pass in Filter, Handle Response > var wfsProtocol = new > OpenLayers.Protocol.WFS.fromWMSLayer(census_blocks); > wfsProtocol.read({ > filter: pfilter, > extractAttributes: true, > infoFormat: "application/vnd.ogc.gml", > resultType: "hits", > callback: function (resp) { > // Trying to access Feature Data here, but unsuccessful > alert(resp); > } > }); > > I've looked at several examples online, but have not found a resolution. If > any one has any ideas I would greatly appreciate it. Thank you! > > > > > > -- > View this message in context: > http://osgeo-org.1560.x6.nabble.com/WFS-fromWMSLayer-get-multiple-feature-attributes-tp5139854.html > Sent from the OpenLayers Users mailing list archive at Nabble.com. > _______________________________________________ > Users mailing list > us...@lists.osgeo.org > http://lists.osgeo.org/mailman/listinfo/openlayers-users >
_______________________________________________ Users mailing list us...@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/openlayers-users