Hello, I had no response from my previous email so trying again.
please can somebody tell me what I need to do to get a WFS query INCLUDING the 
filter sent to a WFS server for processing? Everything I have tried sends a 
minimal WFS request and then does all the filter processing clientside which is 
not only slow but also the results are incorrect. this is because the 
maxresults attribute and the typename is set in the request but nothing else 
is, so only a minor percentage of my data is being filtered. If I dont set 
maxresults then I get correct answers but it takes at eternity. I'm sure theres 
a way to do this but I dont know what I'm doing wrong.

this is essentially my code - geotools 2.2.4 - in essence it works but does all 
the processing clientside. I want to send the query to the server as a proper 
WFS request. I hope someone can see what I am doing wrong?

DataStore data=null;
String getCapabilities ="http://...";;
Map connectionParameters = new HashMap();
connectionParameters.put("WFSDataStoreFactory:GET_CAPABILITIES_URL", 
getCapabilities );
connectionParameters.put(WFSDataStoreFactory.PROTOCOL.key,Boolean.FALSE);
data = DataStoreFinder.getDataStore( connectionParameters );
String pattern = "sometext";
String typeName = typeName ="sde:TOPO.GAZETTEER";
org.opengis.filter.FilterFactory2 ff =(FilterFactory2)
CommonFactoryFinder.getFilterFactory(null);
FeatureType ft=wfsstore.getSchema(typeName);

//is there a simpler way to do this?
Vector column=new Vector();
for (int i = 0; i < ft.getAttributeCount(); i++) { 
   if (!ft.getAttributeType(i).getName().equals("SHAPE")) {
        Expression left = ff.property(ft.getAttributeType(i).getName());
                Expression right= ff.literal(pattern);
                column.add(ff.equal(left, right, false));
                }
        }
BinaryLogicOperator blo=ff.or(column);
DefaultQuery query = new DefaultQuery(typeName,blo);
query.setMaxFeatures(100);
FeatureSource fs = wfsstore.getFeatureSource(typeName);
FeatureCollection results = fs.getFeatures(query);
Iterator fr = results.iterator();
while (fr.hasNext()){...


Thanks in advance
Jason.


-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Geotools-gt2-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to