Package org.opengis.referencing.crs

Examples of org.opengis.referencing.crs.ProjectedCRS


        assertNull(operation.getTargetCRS());
        assertNull(operation.getMathTransform());
        /*
         * WGS 72 / UTM zone 10N
         */
        final ProjectedCRS crs = factory.createProjectedCRS("32210");
        final CoordinateOperation projection = crs.getConversionFromBase();
        assertEquals("32210", getIdentifier(crs));
        assertEquals("16010", getIdentifier(projection));
        assertTrue   (projection instanceof Projection);
        assertNotNull(projection.getSourceCRS());
        assertNotNull(projection.getTargetCRS());
View Full Code Here


    try {
      if (!projCode.toUpperCase().startsWith("EPSG:") ) {
        projCode="EPSG:"+projCode;
      }
      // it is an EPSG crs let's create it.
      final ProjectedCRS pcrs = (ProjectedCRS)allAuthoritiesFactory.createCoordinateReferenceSystem(projCode.toString());
      // //
      //
      // We have nothing to do with the unit of measure
      //
      // //
      if (linearUnit == null
              || linearUnit.equals(pcrs.getCoordinateSystem().getAxis(0).getUnit())){
          return pcrs;
      }
     
      // //
      //
      // Creating a new projected CRS replacing the CS unit
      //
      // //
      final Conversion conversionFromBase=new DefiningConversion(
              pcrs.getConversionFromBase().getName().getCode(),
              pcrs.getConversionFromBase().getParameterValues());
      return new DefaultProjectedCRS(
              java.util.Collections.singletonMap("name",DefaultEllipsoidalCS.getName(pcrs,new CitationImpl("EPSG"))),
              conversionFromBase,
              pcrs.getBaseCRS(),
              pcrs.getConversionFromBase().getMathTransform(),
              createProjectedCS(linearUnit)
             
      );
    } catch (FactoryException fe) {
      final IOException ex = new GeoTiffException(metadata, fe
View Full Code Here

    @Test
    public void testTransverseMercator() throws FactoryException {
        /*
         * Tests "Transverse Mercator" (not south-oriented) with an axis oriented toward south.
         */
        ProjectedCRS north = parseTransverseMercator(false, false, 1000);
        assertEquals(AxisDirection.WEST,  north.getCoordinateSystem().getAxis(0).getDirection());
        assertEquals(AxisDirection.NORTH, north.getCoordinateSystem().getAxis(1).getDirection());

        ProjectedCRS south = parseTransverseMercator(false, true, 1000);
        assertEquals(AxisDirection.WEST,  south.getCoordinateSystem().getAxis(0).getDirection());
        assertEquals(AxisDirection.SOUTH, south.getCoordinateSystem().getAxis(1).getDirection());

        MathTransform transform = CRS.findMathTransform(north, south);
        assertTrue(transform instanceof LinearTransform);
        Matrix matrix = ((LinearTransform) transform).getMatrix();
        assertDiagonal(matrix);
        assertFalse(matrix.isIdentity());
        assertEquals("West direction should be unchanged. ",      +1, matrix.getElement(0,0), EPS);
        assertEquals("North-South direction should be reverted.", -1, matrix.getElement(1,1), EPS);
        assertEquals("No easting expected.",                       0, matrix.getElement(0,2), EPS);
        assertEquals("No northing expected.",                      0, matrix.getElement(1,2), EPS);

        /*
         * Tests "Transverse Mercator South Oriented"
         */
        south = parseTransverseMercator(true, true, 1000);
        assertEquals(AxisDirection.WEST,  south.getCoordinateSystem().getAxis(0).getDirection());
        assertEquals(AxisDirection.SOUTH, south.getCoordinateSystem().getAxis(1).getDirection());
        transform = CRS.findMathTransform(north, south);
        assertTrue(transform instanceof LinearTransform);
        matrix = ((LinearTransform) transform).getMatrix();
        assertDiagonal(matrix);
        assertFalse(matrix.isIdentity());
View Full Code Here

    /**
     * UDIG requires this to work.
     */
    @Test
    public void test42001() throws FactoryException {
        final ProjectedCRS utm = factory.createProjectedCRS("AUTO:42001,0.0,0.0");
        assertNotNull("auto-utm", utm);
        assertSame   (utm, factory.createObject("AUTO :42001 ,0,0"));
        assertSame   (utm, factory.createObject("AUTO2:42001 ,0,0"));
        assertSame   (utm, factory.createObject(      "42001 ,0,0"));
        assertNotSame(utm, factory.createObject("AUTO :42001 ,30,0"));
        assertEquals ("Transverse_Mercator", utm.getConversionFromBase().getMethod().getName().getCode());
    }
View Full Code Here

    /**
     * Check we can parse also the unit
     */
    @Test
    public void test42001Units() throws FactoryException {
        final ProjectedCRS utm = factory.createProjectedCRS("AUTO:42001,9001,0.0,0.0");
        assertNotNull("auto-utm", utm);
        assertSame   (utm, factory.createObject("AUTO :42001, 9001,0,0"));
        assertSame   (utm, factory.createObject("AUTO2:42001, 9001,0,0"));
        assertSame   (utm, factory.createObject(      "42001, 9001,0,0"));
        assertNotSame(utm, factory.createObject("AUTO :42001, 9001,30,0"));
        assertEquals ("Transverse_Mercator", utm.getConversionFromBase().getMethod().getName().getCode());
    }
View Full Code Here

        assertEquals ("Transverse_Mercator", utm.getConversionFromBase().getMethod().getName().getCode());
    }
   
    @Test
    public void test42003() throws FactoryException {
        ProjectedCRS eqc = factory.createProjectedCRS("AUTO:42003,9001,0.0,0");
        assertEquals ("Orthographic", eqc.getConversionFromBase().getMethod().getName().getCode());
        assertTrue(eqc.getConversionFromBase().getMathTransform() instanceof EquatorialOrthographic);
       
        eqc = factory.createProjectedCRS("AUTO:42003,9001,0.0,90");
        assertEquals ("Orthographic", eqc.getConversionFromBase().getMethod().getName().getCode());
        assertTrue(eqc.getConversionFromBase().getMathTransform() instanceof PolarOrthographic);
       
        eqc = factory.createProjectedCRS("AUTO:42003,9001,0.0,45");
        assertEquals ("Orthographic", eqc.getConversionFromBase().getMethod().getName().getCode());
        assertTrue(eqc.getConversionFromBase().getMathTransform() instanceof ObliqueOrthographic);
    }
View Full Code Here

        assertTrue(eqc.getConversionFromBase().getMathTransform() instanceof ObliqueOrthographic);
    }
   
    @Test
    public void test42004() throws FactoryException {
        final ProjectedCRS eqc = factory.createProjectedCRS("AUTO:42004,9001,0.0,35");
        assertEquals ("Equidistant_Cylindrical", eqc.getConversionFromBase().getMethod().getName().getCode());
        String stdParallel1Code = EquidistantCylindrical.Provider.STANDARD_PARALLEL_1.getName().getCode();
        double stdParallel1 = eqc.getConversionFromBase().getParameterValues().parameter(stdParallel1Code).doubleValue();
        assertEquals(35.0, stdParallel1, 1e-9);
    }
View Full Code Here

        assertSame(csFactory,    container.getCSFactory());
        assertSame(crsFactory,   container.getCRSFactory());
        assertSame(mtFactory,    container.getMathTransformFactory());

        final Conversion conversion = new DefiningConversion("GBN grid", param);
        final ProjectedCRS projCRS = crsFactory.createProjectedCRS(
                name("Great_Britian_National_Grid"), geogCRS, conversion, cartCS);
        out.println();
        out.println("create Coodinate System....9: ");
        out.println(projCRS.toWKT());
    }
View Full Code Here

                        classification.equalsIgnoreCase("Transverse Mercator (South Orientated)") ||
                        classification.equalsIgnoreCase("Equidistant_Cylindrical");
                if (!skip) {
                    assertEquals(classification, ((MapProjection) mt).getParameterDescriptors().getName().getCode());
                }
                final ProjectedCRS projCRS = crsFactory.createProjectedCRS(dummyName,
                        DefaultGeographicCRS.WGS84,
                        new DefiningConversion(dummyName, method, mt),
                        DefaultCartesianCS.PROJECTED);
                final Conversion conversion = projCRS.getConversionFromBase();
                assertSame(mt, conversion.getMathTransform());
                final OperationMethod projMethod = conversion.getMethod();
                assertEquals(classification, projMethod.getName().getCode());
            }
        }
View Full Code Here

    parameters.parameter("false_easting").setValue(500000.0);
    parameters.parameter("false_northing").setValue(0.0);
    Conversion conversion = new DefiningConversion("Transverse_Mercator", parameters);
   
    Map<String, ?> properties = Collections.singletonMap("name", "WGS 84 / UTM Zone 12N");
    ProjectedCRS projCRS = crsFactory.createProjectedCRS(properties, geoCRS, conversion, cartCS);
    // createCRSByHand1 end
   
    // parameters.parameter("semi_major").setValue(((GeodeticDatum)geoCRS.getDatum()).getEllipsoid().getSemiMajorAxis());
    // parameters.parameter("semi_minor").setValue(((GeodeticDatum)geoCRS.getDatum()).getEllipsoid().getSemiMinorAxis());
   
    // MathTransform trans = mtFactory.createParameterizedTransform(parameters);
    // ProjectedCRS projCRS = crsFactory.createProjectedCRS(
    // Collections.singletonMap("name", "WGS 84 / UTM Zone 12N"),
    // new org.geotools.referencing.operation.OperationMethod(trans),
    // geoCRS, trans, cartCS);
    System.out.println("  Projected CRS: " + projCRS.toWKT());
    System.out.println("------------------------------------------");
   
    // save for later use in createMathTransformBetweenCRSs()
    this.utm10NCRS = projCRS;
}
View Full Code Here

TOP

Related Classes of org.opengis.referencing.crs.ProjectedCRS

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.