use of org.opengis.referencing.crs.ProjectedCRS in project sis by apache.
the class CommonCRSTest method testUTM.
/**
* Tests {@link CommonCRS#universal(double, double)} with Universal Transverse Mercator (UTM) projections.
*
* @since 0.7
*/
@Test
@DependsOnMethod("testGeographic")
public void testUTM() {
final ProjectedCRS crs = CommonCRS.WGS72.universal(-45, -122);
assertEquals("name", "WGS 72 / UTM zone 10S", crs.getName().getCode());
final ParameterValueGroup pg = crs.getConversionFromBase().getParameterValues();
assertEquals(Constants.LATITUDE_OF_ORIGIN, 0, pg.parameter(Constants.LATITUDE_OF_ORIGIN).doubleValue(), STRICT);
assertEquals(Constants.CENTRAL_MERIDIAN, -123, pg.parameter(Constants.CENTRAL_MERIDIAN).doubleValue(), STRICT);
assertEquals(Constants.SCALE_FACTOR, 0.9996, pg.parameter(Constants.SCALE_FACTOR).doubleValue(), STRICT);
assertEquals(Constants.FALSE_EASTING, 500000, pg.parameter(Constants.FALSE_EASTING).doubleValue(), STRICT);
assertEquals(Constants.FALSE_NORTHING, 10000000, pg.parameter(Constants.FALSE_NORTHING).doubleValue(), STRICT);
assertSame("Expected a cached instance.", crs, CommonCRS.WGS72.universal(-45, -122));
assertNotSame("Expected a new instance.", crs, CommonCRS.WGS72.universal(+45, -122));
}
use of org.opengis.referencing.crs.ProjectedCRS in project sis by apache.
the class CommonCRSTest method testUPS.
/**
* Tests {@link CommonCRS#universal(double, double)} with Universal Polar Stereographic (UPS) projections.
*
* @since 0.8
*/
@Test
@DependsOnMethod("testGeographic")
public void testUPS() {
final ProjectedCRS crs = CommonCRS.WGS72.universal(-85, -122);
assertEquals("name", "WGS 72 / Universal Polar Stereographic South", crs.getName().getCode());
final ParameterValueGroup pg = crs.getConversionFromBase().getParameterValues();
assertEquals(Constants.LATITUDE_OF_ORIGIN, -90, pg.parameter(Constants.LATITUDE_OF_ORIGIN).doubleValue(), STRICT);
assertEquals(Constants.CENTRAL_MERIDIAN, 0, pg.parameter(Constants.CENTRAL_MERIDIAN).doubleValue(), STRICT);
assertEquals(Constants.SCALE_FACTOR, 0.994, pg.parameter(Constants.SCALE_FACTOR).doubleValue(), STRICT);
assertEquals(Constants.FALSE_EASTING, 2000000, pg.parameter(Constants.FALSE_EASTING).doubleValue(), STRICT);
assertEquals(Constants.FALSE_NORTHING, 2000000, pg.parameter(Constants.FALSE_NORTHING).doubleValue(), STRICT);
assertSame("Expected a cached instance.", crs, CommonCRS.WGS72.universal(-85, -122));
assertNotSame("Expected a new instance.", crs, CommonCRS.WGS72.universal(+85, -122));
}
use of org.opengis.referencing.crs.ProjectedCRS in project sis by apache.
the class StandardDefinitionsTest method testCreateUPS.
/**
* Tests {@link StandardDefinitions#createUniversal(int, GeographicCRS, boolean, double, double, CartesianCS)}
* for a Universal Polar Stereographic (UPS) projection. This test cheats a little bit on the coordinate system
* by laziness; we are more interested in the projection parameters.
*
* @since 0.8
*/
@Test
@DependsOnMethod("testCreateGeographicCRS")
public void testCreateUPS() {
final ProjectedCRS crs = StandardDefinitions.createUniversal(5041, HardCodedCRS.WGS84, false, 90, -122, HardCodedCS.PROJECTED);
assertEquals("name", "WGS 84 / Universal Polar Stereographic North", crs.getName().getCode());
final ParameterValueGroup pg = crs.getConversionFromBase().getParameterValues();
assertEquals(Constants.LATITUDE_OF_ORIGIN, 90, pg.parameter(Constants.LATITUDE_OF_ORIGIN).doubleValue(), STRICT);
assertEquals(Constants.CENTRAL_MERIDIAN, 0, pg.parameter(Constants.CENTRAL_MERIDIAN).doubleValue(), STRICT);
assertEquals(Constants.SCALE_FACTOR, 0.994, pg.parameter(Constants.SCALE_FACTOR).doubleValue(), STRICT);
assertEquals(Constants.FALSE_EASTING, 2000000, pg.parameter(Constants.FALSE_EASTING).doubleValue(), STRICT);
assertEquals(Constants.FALSE_NORTHING, 2000000, pg.parameter(Constants.FALSE_NORTHING).doubleValue(), STRICT);
}
use of org.opengis.referencing.crs.ProjectedCRS in project sis by apache.
the class StandardDefinitionsTest method testCreateUTM.
/**
* Tests {@link StandardDefinitions#createUniversal(int, GeographicCRS, boolean, double, double, CartesianCS)}
* for a Universal Transverse Mercator (UTM) projection.
*
* @since 0.7
*/
@Test
@DependsOnMethod("testCreateGeographicCRS")
public void testCreateUTM() {
final ProjectedCRS crs = StandardDefinitions.createUniversal(32610, HardCodedCRS.WGS84, true, 15, -122, HardCodedCS.PROJECTED);
assertEquals("name", "WGS 84 / UTM zone 10N", crs.getName().getCode());
final ParameterValueGroup pg = crs.getConversionFromBase().getParameterValues();
assertEquals(Constants.LATITUDE_OF_ORIGIN, 0, pg.parameter(Constants.LATITUDE_OF_ORIGIN).doubleValue(), STRICT);
assertEquals(Constants.CENTRAL_MERIDIAN, -123, pg.parameter(Constants.CENTRAL_MERIDIAN).doubleValue(), STRICT);
assertEquals(Constants.SCALE_FACTOR, 0.9996, pg.parameter(Constants.SCALE_FACTOR).doubleValue(), STRICT);
assertEquals(Constants.FALSE_EASTING, 500000, pg.parameter(Constants.FALSE_EASTING).doubleValue(), STRICT);
assertEquals(Constants.FALSE_NORTHING, 0, pg.parameter(Constants.FALSE_NORTHING).doubleValue(), STRICT);
}
use of org.opengis.referencing.crs.ProjectedCRS in project sis by apache.
the class TransformTestCase method testTransformOverAntiMeridian.
/**
* Tests transform of an envelope over the ±180° limit. The Mercator projection used in this test
* is not expected to wrap the longitude around Earth when using only the {@code MathTransform}.
* However when the target CRS is known, then "wrap around" should be applied.
*
* @throws TransformException if an error occurred while transforming the envelope.
*
* @since 0.8
*/
@Test
@DependsOnMethod("testTransform")
public final void testTransformOverAntiMeridian() throws TransformException {
final ProjectedCRS sourceCRS = HardCodedConversions.mercator();
final GeographicCRS targetCRS = sourceCRS.getBaseCRS();
final Conversion conversion = inverse(sourceCRS.getConversionFromBase());
final G expected = createFromExtremums(targetCRS, 179, 40, 181, 50);
final G rectangle = createFromExtremums(sourceCRS, // Computed by SIS (not validated by external authority).
19926188.852, // Computed by SIS (not validated by external authority).
4838471.398, 20148827.834, 6413524.594);
final G actual = transform(conversion, rectangle);
assertGeometryEquals(expected, actual, ANGULAR_TOLERANCE, ANGULAR_TOLERANCE);
}
Aggregations