/** * Tests the <cite>Polar Stereographic (variant A)</cite> case (EPSG:9810). * This test is defined in GeoAPI conformance test suite. * * @throws FactoryException if an error occurred while creating the map projection. * @throws TransformException if an error occurred while projecting a coordinate. */ @Test public void testPolarStereographicA() throws FactoryException, TransformException { new PolarStereographicA(); // Test creation only, as GeoAPI 3.0 did not yet had the test method. }
setConversionName(PolarStereographicA.setParameters(parameters, north)); return this;
crsZone = ZONER.zone(projection.getParameterValues()); } else if (IdentifiedObjects.isHeuristicMatchForName(method, PolarStereographicA.NAME)) { crsZone = POLE * PolarStereographicA.isUPS(projection.getParameterValues()); } else { crsZone = 0; // Neither UTM or UPS projection.
setConversionName(PolarStereographicA.setParameters(parameters, north)); return this;
/** * Verifies the consistency of elliptical formulas with the spherical formulas. * This test compares the results of elliptical formulas with the spherical ones * for some random points. * * @throws FactoryException if an error occurred while creating the map projection. * @throws TransformException if an error occurred while projecting a coordinate. */ private void compareEllipticalWithSpherical(final CoordinateDomain domain, final double latitudeOfOrigin, final long randomSeed) throws FactoryException, TransformException { createCompleteProjection(new PolarStereographicA(), 6371007, // Semi-major axis length 6371007, // Semi-minor axis length 0.5, // Central meridian latitudeOfOrigin, // Latitude of origin NaN, // Standard parallel 1 (none) NaN, // Standard parallel 2 (none) 0.994, // Scale factor 200, // False easting 100); // False northing tolerance = Formulas.LINEAR_TOLERANCE; compareEllipticalWithSpherical(domain, randomSeed); }
/** * Creates a Universal Transverse Mercator (UTM) or a Universal Polar Stereographic (UPS) projected CRS * using the Apache SIS factory implementation. This method restricts the factory to SIS implementation * instead than arbitrary factory in order to meet the contract saying that {@link CommonCRS} methods * should never fail. * * @param code the EPSG code, or 0 if none. * @param baseCRS the geographic CRS on which the projected CRS is based. * @param isUTM {@code true} for UTM or {@code false} for UPS. Note: redundant with the given latitude. * @param latitude a latitude in the zone of the desired projection, to be snapped to 0°, 90°S or 90°N. * @param longitude a longitude in the zone of the desired projection, to be snapped to UTM central meridian. * @param derivedCS the projected coordinate system. */ static ProjectedCRS createUniversal(final int code, final GeographicCRS baseCRS, final boolean isUTM, final double latitude, final double longitude, final CartesianCS derivedCS) { final OperationMethod method; try { method = DefaultFactories.forBuildin(MathTransformFactory.class, DefaultMathTransformFactory.class) .getOperationMethod(isUTM ? TransverseMercator.NAME : PolarStereographicA.NAME); } catch (NoSuchIdentifierException e) { throw new IllegalStateException(e); // Should not happen with SIS implementation. } final ParameterValueGroup parameters = method.getParameters().createValue(); String name = isUTM ? TransverseMercator.Zoner.UTM.setParameters(parameters, latitude, longitude) : PolarStereographicA.setParameters(parameters, latitude >= 0); final DefaultConversion conversion = new DefaultConversion(properties(0, name, null, false), method, null, parameters); name = baseCRS.getName().getCode() + " / " + name; return new DefaultProjectedCRS(properties(code, name, null, false), baseCRS, conversion, derivedCS); }
/** * Creates a Universal Transverse Mercator (UTM) or a Universal Polar Stereographic (UPS) projected CRS * using the Apache SIS factory implementation. This method restricts the factory to SIS implementation * instead than arbitrary factory in order to met the contract saying that {@link CommonCRS} methods * should never fail. * * @param code the EPSG code, or 0 if none. * @param baseCRS the geographic CRS on which the projected CRS is based. * @param isUTM {@code true} for UTM or {@code false} for UPS. Note: redundant with the given latitude. * @param latitude a latitude in the zone of the desired projection, to be snapped to 0°, 90°S or 90°N. * @param longitude a longitude in the zone of the desired projection, to be snapped to UTM central meridian. * @param derivedCS the projected coordinate system. */ static ProjectedCRS createUniversal(final int code, final GeographicCRS baseCRS, final boolean isUTM, final double latitude, final double longitude, final CartesianCS derivedCS) { final OperationMethod method; try { method = DefaultFactories.forBuildin(MathTransformFactory.class, DefaultMathTransformFactory.class) .getOperationMethod(isUTM ? TransverseMercator.NAME : PolarStereographicA.NAME); } catch (NoSuchIdentifierException e) { throw new IllegalStateException(e); // Should not happen with SIS implementation. } final ParameterValueGroup parameters = method.getParameters().createValue(); String name = isUTM ? TransverseMercator.Zoner.UTM.setParameters(parameters, latitude, longitude) : PolarStereographicA.setParameters(parameters, latitude >= 0); final DefaultConversion conversion = new DefaultConversion(properties(0, name, null, false), method, null, parameters); name = baseCRS.getName().getCode() + " / " + name; return new DefaultProjectedCRS(properties(code, name, null, false), baseCRS, conversion, derivedCS); }