[OpenLayers-Users] Re: How to use CQL filter

Phil Scadden p.scadden at gns.cri.nz
Mon Feb 20 15:30:07 EST 2012


> Thank you I got that.
> but now I'm confused, when will this func be called ?
>
> // called when features are fetched
> function loadFeatures(data) {
>      var features = new OpenLayers.Format.GeoJSON().read(data);
>      states.addFeatures(features);
This refers to the CQL_Filter example. If you look at the html, you will 
see that it loads the wfs via jsonp with this script insertion:

   <script  src="http://demo.opengeo.org/geoserver/wfs?service=WFS&amp;version=1.0.0&amp;request=GetFeature&amp;typename=topp:states&amp;outputFormat=json&amp;format_options=callback:loadFeatures  <view-source:http://demo.opengeo.org/geoserver/wfs?service=WFS&version=1.0.0&request=GetFeature&typename=topp:states&outputFormat=json&format_options=callback:loadFeatures>"type="text/javascript"></script>
after the cql-format.js script.

If you are loading your data via geojson, you need this kind of mechanism to beat cross-domain ajax
prohibitions in browsers. However, depends on how and where you get the vector data. See other vector demos for alternatives.




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.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20120221/f35fe457/attachment.html


More information about the Users mailing list