Hi All.

I'm afraid I have another annoying question for you. I have a WFS layer on my map and I want to be able to filter what features are returned from the server by applying a Filter to the layer. The filter will be built up based on some input fields in a form. I guess I am trying to achieve the same as this:
http://www.geotools.org/display/GEOTOOLS/Filters

DataStore store = new ShapefileDataStore("citiesx020.shp");
FeatureSource features = store.getFeatureSource(store.getTypeNames()[0]);
FeatureCollection col = features.getFeatures().collection();
System.out.println("# cities (no filter)= "+col.size());

// Create the filter
FilterFactory filterFactory = FilterFactory.createFilterFactory();
CompareFilter filter = null;
try {
   filter = 
filterFactory.createCompareFilter(CompareFilter.COMPARE_GREATER_THAN);
   FeatureType featureType = features.getFeatures().getSchema();
   
filter.addLeftValue(filterFactory.createAttributeExpression(featureType,"POP_2000"));
   filter.addRightValue(filterFactory.createLiteralExpression(100000));
} catch (IllegalFilterException e) {
   e.printStackTrace();
}

col = features.getFeatures(filter).collection();
System.out.println("# cities (after filter)= "+col.size());


The only difference is that I want the BasicFeatureRenderer to do that for me when I supply the layer/renderer/whatever a filter to use. I'm not actually trying to search for Features myself, I just want them displayed on the map as the Filter provides. Can this be done?

Thanks,
Mark

--
This message has been scanned for viruses and dangerous
content by MailScanner, and is believed to be clean.

begin:vcard
fn:Mark Presling
n:Presling;Mark
email;internet:[EMAIL PROTECTED]
tel;home:+6442322774
tel;cell:+6421549540
version:2.1
end:vcard

_______________________________________________
User-friendly Desktop Internet GIS (uDig)
http://udig.refractions.net
http://lists.refractions.net/mailman/listinfo/udig-devel

Reply via email to