use of org.apache.sis.test.DependsOnMethod in project sis by apache.
the class GeodeticObjectParserTest method testProjectedWithFeetUnits.
/**
* Tests the parsing of a projected CRS with feet units.
*
* @throws ParseException if the parsing failed.
*/
@Test
@DependsOnMethod("testProjectedCRS")
public void testProjectedWithFeetUnits() throws ParseException {
final ProjectedCRS crs = parse(ProjectedCRS.class, "PROJCS[“TransverseMercator”,\n" + " GEOGCS[“Sphere”,\n" + " DATUM[“Sphere”,\n" + " SPHEROID[“Sphere”, 6370997.0, 0.0],\n" + " TOWGS84[0, 0, 0, 0, 0, 0, 0]],\n" + " PRIMEM[“Greenwich”, 0.0],\n" + " UNIT[“degree”, 0.017453292519943295],\n" + " AXIS[“Longitude”, EAST],\n" + " AXIS[“Latitude”, NORTH]],\n" + " PROJECTION[“Transverse_Mercator”,\n" + " AUTHORITY[“OGC”, “Transverse_Mercator”]],\n" + " PARAMETER[“central_meridian”, 170.0],\n" + " PARAMETER[“latitude_of_origin”, 50.0],\n" + " PARAMETER[“scale_factor”, 0.95],\n" + " PARAMETER[“false_easting”, 0.0],\n" + " PARAMETER[“false_northing”, 0.0],\n" + " UNIT[“US survey foot”, 0.304800609601219],\n" + " AXIS[“E”, EAST],\n" + " AXIS[“N”, NORTH]]");
assertNameAndIdentifierEqual("TransverseMercator", 0, crs);
assertNameAndIdentifierEqual("Sphere", 0, crs.getBaseCRS());
assertNameAndIdentifierEqual("Sphere", 0, crs.getDatum());
verifyProjectedCS(crs.getCoordinateSystem(), Units.US_SURVEY_FOOT);
final ParameterValueGroup param = crs.getConversionFromBase().getParameterValues();
assertEquals("Transverse Mercator", crs.getConversionFromBase().getMethod().getName().getCode());
assertEquals("semi_major", 6370997.0, param.parameter("semi_major").doubleValue(), 1E-5);
assertEquals("semi_minor", 6370997.0, param.parameter("semi_minor").doubleValue(), 1E-5);
assertEquals("latitude_of_origin", 50.0, param.parameter("latitude_of_origin").doubleValue(), 1E-8);
assertEquals("central_meridian", 170.0, param.parameter("central_meridian").doubleValue(), 1E-8);
assertEquals("scale_factor", 0.95, param.parameter("scale_factor").doubleValue(), 1E-8);
assertEquals("false_easting", 0.0, param.parameter("false_easting").doubleValue(), 1E-8);
assertEquals("false_northing", 0.0, param.parameter("false_northing").doubleValue(), 1E-8);
}
use of org.apache.sis.test.DependsOnMethod in project sis by apache.
the class GeodeticObjectParserTest method testGeographicWithImplicitAxesInSeconds.
/**
* Tests parsing geographic CRS with implicit axes in seconds instead of degrees.
*
* @throws ParseException if the parsing failed.
*
* @see #testGeographicWithImplicitAxes()
*/
@Test
@DependsOnMethod("testGeographicWithImplicitAxes")
public void testGeographicWithImplicitAxesInSeconds() throws ParseException {
final GeographicCRS crs = parse(GeographicCRS.class, "GEOGCS[“NAD83 / NFIS Seconds”," + "DATUM[“North_American_Datum_1983”,\n" + "SPHEROID[“GRS 1980”, 6378137, 298.257222101]],\n" + "PRIMEM[“Greenwich”, 0],\n" + "UNIT[“Decimal_Second”, 4.84813681109536e-06],\n" + "AUTHORITY[“EPSG”, “100001”]]");
assertNameAndIdentifierEqual("NAD83 / NFIS Seconds", 100001, crs);
final GeodeticDatum datum = crs.getDatum();
assertNameAndIdentifierEqual("North_American_Datum_1983", 0, datum);
assertNameAndIdentifierEqual("Greenwich", 0, datum.getPrimeMeridian());
final Ellipsoid ellipsoid = datum.getEllipsoid();
assertNameAndIdentifierEqual("GRS 1980", 0, ellipsoid);
assertEquals("semiMajor", 6378137, ellipsoid.getSemiMajorAxis(), STRICT);
assertEquals("inverseFlattening", 298.257222101, ellipsoid.getInverseFlattening(), STRICT);
final EllipsoidalCS cs = crs.getCoordinateSystem();
final double secondsIn90 = 90 * 60 * 60;
CoordinateSystemAxis axis = cs.getAxis(0);
assertEquals("name", AxisNames.GEODETIC_LONGITUDE, axis.getName().getCode());
assertEquals("abbreviation", "λ", axis.getAbbreviation());
assertEquals("direction", AxisDirection.EAST, axis.getDirection());
assertEquals("minimumValue", -secondsIn90 * 2, axis.getMinimumValue(), 1E-9);
assertEquals("maximumValue", +secondsIn90 * 2, axis.getMaximumValue(), 1E-9);
axis = cs.getAxis(1);
assertEquals("name", AxisNames.GEODETIC_LATITUDE, axis.getName().getCode());
assertEquals("abbreviation", "φ", axis.getAbbreviation());
assertEquals("direction", AxisDirection.NORTH, axis.getDirection());
assertEquals("minimumValue", -secondsIn90, axis.getMinimumValue(), 1E-9);
assertEquals("maximumValue", +secondsIn90, axis.getMaximumValue(), 1E-9);
}
use of org.apache.sis.test.DependsOnMethod in project sis by apache.
the class GeodeticObjectParserTest method testGeocentricCRS.
/**
* Tests the parsing of a geocentric CRS from a WKT 1 string. The parser
* shall replace the OGC 01-009 axis directions (OTHER, EAST, NORTH) by
* ISO 19111 axis directions (Geocentric X, Geocentric Y, Geocentric Z).
*
* @throws ParseException if the parsing failed.
*/
@Test
@DependsOnMethod({ "testAxis", "testDatum" })
public void testGeocentricCRS() throws ParseException {
final GeocentricCRS crs = parse(GeocentricCRS.class, "GEOCCS[“Geocentric”,\n" + " DATUM[“World Geodetic System 1984”,\n" + " SPHEROID[“WGS84”, 6378137.0, 298.257223563, AUTHORITY[“EPSG”, “7030”]],\n" + " AUTHORITY[“EPSG”, “6326”]],\n" + " PRIMEM[“Greenwich”, 0.0, AUTHORITY[“EPSG”, “8901”]],\n" + " UNIT[“metre”, 1.0],\n" + " AXIS[“X”, OTHER],\n" + " AXIS[“Y”, EAST],\n" + " AXIS[“Z”, NORTH]]");
assertNameAndIdentifierEqual("Geocentric", 0, crs);
final GeodeticDatum datum = crs.getDatum();
assertNameAndIdentifierEqual("World Geodetic System 1984", 6326, datum);
assertNameAndIdentifierEqual("Greenwich", 8901, datum.getPrimeMeridian());
final Ellipsoid ellipsoid = datum.getEllipsoid();
assertNameAndIdentifierEqual("WGS84", 7030, ellipsoid);
assertEquals("semiMajor", 6378137, ellipsoid.getSemiMajorAxis(), STRICT);
assertEquals("inverseFlattening", 298.257223563, ellipsoid.getInverseFlattening(), STRICT);
// Verify that the OGC 01-009 axes have been relaced by ISO 19111 axes.
final CartesianCS cs = (CartesianCS) crs.getCoordinateSystem();
assertEquals("dimension", 3, cs.getDimension());
assertUnboundedAxisEquals(AxisNames.GEOCENTRIC_X, "X", AxisDirection.GEOCENTRIC_X, Units.METRE, cs.getAxis(0));
assertUnboundedAxisEquals(AxisNames.GEOCENTRIC_Y, "Y", AxisDirection.GEOCENTRIC_Y, Units.METRE, cs.getAxis(1));
assertUnboundedAxisEquals(AxisNames.GEOCENTRIC_Z, "Z", AxisDirection.GEOCENTRIC_Z, Units.METRE, cs.getAxis(2));
}
use of org.apache.sis.test.DependsOnMethod in project sis by apache.
the class GeodeticObjectParserTest method testCompoundCRS.
/**
* Tests the parsing of a compound CRS from a WKT 1 string, except the time dimension which is WKT 2.
*
* @throws ParseException if the parsing failed.
*/
@Test
@DependsOnMethod("testGeographicCRS")
public void testCompoundCRS() throws ParseException {
final CompoundCRS crs = parse(CompoundCRS.class, "COMPD_CS[“WGS 84 + height + time”,\n" + " GEOGCS[“WGS 84”,\n" + " DATUM[“World Geodetic System 1984”,\n" + " SPHEROID[“WGS84”, 6378137.0, 298.257223563]],\n" + " PRIMEM[“Greenwich”, 0.0],\n" + " UNIT[“degree”, 0.017453292519943295],\n" + " AXIS[“Longitude”, EAST],\n" + " AXIS[“Latitude”, NORTH]],\n" + " VERT_CS[“Gravity-related height”,\n" + " VERT_DATUM[“Mean Sea Level”, 2005],\n" + " UNIT[“metre”, 1],\n" + " AXIS[“Gravity-related height”, UP]],\n" + // WKT 2
" TimeCRS[“Time”,\n" + " TimeDatum[“Modified Julian”, TimeOrigin[1858-11-17T00:00:00.0Z]],\n" + " Unit[“day”, 86400],\n" + " Axis[“Time”, FUTURE]]]");
// CompoundCRS parent
assertNameAndIdentifierEqual("WGS 84 + height + time", 0, crs);
final Iterator<CoordinateReferenceSystem> components = crs.getComponents().iterator();
// GeographicCRS child
verifyGeographicCRS(0, (GeographicCRS) components.next());
// VerticalCRS child
final VerticalCRS vertCRS = (VerticalCRS) components.next();
assertNameAndIdentifierEqual("Gravity-related height", 0, vertCRS);
assertNameAndIdentifierEqual("Mean Sea Level", 0, vertCRS.getDatum());
// TemporalCRS child
final TemporalCRS timeCRS = (TemporalCRS) components.next();
final TemporalDatum timeDatum = timeCRS.getDatum();
assertNameAndIdentifierEqual("Time", 0, timeCRS);
assertNameAndIdentifierEqual("Modified Julian", 0, timeDatum);
assertEquals("epoch", new Date(-40587L * MILLISECONDS_PER_DAY), timeDatum.getOrigin());
// No more CRS.
assertFalse(components.hasNext());
// Axes: we verify only the CompoundCRS ones, which should include all others.
final CoordinateSystem cs = crs.getCoordinateSystem();
assertEquals("dimension", 4, cs.getDimension());
assertLongitudeAxisEquals(cs.getAxis(0));
assertLatitudeAxisEquals(cs.getAxis(1));
assertUnboundedAxisEquals("Gravity-related height", "H", AxisDirection.UP, Units.METRE, cs.getAxis(2));
assertUnboundedAxisEquals("Time", "t", AxisDirection.FUTURE, Units.DAY, cs.getAxis(3));
}
use of org.apache.sis.test.DependsOnMethod in project sis by apache.
the class GeodeticObjectParserTest method testProjectedWithID.
/**
* Tests the parsing of a projected CRS from a WKT 1 string with authority and Bursa-Wolf parameters.
*
* @throws ParseException if the parsing failed.
*/
@Test
@DependsOnMethod("testProjectedCRS")
public void testProjectedWithID() throws ParseException {
final ProjectedCRS crs = parse(ProjectedCRS.class, "PROJCS[“OSGB 1936 / British National Grid”,\n" + " GEOGCS[“OSGB 1936”,\n" + " DATUM[“OSGB_1936”,\n" + " SPHEROID[“Airy 1830”, 6377563.396, 299.3249646, AUTHORITY[“EPSG”, “7001”]],\n" + " TOWGS84[375.0, -111.0, 431.0, 0.0, 0.0, 0.0, 0.0],\n" + " AUTHORITY[“EPSG”, “6277”]],\n" + " PRIMEM[“Greenwich”,0.0, AUTHORITY[“EPSG”, “8901”]],\n" + " UNIT[“DMSH”,0.0174532925199433],\n" + " AXIS[“Lat”,NORTH],AXIS[“Long”,EAST], AUTHORITY[“EPSG”, “4277”]],\n" + " PROJECTION[“Transverse_Mercator”],\n" + " PARAMETER[“latitude_of_origin”, 49.0],\n" + " PARAMETER[“central_meridian”, -2.0],\n" + " PARAMETER[“scale_factor”, 0.999601272],\n" + " PARAMETER[“false_easting”, 400000.0],\n" + " PARAMETER[“false_northing”, -100000.0],\n" + " UNIT[“metre”, 1.0, AUTHORITY[“EPSG”, “9001”]],\n" + " AXIS[“E”,EAST],\n" + " AXIS[“N”,NORTH],\n" + " AUTHORITY[“EPSG”, “27700”]]");
assertNameAndIdentifierEqual("OSGB 1936 / British National Grid", 27700, crs);
assertNameAndIdentifierEqual("OSGB 1936", 4277, crs.getBaseCRS());
assertNameAndIdentifierEqual("OSGB_1936", 6277, crs.getDatum());
verifyProjectedCS(crs.getCoordinateSystem(), Units.METRE);
final ParameterValueGroup param = crs.getConversionFromBase().getParameterValues();
assertEquals("Transverse Mercator", crs.getConversionFromBase().getMethod().getName().getCode());
assertEquals("semi_major", 6377563.396, param.parameter("semi_major").doubleValue(), 1E-4);
assertEquals("semi_minor", 6356256.909, param.parameter("semi_minor").doubleValue(), 1E-3);
assertEquals("latitude_of_origin", 49.0, param.parameter("latitude_of_origin").doubleValue(), 1E-8);
assertEquals("central_meridian", -2.0, param.parameter("central_meridian").doubleValue(), 1E-8);
assertEquals("scale_factor", 0.9996, param.parameter("scale_factor").doubleValue(), 1E-5);
assertEquals("false_easting", 400000.0, param.parameter("false_easting").doubleValue(), 1E-4);
assertEquals("false_northing", -100000.0, param.parameter("false_northing").doubleValue(), 1E-4);
final BursaWolfParameters[] bwp = ((DefaultGeodeticDatum) crs.getDatum()).getBursaWolfParameters();
assertEquals("BursaWolfParameters", 1, bwp.length);
assertArrayEquals("BursaWolfParameters", new double[] { 375, -111, 431 }, bwp[0].getValues(), STRICT);
}
Aggregations