/** * Tests the creation of the {@code "+init=epsg:3395"} projected CRS. * * @throws FactoryException if an error occurred while creating the CRS objects. */ @Test public void test3395() throws FactoryException { final Proj4Factory factory = Proj4Factory.INSTANCE; final ProjectedCRS crs = factory.createProjectedCRS("+init=epsg:3395"); final PJ pj = (PJ) TestUtilities.getSingleton(crs.getIdentifiers()); assertEquals(PJ.Type.PROJECTED, pj.getType()); final String definition = pj.getCode(); assertTrue(definition, definition.contains("+proj=merc")); assertTrue(definition, definition.contains("+datum=WGS84")); assertAxisDirectionsEqual(definition, crs.getCoordinateSystem(), AxisDirection.EAST, AxisDirection.NORTH); }
/** * Tests {@link CommonAuthorityFactory#createProjectedCRS(String)} with the same {@code "AUTO:42001"} code * than {@link #testAuto42001()} except that axes are feet. * * @throws FactoryException if an error occurred while creating a CRS. */ @Test @DependsOnMethod("testAuto42001") public void testAuto42001_foot() throws FactoryException { final ProjectedCRS crs = factory.createProjectedCRS("AUTO2:42001, 0.3048, -123, 0"); assertSame("Legacy namespace.", crs, factory.createProjectedCRS("AUTO:42001,9002,-123,0")); assertEquals("name", "WGS 84 / UTM zone 10N", crs.getName().getCode()); assertTrue("Expected no EPSG identifier because the axes are not in metres.", crs.getIdentifiers().isEmpty()); assertEquals("axis[0].unit", Units.FOOT, crs.getCoordinateSystem().getAxis(0).getUnit()); }
assertContainsCode("ProjectedCRS.getIdentifiers()", "EPSG", code, crs.getIdentifiers());
assertNull("Identifier shall not have a version.", getSingleton(crs.getIdentifiers()).getVersion());
/** * Tests {@link CommonAuthorityFactory#createProjectedCRS(String)} with the {@code "AUTO:42002"} code. * * @throws FactoryException if an error occurred while creating a CRS. */ @Test @DependsOnMethod("testAuto42001") public void testAuto42002() throws FactoryException { final ProjectedCRS crs = factory.createProjectedCRS("AUTO:42002,-122,10"); assertSame("Omitting namespace.", crs, factory.createProjectedCRS(" 42002, -122 , 10 ")); assertSame("With explicit unit.", crs, factory.createProjectedCRS("AUTO2 : 42002, 1, -122 , 10 ")); assertEquals("name", "Transverse Mercator", crs.getName().getCode()); assertTrue("Expected no EPSG identifier.", crs.getIdentifiers().isEmpty()); final ParameterValueGroup p = crs.getConversionFromBase().getParameterValues(); assertEquals(TransverseMercator.NAME, crs.getConversionFromBase().getMethod().getName().getCode()); assertAxisDirectionsEqual("CS", crs.getCoordinateSystem(), AxisDirection.EAST, AxisDirection.NORTH); assertEquals(Constants.CENTRAL_MERIDIAN, -122, p.parameter(Constants.CENTRAL_MERIDIAN) .doubleValue(), STRICT); assertEquals(Constants.LATITUDE_OF_ORIGIN, 10, p.parameter(Constants.LATITUDE_OF_ORIGIN).doubleValue(), STRICT); assertEquals(Constants.FALSE_NORTHING, 0, p.parameter(Constants.FALSE_NORTHING) .doubleValue(), STRICT); }