I've been searching the net for a couple of days to find a way, how to check if a wms layer has no features...
Let me explain
I'm using openLayers/geoserver/postgis.I'm using a cql_filter to search a wms layer. If the filter returns some features (points or lines or polygons) then i redraw the layer and they succesfully render.
But, if no features are rendered, I want to alert a message using javascript. The message simply gives some info, like "no matches found, please try again".
I guess I have to check if there are no features, and then alert the message. Right? Or is there another way to do this? Please help, I'm new to web-mapping....
Thanks
UPDATEUhm, I'm not saying that your answers are bad, but...I was thinking, using a simple getFeatureInfo, with no feature.count parameter, after I redraw my layer. If the text that returns is empty, then there are no features rendered (= no matches found). I came up with this idea, playing with the demo requests on Geoserver, using the getFeatureInfo. The syntax they use there, returns all the features...So, I will do the same thing and if no features returned I get what I want...But how to check for an empty text? Or this idea is completly wrong?
أكثر...
Let me explain
I'm using openLayers/geoserver/postgis.I'm using a cql_filter to search a wms layer. If the filter returns some features (points or lines or polygons) then i redraw the layer and they succesfully render.
But, if no features are rendered, I want to alert a message using javascript. The message simply gives some info, like "no matches found, please try again".
I guess I have to check if there are no features, and then alert the message. Right? Or is there another way to do this? Please help, I'm new to web-mapping....
Thanks
UPDATEUhm, I'm not saying that your answers are bad, but...I was thinking, using a simple getFeatureInfo, with no feature.count parameter, after I redraw my layer. If the text that returns is empty, then there are no features rendered (= no matches found). I came up with this idea, playing with the demo requests on Geoserver, using the getFeatureInfo. The syntax they use there, returns all the features...So, I will do the same thing and if no features returned I get what I want...But how to check for an empty text? Or this idea is completly wrong?
أكثر...