Examples of CRSFactory


Examples of net.fec.openrq.util.linearalgebra.factory.CRSFactory

public class CompressedByteVectorTest extends SparseByteVectorTest {

    @Override
    public Factory factory() {

        return new CRSFactory();
    }
View Full Code Here

Examples of net.fec.openrq.util.linearalgebra.factory.CRSFactory

public class CRSByteMatrixTest extends SparseByteMatrixTest {

    @Override
    public Factory factory() {

        return new CRSFactory();
    }
View Full Code Here

Examples of org.opengis.referencing.crs.CRSFactory

    @SuppressWarnings("deprecation")
    @Ignore
    @Test
    public void testBC_ALBERS_Viewport() throws Exception {
        CRSFactory fac = (CRSFactory) ReferencingFactoryFinder.getCRSFactories(null).iterator().next();
        CoordinateReferenceSystem crs = fac.createFromWKT(BC_ALBERS_WKT);
       
        GeometryFactory gfac = new GeometryFactory();
       
        double maxx = -120;
        double maxy = 59.9;
View Full Code Here

Examples of org.opengis.referencing.crs.CRSFactory

        if ("UNKNOWN".equalsIgnoreCase(WKT)) {
            LOGGER.fine("ArcSDE layer " + sdeLayer.getName()
                    + " does not provides a Coordinate Reference System");
        } else {
            try {
                CRSFactory crsFactory = ReferencingFactoryFinder.getCRSFactory(null);
                crs = crsFactory.createFromWKT(WKT);
                LOGGER.fine("ArcSDE CRS correctly parsed from layer " + sdeLayer.getName());
            } catch (FactoryException e) {
                String msg = "CRS factory does not knows how to parse the " + "CRS for layer "
                        + sdeLayer.getName() + ": " + WKT;
                LOGGER.log(Level.CONFIG, msg, e);
View Full Code Here

Examples of org.opengis.referencing.crs.CRSFactory

     * Called before each test.
     *
     * @throws FactoryException
     */
    public void setUp() throws FactoryException {
        CRSFactory crsFact = ReferencingFactoryFinder.getCRSFactory(null);       
        crs = crsFact.createFromWKT(WGS84_WKT);
        gFact = new GeometryFactoryImpl(crs);
        pFact = new PrimitiveFactoryImpl(crs);
    }
View Full Code Here

Examples of org.opengis.referencing.crs.CRSFactory

        out.println("---------------------");
        out.println();
        out.println("create Coodinate Reference System....1: ");
        final         DatumFactory datumFactory = ReferencingFactoryFinder.getDatumFactory        (null);
        final            CSFactory    csFactory = ReferencingFactoryFinder.getCSFactory           (null);
        final           CRSFactory   crsFactory = ReferencingFactoryFinder.getCRSFactory          (null);
        final MathTransformFactory    mtFactory = ReferencingFactoryFinder.getMathTransformFactory(null);

        final Ellipsoid airy1830;
        final Unit<Length> meters = SI.METER;
        airy1830 = datumFactory.createEllipsoid(name("Airy1830"), 6377563.396, 6356256.910, meters);
        out.println();
        out.println("create Coodinate Reference System....2: ");
        out.println(airy1830.toWKT());

        final PrimeMeridian greenwich;
        final Unit<Angle> degrees = NonSI.DEGREE_ANGLE;
        greenwich = datumFactory.createPrimeMeridian(name("Greenwich"), 0, degrees);
        out.println();
        out.println("create Coodinate Reference System....3: ");
        out.println(greenwich.toWKT());

        // NOTE: we could use the following pre-defined constant instead:
        //       DefaultPrimeMeridian.GREENWICH;
        final GeodeticDatum datum;
        datum = datumFactory.createGeodeticDatum(name("Airy1830"), airy1830, greenwich);
        out.println();
        out.println("create Coodinate Reference System....4: ");
        out.println(datum.toWKT());

        // NOTE: we could use the following pre-defined constant instead:
        //       DefaultEllipsoidalCS.GEODETIC_2D;
        final EllipsoidalCS ellCS;
        ellCS = csFactory.createEllipsoidalCS(name("Ellipsoidal"),
                csFactory.createCoordinateSystemAxis(name("Longitude"), "long", AxisDirection.EAST,  degrees),
                csFactory.createCoordinateSystemAxis(name("Latitude")"lat",  AxisDirection.NORTH, degrees));
        out.println();
        out.println("create Coodinate Reference System....5: ");
        out.println(ellCS); // No WKT for coordinate systems

        final GeographicCRS geogCRS;
        geogCRS = crsFactory.createGeographicCRS(name("Airy1830"), datum, ellCS);
        out.println();
        out.println("create Coodinate Reference System....6: ");
        out.println(geogCRS.toWKT());

        final MathTransform p;
        final ParameterValueGroup param = mtFactory.getDefaultParameters("Transverse_Mercator");
        param.parameter("semi_major")        .setValue(airy1830.getSemiMajorAxis());
        param.parameter("semi_minor")        .setValue(airy1830.getSemiMinorAxis());
        param.parameter("central_meridian".setValue(     49);
        param.parameter("latitude_of_origin").setValue(     -2);
        param.parameter("false_easting")     .setValue( 400000);
        param.parameter("false_northing")    .setValue(-100000);
        out.println();
        out.println("create Coodinate System....7: ");
        out.println(param);

        // NOTE: we could use the following pre-defined constant instead:
        //       DefaultCartesianCS.PROJECTED;
        final CartesianCS cartCS;
        cartCS = csFactory.createCartesianCS(name("Cartesian"),
                 csFactory.createCoordinateSystemAxis(name("Easting")"x", AxisDirection.EAST,  meters),
                 csFactory.createCoordinateSystemAxis(name("Northing"), "y", AxisDirection.NORTH, meters));
        out.println();
        out.println("create Coodinate Reference System....8: ");
        out.println(cartCS); // No WKT for coordinate systems

        final Hints hints = new Hints();
        hints.put(Hints.DATUM_FACTORY,          datumFactory);
        hints.put(Hints.CS_FACTORY,             csFactory);
        hints.put(Hints.CRS_FACTORY,            crsFactory);
        hints.put(Hints.MATH_TRANSFORM_FACTORY, mtFactory);

        final ReferencingFactoryContainer container = new ReferencingFactoryContainer(hints);
        assertSame(datumFactory, container.getDatumFactory());
        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

Examples of org.opengis.referencing.crs.CRSFactory

    @Test
    public void testMapProjections() throws FactoryException {
        out.println();
        out.println("Testing classification names");
        out.println("----------------------------");
        final CRSFactory crsFactory = ReferencingFactoryFinder.getCRSFactory(null);
        final MathTransformFactory mtFactory = ReferencingFactoryFinder.getMathTransformFactory(null);
        final Collection<OperationMethod> methods = mtFactory.getAvailableMethods(Projection.class);
        final Map<String,?> dummyName = Collections.singletonMap("name", "Test");
        for (final OperationMethod method : methods) {
            final String classification = method.getName().getCode();
            final ParameterValueGroup param = mtFactory.getDefaultParameters(classification);
            try {
                param.parameter("semi_major").setValue(6377563.396);
                param.parameter("semi_minor").setValue(6356256.909237285);
            } catch (IllegalArgumentException e) {
                // Above parameters do not exists. Ignore.
            }
            final MathTransform mt;
            try {
                mt = mtFactory.createParameterizedTransform(param);
            } catch (FactoryException e) {
                // Probably not a map projection. This test is mostly about projection, so ignore.
                continue;
            } catch (UnsupportedOperationException e) {
                continue;
            }
            if (mt instanceof MapProjection) {
                /*
                 * Tests map projection properties. Some tests are ommitted for south-oriented
                 * map projections, since they are implemented as a concatenation of their North-
                 * oriented variants with an affine transform.
                 */
                out.println(classification);
                final boolean skip =
                        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());
View Full Code Here

Examples of org.opengis.referencing.crs.CRSFactory

void factories() {
    // factories start
    Hints hints = null; // configure hints for the group of factories
    ReferencingFactoryContainer group = new ReferencingFactoryContainer(hints);
    CRSFactory crsFactory = group.getCRSFactory();
    CSFactory csFactory = group.getCSFactory();
    DatumFactory datumFactory = group.getDatumFactory();
    // factories end
}
View Full Code Here

Examples of org.opengis.referencing.crs.CRSFactory

*/
void creatCRSFromWKT() throws Exception {
    System.out.println("------------------------------------------");
    System.out.println("Creating a CRS from a WKT string:");
    // creatCRSFromWKT start
    CRSFactory crsFactory = ReferencingFactoryFinder.getCRSFactory(null);
    String wkt = "PROJCS[\"UTM_Zone_10N\", " + "GEOGCS[\"WGS84\", " + "DATUM[\"WGS84\", "
            + "SPHEROID[\"WGS84\", 6378137.0, 298.257223563]], " + "PRIMEM[\"Greenwich\", 0.0], "
            + "UNIT[\"degree\",0.017453292519943295], " + "AXIS[\"Longitude\",EAST], "
            + "AXIS[\"Latitude\",NORTH]], " + "PROJECTION[\"Transverse_Mercator\"], "
            + "PARAMETER[\"semi_major\", 6378137.0], "
            + "PARAMETER[\"semi_minor\", 6356752.314245179], "
            + "PARAMETER[\"central_meridian\", -123.0], "
            + "PARAMETER[\"latitude_of_origin\", 0.0], " + "PARAMETER[\"scale_factor\", 0.9996], "
            + "PARAMETER[\"false_easting\", 500000.0], " + "PARAMETER[\"false_northing\", 0.0], "
            + "UNIT[\"metre\",1.0], " + "AXIS[\"x\",EAST], " + "AXIS[\"y\",NORTH]]";
   
    CoordinateReferenceSystem crs = crsFactory.createFromWKT(wkt);
    // creatCRSFromWKT end
    System.out.println("  CRS: " + crs.toWKT());
    System.out.println("Identified CRS object:");
    printIdentifierStuff(crs);
    System.out.println("Identified Datum object:");
View Full Code Here

Examples of org.opengis.referencing.crs.CRSFactory

void createCRSByHand1() throws Exception {
    System.out.println("------------------------------------------");
    System.out.println("Creating a CRS by hand:");
    // createCRSByHand1 start
    MathTransformFactory mtFactory = ReferencingFactoryFinder.getMathTransformFactory(null);
    CRSFactory crsFactory = ReferencingFactoryFinder.getCRSFactory(null);
   
    GeographicCRS geoCRS = org.geotools.referencing.crs.DefaultGeographicCRS.WGS84;
    CartesianCS cartCS = org.geotools.referencing.cs.DefaultCartesianCS.GENERIC_2D;
   
    ParameterValueGroup parameters = mtFactory.getDefaultParameters("Transverse_Mercator");
    parameters.parameter("central_meridian").setValue(-111.0);
    parameters.parameter("latitude_of_origin").setValue(0.0);
    parameters.parameter("scale_factor").setValue(0.9996);
    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());
   
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.