Examples of CSFactory


Examples of org.opengis.referencing.cs.CSFactory

        out.println("Testing CRS creations");
        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();
View Full Code Here

Examples of org.opengis.referencing.cs.CSFactory

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.cs.CSFactory

    System.out.println("------------------------------------------");
    System.out.println("Creating a CRS by hand:");
    // createCRSByHand2 start
    CRSFactory crsFactory = ReferencingFactoryFinder.getCRSFactory(null);
    DatumFactory datumFactory = ReferencingFactoryFinder.getDatumFactory(null);
    CSFactory csFactory = ReferencingFactoryFinder.getCSFactory(null);
   
    Map<String, Object> map = new HashMap<String, Object>();
    map.put("name", "Clarke 1866");
   
    Ellipsoid clark1866ellipse = datumFactory.createFlattenedSphere(map, 6378206.4,
            294.978698213901, SI.METER);
   
    PrimeMeridian greenwichMeridian = org.geotools.referencing.datum.DefaultPrimeMeridian.GREENWICH;
   
    final BursaWolfParameters toWGS84 = new BursaWolfParameters(DefaultGeodeticDatum.WGS84);
    toWGS84.dx = -3.0;
    toWGS84.dy = 142;
    toWGS84.dz = 183;
   
    map.clear();
    map.put("name", "North American Datum 1927");
    map.put(DefaultGeodeticDatum.BURSA_WOLF_KEY, toWGS84);
   
    GeodeticDatum clark1866datum = datumFactory.createGeodeticDatum(map, clark1866ellipse,
            greenwichMeridian);
    System.out.println(clark1866datum.toWKT());
    // notice all of the lovely datum aliases (used to determine if two
    // datums are the same)
    System.out.println("Identified Datum object:");
    printIdentifierStuff(clark1866datum);
   
    map.clear();
    map.put("name", "<lat>, <long>");
    CoordinateSystemAxis latAxis = org.geotools.referencing.cs.DefaultCoordinateSystemAxis.GEODETIC_LATITUDE;
    CoordinateSystemAxis longAxis = org.geotools.referencing.cs.DefaultCoordinateSystemAxis.GEODETIC_LONGITUDE;
    EllipsoidalCS ellipsCS = csFactory.createEllipsoidalCS(map, latAxis, longAxis);
   
    map.clear();
    map.put("name", "NAD 27");
    map.put("authority", "9999");
    // TODO add an authority code here (should be an identifier)
View Full Code Here

Examples of org.opengis.referencing.cs.CSFactory

    System.out.println("Creating two CRSs by hand:");
   
    // createCRSByHand3 start
    CRSFactory crsFactory = ReferencingFactoryFinder.getCRSFactory(null);
    DatumFactory datumFactory = ReferencingFactoryFinder.getDatumFactory(null);
    CSFactory csFactory = ReferencingFactoryFinder.getCSFactory(null);
    Map<String, Object> map = new HashMap<String, Object>();
   
    //
    // Create a datum used for each CRS
    //
    map.clear();
    map.put("name", "Greenwich Meridian");
    PrimeMeridian greenwichMeridian = datumFactory.createPrimeMeridian(map, 0, NonSI.DEGREE_ANGLE);
   
    map.clear();
    map.put("name", "WGS 84 Ellipsoid Datum");
    Ellipsoid wgs84Ellipsoid = datumFactory.createFlattenedSphere(map, 6378137, 298.257223563,
            SI.METER);
   
    map.clear();
    map.put("name", "WGS84 Height Datum");
    GeodeticDatum wgs84Datum = datumFactory.createGeodeticDatum(map, wgs84Ellipsoid,
            greenwichMeridian);
   
    //
    // Create a geocentric CRS
    //
    // Create a collection of axes for the coordinate system.
    map.clear();
    map.put("name", "Cartesian X axis");
    CoordinateSystemAxis xAxis = csFactory.createCoordinateSystemAxis(map, "X",
            AxisDirection.GEOCENTRIC_X, SI.METER);
   
    map.clear();
    map.put("name", "Cartesian Y axis");
    CoordinateSystemAxis yAxis = csFactory.createCoordinateSystemAxis(map, "Y",
            AxisDirection.GEOCENTRIC_Y, SI.METER);
   
    map.clear();
    map.put("name", "Cartesian Z axis");
    CoordinateSystemAxis zAxis = csFactory.createCoordinateSystemAxis(map, "Z",
            AxisDirection.GEOCENTRIC_Z, SI.METER);
   
    map.clear();
    map.put("name", "Rendered Cartesian CS");
    CartesianCS worldCS = csFactory.createCartesianCS(map, xAxis, yAxis, zAxis);
   
    // Now, the geocentric coordinate reference system that we'd use for output - eg to a 3D
    // renderer
    map.clear();
    map.put("name", "Output Cartesian CS");
    CoordinateReferenceSystem geocentricCRS = crsFactory.createGeocentricCRS(map, wgs84Datum,
            worldCS);
    System.out.println("Geocentric CRS: " + geocentricCRS.toWKT());
   
    //
    // Create a geograyhic CRS for the Airy 1830 ellipsoid
    // map.clear();
    // map.put("name", "Airy 1830");
    // Ellipsoid airyEllipse =
    // datumFactory.createFlattenedSphere(map, 6377563.396, 299.3249646, SI.METER);
   
    map.clear();
    map.put("name", "Geodetic North axis");
    CoordinateSystemAxis northAxis = csFactory.createCoordinateSystemAxis(map, "N",
            AxisDirection.NORTH, NonSI.DEGREE_ANGLE);
   
    map.clear();
    map.put("name", "Geodetic East axis");
    CoordinateSystemAxis eastAxis = csFactory.createCoordinateSystemAxis(map, "E",
            AxisDirection.EAST, NonSI.DEGREE_ANGLE);
   
    map.clear();
    map.put("name", "Geodetic Height axis");
    CoordinateSystemAxis heightAxis = csFactory.createCoordinateSystemAxis(map, "Up",
            AxisDirection.UP, SI.METER);
   
    map.clear();
    map.put("name", "<long>,<lat> Airy 1830 geodetic");
    EllipsoidalCS airyCS = csFactory.createEllipsoidalCS(map, eastAxis, northAxis, heightAxis);
   
    // finally create the source geographic CRS
    CoordinateReferenceSystem airyCRS = crsFactory.createGeographicCRS(map, wgs84Datum, airyCS);
   
    // createCRSByHand3 end
View Full Code Here

Examples of org.opengis.referencing.cs.CSFactory

                        throw new FactoryException(exception);
                    }
                }
                final AxisName an = getAxisName(nameCode);
                final Map<String,Object> properties = generateProperties(an.name, epsg, an.description);
                final CSFactory factory = factories.getCSFactory();
                final CoordinateSystemAxis axis = factory.createCoordinateSystemAxis(
                        properties, abbreviation, direction, createUnit(unit));
                returnValue = ensureSingleton(axis, returnValue, code);
            }
            result.close();
        } catch (SQLException exception) {
View Full Code Here

Examples of org.opengis.referencing.cs.CSFactory

                final String    type = getString(result, 3, code).trim().toLowerCase();
                final int  dimension = getInt   (result, 4, code);
                final String remarks = result.getString( 5);
                final CoordinateSystemAxis[] axis = generateAxisForCoordinateSystem(primaryKey, dimension);
                final Map<String,Object> properties = generateProperties(name, epsg, remarks); // Must be after axis
                final CSFactory factory = factories.getCSFactory();
                CoordinateSystem cs = null;
                if (type.equals("ellipsoidal")) {
                    switch (dimension) {
                        case 2: cs=factory.createEllipsoidalCS(properties, axis[0], axis[1]); break;
                        case 3: cs=factory.createEllipsoidalCS(properties, axis[0], axis[1], axis[2]); break;
                    }
                } else if (type.equals("cartesian")) {
                    switch (dimension) {
                        case 2: cs=factory.createCartesianCS(properties, axis[0], axis[1]); break;
                        case 3: cs=factory.createCartesianCS(properties, axis[0], axis[1], axis[2]); break;
                    }
                } else if (type.equals("spherical")) {
                    switch (dimension) {
                        case 3: cs=factory.createSphericalCS(properties, axis[0], axis[1], axis[2]); break;
                    }
                } else if (type.equals("vertical") || type.equals("gravity-related")) {
                    switch (dimension) {
                        case 1: cs=factory.createVerticalCS(properties, axis[0]); break;
                    }
                } else if (type.equals("linear")) {
                    switch (dimension) {
                        case 1: cs=factory.createLinearCS(properties, axis[0]); break;
                    }
                } else if (type.equals("polar")) {
                    switch (dimension) {
                        case 2: cs=factory.createPolarCS(properties, axis[0], axis[1]); break;
                    }
                } else if (type.equals("cylindrical")) {
                    switch (dimension) {
                        case 3: cs=factory.createCylindricalCS(properties, axis[0], axis[1], axis[2]); break;
                    }
                } else if (type.equals("affine")) {
                    switch (dimension) {
                        case 2: cs=factory.createAffineCS(properties, axis[0], axis[1]); break;
                        case 3: cs=factory.createAffineCS(properties, axis[0], axis[1], axis[2]); break;
                    }
                } else {
                    result.close();
                    throw new FactoryException(Errors.format(ErrorKeys.UNKNOW_TYPE_$1, type));
                }
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.