### Question:
WMTSHandler extends OWSHandler { public static double computeScaleDenominator(double pixelSpan, CoordinateReferenceSystem crs) { double metersPerUnit; if (crs.getProjection().getUnits().name.equals(Units.DEGREES.name)) { metersPerUnit = 1 / 111319.49079327357; } else { metersPerUnit = Units.convert(1, Units.METRES, crs.getProjection().getUnits()); } return pixelSpan / .28e-3 / metersPerUnit; } WMTSHandler(); static double computeScaleDenominator(double pixelSpan, CoordinateReferenceSystem crs);  }### Answer:
@Test public void testComputeScaleDenominator() throws Exception { CoordinateReferenceSystem crs = Proj.EPSG_900913; double[] vals = new double[] { 559082264.0287178, 156543.0339280410, 279541132.0143589, 78271.51696402048, 4265.459167699568, 1.194328566955879, 2132.729583849784, 0.5971642834779395 }; for (int i = 0; i < vals.length; i+=2) { assertEquals(vals[i], WMTSHandler.computeScaleDenominator(vals[i+1], crs), 1e-5); } crs = Proj.EPSG_4326; vals = new double[] { 279541132.0143589, 0.703125, 139770566.0071794, 0.3515625, }; for (int i = 0; i < vals.length; i+=2) { assertEquals(vals[i], WMTSHandler.computeScaleDenominator(vals[i+1], crs), 1e-5); } }