@Test @Category(UnitTest.class) public void testReprojectBounds3857() { String epsg = "EPSG:3857"; Bounds bounds = new Bounds(66.047475576957, 33.021709619141, 68.594930410941, 34.068157373047); Bounds prjBounds = RequestUtils.reprojectBounds(bounds, epsg); Assert.assertEquals("Bad bounds west", 7352371, prjBounds.w, 1.0); Assert.assertEquals("Bad bounds south", 3898185, prjBounds.s, 1.0); Assert.assertEquals("Bad bounds east", 7635952, prjBounds.e, 1.0); Assert.assertEquals("Bad bounds north", 4037957, prjBounds.n, 1.0); }
public static Bounds reprojectBounds(Bounds bounds, String srs) { if (srs != null && !(srs.equalsIgnoreCase("EPSG:4326"))) { SpatialReference src = new SpatialReference(GDALUtils.EPSG4326()); SpatialReference dst = new SpatialReference(); dst.SetFromUserInput(srs); CoordinateTransformation tx = new CoordinateTransformation(src, dst); double[] c1; double[] c2; double[] c3; double[] c4; c1 = tx.TransformPoint(bounds.w, bounds.s); c2 = tx.TransformPoint(bounds.w, bounds.n); c3 = tx.TransformPoint(bounds.e, bounds.s); c4 = tx.TransformPoint(bounds.e, bounds.n); return new Bounds(Math.min(Math.min(c1[0], c2[0]), Math.min(c3[0], c4[0])), Math.min(Math.min(c1[1], c2[1]), Math.min(c3[1], c4[1])), Math.max(Math.max(c1[0], c2[0]), Math.max(c3[0], c4[0])), Math.max(Math.max(c1[1], c2[1]), Math.max(c3[1], c4[1]))); } else { return bounds.clone(); } }
RequestUtils { public static Bounds reprojectBounds(Bounds bounds, String srs) { if (srs != null && !(srs.equalsIgnoreCase("EPSG:4326"))) { SpatialReference src = new SpatialReference(GDALUtils.EPSG4326()); SpatialReference dst = new SpatialReference(); dst.SetFromUserInput(srs); CoordinateTransformation tx = new CoordinateTransformation(src, dst); double[] c1; double[] c2; double[] c3; double[] c4; c1 = tx.TransformPoint(bounds.w, bounds.s); c2 = tx.TransformPoint(bounds.w, bounds.n); c3 = tx.TransformPoint(bounds.e, bounds.s); c4 = tx.TransformPoint(bounds.e, bounds.n); return new Bounds(Math.min(Math.min(c1[0], c2[0]), Math.min(c3[0], c4[0])), Math.min(Math.min(c1[1], c2[1]), Math.min(c3[1], c4[1])), Math.max(Math.max(c1[0], c2[0]), Math.max(c3[0], c4[0])), Math.max(Math.max(c1[1], c2[1]), Math.max(c3[1], c4[1]))); } else { return bounds.clone(); } } }
RequestUtils { public static Bounds reprojectBounds(Bounds bounds, String srs) { if (srs != null && !(srs.equalsIgnoreCase("EPSG:4326"))) { SpatialReference src = new SpatialReference(GDALUtils.EPSG4326()); SpatialReference dst = new SpatialReference(); dst.SetFromUserInput(srs); CoordinateTransformation tx = new CoordinateTransformation(src, dst); double[] c1; double[] c2; double[] c3; double[] c4; c1 = tx.TransformPoint(bounds.w, bounds.s); c2 = tx.TransformPoint(bounds.w, bounds.n); c3 = tx.TransformPoint(bounds.e, bounds.s); c4 = tx.TransformPoint(bounds.e, bounds.n); return new Bounds(Math.min(Math.min(c1[0], c2[0]), Math.min(c3[0], c4[0])), Math.min(Math.min(c1[1], c2[1]), Math.min(c3[1], c4[1])), Math.max(Math.max(c1[0], c2[0]), Math.max(c3[0], c4[0])), Math.max(Math.max(c1[1], c2[1]), Math.max(c3[1], c4[1]))); } else { return bounds.clone(); } }  }
RequestUtils { public static Bounds reprojectBounds(Bounds bounds, String srs) { if (srs != null && !(srs.equalsIgnoreCase("EPSG:4326"))) { SpatialReference src = new SpatialReference(GDALUtils.EPSG4326()); SpatialReference dst = new SpatialReference(); dst.SetFromUserInput(srs); CoordinateTransformation tx = new CoordinateTransformation(src, dst); double[] c1; double[] c2; double[] c3; double[] c4; c1 = tx.TransformPoint(bounds.w, bounds.s); c2 = tx.TransformPoint(bounds.w, bounds.n); c3 = tx.TransformPoint(bounds.e, bounds.s); c4 = tx.TransformPoint(bounds.e, bounds.n); return new Bounds(Math.min(Math.min(c1[0], c2[0]), Math.min(c3[0], c4[0])), Math.min(Math.min(c1[1], c2[1]), Math.min(c3[1], c4[1])), Math.max(Math.max(c1[0], c2[0]), Math.max(c3[0], c4[0])), Math.max(Math.max(c1[1], c2[1]), Math.max(c3[1], c4[1]))); } else { return bounds.clone(); } }  static String buildBaseURI(UriInfo uriInfo, HttpHeaders headers); static String buildURI(String baseUri, MultivaluedMap<String, String> params); static MultivaluedMap<String, String> replaceParam(String name, String value, MultivaluedMap<String, String> params); static MultivaluedMap<String, String> replaceParam(String name, List<String> values,
    MultivaluedMap<String, String> params); static MrsImageDataProvider[] getPyramidFilesList(
    ProviderProperties providerProperties); static Bounds reprojectBounds(Bounds bounds, String srs); static Bounds reprojectBoundsToWGS84(Bounds bounds, String srs); }
RequestUtils { public static Bounds reprojectBounds(Bounds bounds, String srs) { if (srs != null && !(srs.equalsIgnoreCase("EPSG:4326"))) { SpatialReference src = new SpatialReference(GDALUtils.EPSG4326()); SpatialReference dst = new SpatialReference(); dst.SetFromUserInput(srs); CoordinateTransformation tx = new CoordinateTransformation(src, dst); double[] c1; double[] c2; double[] c3; double[] c4; c1 = tx.TransformPoint(bounds.w, bounds.s); c2 = tx.TransformPoint(bounds.w, bounds.n); c3 = tx.TransformPoint(bounds.e, bounds.s); c4 = tx.TransformPoint(bounds.e, bounds.n); return new Bounds(Math.min(Math.min(c1[0], c2[0]), Math.min(c3[0], c4[0])), Math.min(Math.min(c1[1], c2[1]), Math.min(c3[1], c4[1])), Math.max(Math.max(c1[0], c2[0]), Math.max(c3[0], c4[0])), Math.max(Math.max(c1[1], c2[1]), Math.max(c3[1], c4[1]))); } else { return bounds.clone(); } }  static String buildBaseURI(UriInfo uriInfo, HttpHeaders headers); static String buildURI(String baseUri, MultivaluedMap<String, String> params); static MultivaluedMap<String, String> replaceParam(String name, String value, MultivaluedMap<String, String> params); static MultivaluedMap<String, String> replaceParam(String name, List<String> values,
    MultivaluedMap<String, String> params); static MrsImageDataProvider[] getPyramidFilesList(
    ProviderProperties providerProperties); static Bounds reprojectBounds(Bounds bounds, String srs); static Bounds reprojectBoundsToWGS84(Bounds bounds, String srs);  }