Search in sources :

Example 21 with Parameters

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);
}
Also used : Parameters(org.apache.sis.parameter.Parameters) MathTransform(org.opengis.referencing.operation.MathTransform)

Example 22 with Parameters

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();
}
Also used : Parameters(org.apache.sis.parameter.Parameters) LambertConformal1SP(org.apache.sis.internal.referencing.provider.LambertConformal1SP)

Example 23 with Parameters

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();
}
Also used : Parameters(org.apache.sis.parameter.Parameters) MathTransformFactoryMock(org.apache.sis.referencing.operation.transform.MathTransformFactoryMock)

Example 24 with Parameters

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 });
}
Also used : Parameters(org.apache.sis.parameter.Parameters) PolarStereographicNorth(org.apache.sis.internal.referencing.provider.PolarStereographicNorth) MathTransformFactoryMock(org.apache.sis.referencing.operation.transform.MathTransformFactoryMock) Test(org.junit.Test)

Example 25 with Parameters

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();
}
Also used : Parameters(org.apache.sis.parameter.Parameters)

Aggregations

Parameters (org.apache.sis.parameter.Parameters)26 MathTransform (org.opengis.referencing.operation.MathTransform)5 BursaWolfParameters (org.apache.sis.referencing.datum.BursaWolfParameters)4 MathTransformFactoryMock (org.apache.sis.referencing.operation.transform.MathTransformFactoryMock)4 NoninvertibleTransformException (org.opengis.referencing.operation.NoninvertibleTransformException)3 FactoryException (org.opengis.util.FactoryException)3 MatrixSIS (org.apache.sis.referencing.operation.matrix.MatrixSIS)2 ContextualParameters (org.apache.sis.referencing.operation.transform.ContextualParameters)2 StorageConnector (org.apache.sis.storage.StorageConnector)2 Debug (org.apache.sis.util.Debug)2 ParameterValueGroup (org.opengis.parameter.ParameterValueGroup)2 AffineTransform (java.awt.geom.AffineTransform)1 Path (java.nio.file.Path)1 StandardOpenOption (java.nio.file.StandardOpenOption)1 Angle (javax.measure.quantity.Angle)1 Length (javax.measure.quantity.Length)1 ParameterizedAffine (org.apache.sis.internal.referencing.j2d.ParameterizedAffine)1 Equirectangular (org.apache.sis.internal.referencing.provider.Equirectangular)1 LambertConformal1SP (org.apache.sis.internal.referencing.provider.LambertConformal1SP)1 PolarStereographicNorth (org.apache.sis.internal.referencing.provider.PolarStereographicNorth)1