class Bbox implements Serializable {

	public static Bbox copyToCRS(Bbox source, String targetCRS) {
		Bbox newBox = copyValues(source, new Bbox());
		CoordinateReferenceSystem sourceCRS = DefaultGeographicCRS.WGS84;
		Pair<Pair<Double,Double>,Pair<Double,Double>> points = getPoints(source);
		
		if(points != null) {
			try {
				MathTransform transform = CRS.findMathTransform(sourceCRS, CRS.decode(targetCRS));
				DirectPosition minPoint = new DirectPosition2D(sourceCRS, points.getLeft().getLeft(), points.getLeft().getRight());
				minPoint = transform.transform(minPoint, null);
				DirectPosition maxPoint = new DirectPosition2D(sourceCRS, points.getRight().getLeft(), points.getRight().getRight());
				maxPoint = transform.transform(maxPoint, null);
				newBox.setBbox(minPoint.getCoordinate()[0], minPoint.getCoordinate()[1], maxPoint.getCoordinate()[0], maxPoint.getCoordinate()[1]);
			} catch(Exception e) {
				log.error("Failed to transform BBOX points from EPSG:4326 to " + targetCRS);
				newBox = new Bbox();
			}
			log.debug("Transformed box: " + newBox.getBbox());
		}

		return newBox;
	}

}