[OpenLayers-Users] How to know if a WFS layer has no features?

Guido_bs guido.pollini at gmail.com
Fri Nov 30 10:47:06 EST 2007


Hello, I'm not so good in using OL, so I have a question for you experts.
In my application I build a WFS layer and this layer can have some WFS
features (shown as markers) or not, it depends from a query to Mapserver:

layer_wfs = new OpenLayers.Layer.WFS( "My Markers", MAPSERVER_URL,
{map:MAPFILE_DIR+filtercode+".map", typename: "filter"},{ featureClass:
OpenLayers.Feature.WFS});

If there are not features for the layer, Mapserver gives me this answer:

<?xml version='1.0' encoding="ISO-8859-1" ?>

<wfs:FeatureCollection

   xmlns:MYSQL="http://ogc.dmsolutions.ca/gml/2.1.2/feature.xsd"

   xmlns:wfs="http://www.opengis.net/wfs"

   xmlns:gml="http://www.opengis.net/gml"

   xmlns:ogc="http://www.opengis.net/ogc"

   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

   xsi:schemaLocation="http://www.opengis.net/wfs
http://schemas.opengeospatial.net/wfs/1.0.0/WFS-basic.xsd 

                       http://ogc.dmsolutions.ca/gml/2.1.2/feature.xsd
http://foo.foo.org/cgi-bin/mapserv

?SERVICE=WFS&amp;VERSION=1.0.0&amp;REQUEST=DescribeFeatureType&amp;TYPENAME=filter&amp;OUTPUTFORMAT=XMLSCHEMA">

   <gml:boundedBy>

      <gml:null>missing</gml:null>

   </gml:boundedBy>

</wfs:FeatureCollection> 

I'd like to know if after its creation, layer_wfs has no WFS features. Is
there a function in OL to do it? I thought to read the "missing" string in
Mapserver answer but I don't know how to do it and I don't understand where
Mapserver answer is read by OL. 
My OL version is 2.5.
Thanks a lot,
Guido
-- 
View this message in context: http://www.nabble.com/How-to-know-if-a-WFS-layer-has-no-features--tf4917423.html#a14074195
Sent from the OpenLayers Users mailing list archive at Nabble.com.




More information about the Users mailing list