Envelope domainOfValidity = geomFac.createEnvelope( b[0], b[1], b[2], b[3], CRSUtils.EPSG_4326 ); domainOfValidity = transform( domainOfValidity, bbox.getCoordinateSystem() ); if ( !bbox.isWithin( domainOfValidity ) ) { String msg = "Invalid geometry constraint in filter. The envelope of the geometry is not within the domain of validity ('" + domainOfValidity domainOfValidity = transform( domainOfValidity, queriedCrs ); Envelope bboxTransformed = transform( bbox, queriedCrs ); if ( !bboxTransformed.isWithin( domainOfValidity ) ) { String msg = "Invalid geometry constraint in filter. The envelope of the geometry is not within the domain of validity ('" + domainOfValidity + "') of the queried CRS ('" + queriedCrs.getAlias() + "').";