public static Filter fixDWithin(final Filter filter) { final HasDWithinFilterVisitor dwithinCheck = new HasDWithinFilterVisitor(); filter.accept(dwithinCheck, null); if (dwithinCheck.hasDWithin()) { try { final Filter retVal = (Filter) filter.accept(new DWithinFilterVisitor(), null); // We do not have a way to transform a filter directly from one // to another. return FilterToCQLTool.toFilter(ECQL.toCQL(retVal)); } catch (final CQLException e) { LOGGER.trace("Filter is not a CQL Expression", e); } } return filter; }