use of org.apache.sis.parameter.Parameters in project sis by apache.
the class GeocentricTranslationTest method createDatumShiftForGeographic2D.
/**
* Creates a "Geographic 2D to 3D → Geocentric → Affine → Geographic → Geographic 3D to 2D" chain
* using EPSG or OGC standard operation methods and parameters. This is used for integration tests.
*
* @param factory the math transform factory to use for creating and concatenating the transform.
* @return the chain of transforms.
* @throws FactoryException if an error occurred while creating a transform.
*/
public static MathTransform createDatumShiftForGeographic2D(final MathTransformFactory factory) throws FactoryException {
final Parameters values = Parameters.castOrWrap(factory.getDefaultParameters("Geocentric translations (geog2D domain)"));
setTranslation(values);
setEllipsoids(values, CommonCRS.WGS84.ellipsoid(), CommonCRS.ED50.ellipsoid());
final MathTransform gt = new GeocentricTranslation().createMathTransform(factory, values);
assertFalse("isIdentity", gt.isIdentity());
assertEquals("sourceDimensions", 3, gt.getSourceDimensions());
assertEquals("targetDimensions", 3, gt.getTargetDimensions());
assertInstanceOf("Geocentric translation", LinearTransform.class, gt);
return Geographic3Dto2DTest.createDatumShiftForGeographic2D(factory, gt, values);
}
use of org.apache.sis.parameter.Parameters in project sis by apache.
the class LambertConicConformalTest method createNormalizedProjection.
/**
* Creates a new instance of {@link LambertConicConformal}. See the class javadoc for an explanation
* about why we ask only for the latitude of origin and not the standard parallels.
*
* @param ellipse {@code false} for a sphere, or {@code true} for WGS84 ellipsoid.
* @param latitudeOfOrigin the latitude of origin, in decimal degrees.
*/
private void createNormalizedProjection(final boolean ellipse, final double latitudeOfOrigin) {
final LambertConformal1SP method = new LambertConformal1SP();
final Parameters parameters = parameters(method, ellipse);
parameters.getOrCreate(LambertConformal1SP.LATITUDE_OF_ORIGIN).setValue(latitudeOfOrigin);
transform = new LambertConicConformal(method, parameters);
if (!ellipse) {
transform = new LambertConicConformal.Spherical((LambertConicConformal) transform);
}
tolerance = NORMALIZED_TOLERANCE;
validate();
}
use of org.apache.sis.parameter.Parameters in project sis by apache.
the class MapProjectionTestCase method createCompleteProjection.
/**
* Initializes a complete projection (including conversion from degrees to radians) for the given provider.
*/
final void createCompleteProjection(final DefaultOperationMethod provider, final double semiMajor, final double semiMinor, final double centralMeridian, final double latitudeOfOrigin, final double standardParallel1, final double standardParallel2, final double scaleFactor, final double falseEasting, final double falseNorthing) throws FactoryException {
final Parameters values = Parameters.castOrWrap(provider.getParameters().createValue());
values.parameter(Constants.SEMI_MAJOR).setValue(semiMajor);
values.parameter(Constants.SEMI_MINOR).setValue(semiMinor);
if (semiMajor == WGS84_A && semiMinor == WGS84_B) {
values.parameter(Constants.INVERSE_FLATTENING).setValue(298.257223563);
}
if (!isNaN(centralMeridian))
values.parameter(Constants.CENTRAL_MERIDIAN).setValue(centralMeridian);
if (!isNaN(latitudeOfOrigin))
values.parameter(Constants.LATITUDE_OF_ORIGIN).setValue(latitudeOfOrigin);
if (!isNaN(standardParallel1))
values.parameter(Constants.STANDARD_PARALLEL_1).setValue(standardParallel1);
if (!isNaN(standardParallel2))
values.parameter(Constants.STANDARD_PARALLEL_2).setValue(standardParallel2);
if (!isNaN(scaleFactor))
values.parameter(Constants.SCALE_FACTOR).setValue(scaleFactor);
if (!isNaN(falseEasting))
values.parameter(Constants.FALSE_EASTING).setValue(falseEasting);
if (!isNaN(falseNorthing))
values.parameter(Constants.FALSE_NORTHING).setValue(falseNorthing);
transform = new MathTransformFactoryMock(provider).createParameterizedTransform(values);
validate();
}
use of org.apache.sis.parameter.Parameters in project sis by apache.
the class PolarStereographicTest method testPolarStereographicNorth.
/**
* Tests <cite>"Stereographic North Pole"</cite>. The tested point is adapted from
* <a href="http://www.remotesensing.org/geotiff/proj_list/polar_stereographic.html">Polar Stereographic
* on remotesensing.org</a>.
*
* @throws FactoryException if an error occurred while creating the map projection.
* @throws TransformException if an error occurred while projecting a coordinate.
*/
@Test
public void testPolarStereographicNorth() throws FactoryException, TransformException {
final PolarStereographicNorth method = new PolarStereographicNorth();
final Parameters pg = parameters(method, true);
pg.parameter("standard_parallel_1").setValue(71.0);
pg.parameter("central_meridian").setValue(-96.0);
transform = new MathTransformFactoryMock(method).createParameterizedTransform(pg);
tolerance = 0.02;
verifyTransform(new double[] { // 121°20'22.380"W
-121 - (20 + 22.380 / 60) / 60, // 39°06'04.508"N
39 + (6 + 4.508 / 60) / 60 }, new double[] { -2529570, -5341800 });
}
use of org.apache.sis.parameter.Parameters in project sis by apache.
the class TransverseMercatorTest method createNormalizedProjection.
/**
* Creates a new instance of {@link TransverseMercator}.
*
* @param ellipse {@code false} for a sphere, or {@code true} for WGS84 ellipsoid.
*/
private void createNormalizedProjection(final boolean ellipse, final double latitudeOfOrigin) {
final org.apache.sis.internal.referencing.provider.TransverseMercator method = new org.apache.sis.internal.referencing.provider.TransverseMercator();
final Parameters parameters = parameters(method, ellipse);
parameters.getOrCreate(org.apache.sis.internal.referencing.provider.TransverseMercator.LATITUDE_OF_ORIGIN).setValue(latitudeOfOrigin);
transform = new TransverseMercator(method, parameters);
tolerance = NORMALIZED_TOLERANCE;
validate();
}
Aggregations