I'm making some progress with this:
I've set it up as:
                  wfsProtocol[i] = new OpenLayers.Protocol.Script({
                      url: lay.spatialQuery[0].url,
                      callbackKey: "format_options",
                      callbackPrefix: "callback:",
                      params: {
                          service: "WFS",
                          version: "1.1.0",
                          srsName: (projstr=="EPSG:900913" && 
(lay.serverUrl.search(/arcgis/)>=0)) ? "EPSG:102113" : projstr,
                          request: "GetFeature",
                          featurePrefix: lay.spatialQuery[0].featurePrefix,
                          typeName: lay.spatialQuery[0].featureType,
                          outputFormat: "json"
                      },
                      filterToParams: function(filter, params) {
                          // example to demonstrate BBOX serialization
                          if (filter.type === 
OpenLayers.Filter.Spatial.BBOX) {
                              params.bbox = filter.value.toArray();
                              if (filter.projection) {
                                  
params.bbox.push(filter.projection.getCode());
                              }
                          } else if (filter.type === 
OpenLayers.Filter.Spatial.DWITHIN) {
                                  params.cql_filter = 'DWITHIN(SHAPE,' + 
filter.value.toString() + ',' + filter.distance + ',' + 
filter.distanceUnits + ')';
                          } else if (filter.type === 
OpenLayers.Filter.Spatial.INTERSECTS) {
                              params.cql_filter = 'INTERSECTS(SHAPE,' + 
filter.value.toString() + ')';
                          }
                          return params;
                      }
                  })

However, the cql_filter approach to serializing the filter isnt working. 
Get empty feature set no matter what filter.distance is set to. Is there 
a better way to set up filters for GET?


-- 
Phil Scadden, Senior Scientist GNS Science Ltd 764 Cumberland St, 
Private Bag 1930, Dunedin, New Zealand Ph +64 3 4799663, fax +64 3 477 5232

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
[email protected]
http://lists.osgeo.org/mailman/listinfo/openlayers-users

Reply via email to