Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

Is there a way to get distinct values from multiple columns in geotools?

I know I can get unique values from a column like this:

SimpleFeatureSource featureSource = dataStore.getFeatureSource(layer);
Query query = new Query(layer, Filter.INCLUDE, new String[] { "PROPERTY_A", 
"PROPERTY_B", "PROPERTY_C" });
UniqueVisitor visitor = new UniqueVisitor("PROPERTY_A");
SimpleFeatureCollection collection = featureSource.getFeatures( query );
collection.accepts(visitor, null);
Set set = visitor.getResult()

But what I need is an equivalent to select distinct PROPERTY_A, PROPERTY_B, PROPERTY_C.

Edit: I've tried to get unique values from the first column, and then create cql filters with the unique values from the first column to query unique values from the second column and so on, an then join it all in the end. But the performance, as expected, is very poor.

share|improve this question

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.