Package org.opengis.referencing.operation

Examples of org.opengis.referencing.operation.CoordinateOperationFactory.createOperation()


                if (crs1 == null) {
                    crs1 = factory.createCoordinateReferenceSystem(crs1_name);
                }
                String crs2_name = Integer.toString(isystem2);
                crs2 = factory.createCoordinateReferenceSystem(crs2_name);
                cop = opf.createOperation(crs1, crs2);
                serialize(cop);
                if (!extensive) {
                    // If we are not running in extensive test mode,
                    // tests only the first CRS from each range.
                    break;
View Full Code Here


                final CoordinateReferenceSystem envelopeCrs2D = CRS.getHorizontalCRS(envelope
                        .getCoordinateReferenceSystem());
                if (envelopeCrs2D != null && !CRS.equalsIgnoreMetadata(crs, envelopeCrs2D)) {
                    CoordinateOperationFactory operationFactory = CRS
                            .getCoordinateOperationFactory(true);
                    CoordinateOperation op = operationFactory.createOperation(envelopeCrs2D, crs);
                    envelope = CRS.transform(op, envelope);
                    envelope.setCoordinateReferenceSystem(crs);
                }
                requestedRes = new double[2];
                requestedRes[0] = envelope.getSpan(0) / dim.getWidth();
View Full Code Here

    public void testOperationSourceTarget() throws Exception{
        // flip one way
        CoordinateReferenceSystem source = CRS.decode("EPSG:32638", true); // lon/lat
        CoordinateReferenceSystem target = CRS.decode("EPSG:4326", false); // lat/lon
        CoordinateOperationFactory coordinateOperationFactory = CRS.getCoordinateOperationFactory(true);
        CoordinateOperation co = coordinateOperationFactory.createOperation(source, target);
        assertEquals(source, co.getSourceCRS());
        assertEquals(target, co.getTargetCRS());
       
        // flip the other
        source = CRS.decode("EPSG:32638", false); // lat/lon
View Full Code Here

        assertEquals(target, co.getTargetCRS());
       
        // flip the other
        source = CRS.decode("EPSG:32638", false); // lat/lon
        target = CRS.decode("EPSG:4326", true); // lon/lat
        co = coordinateOperationFactory.createOperation(source, target);
        assertEquals(source, co.getSourceCRS());
        assertEquals(target, co.getTargetCRS());
    }
   
    public void testNadCon() throws Exception {
View Full Code Here

         
          // STEP 1 reproject the requested envelope to the coverage geographic bbox
          if(!CRS.equalsIgnoreMetadata(rasterManager.spatialDomainManager.coverageGeographicCRS2D, requestCRS)){
            //try to convert the requested bbox to the coverage geocrs
                CoordinateOperationFactory factory = CRS.getCoordinateOperationFactory(true);
                CoordinateOperation op = factory.createOperation(requestCRS,
                        rasterManager.spatialDomainManager.coverageGeographicCRS2D);
                requestedBBOXInCoverageGeographicCRS = CRS.transform(op, requestedBBox);
                requestedBBOXInCoverageGeographicCRS
                        .setCoordinateReferenceSystem(rasterManager.spatialDomainManager.coverageGeographicCRS2D);
          }
View Full Code Here

            final CoordinateReferenceSystem crs1 = factory.createCoordinateReferenceSystem(args[i]);
            for (int j=i+1; j<args.length; j++) {
                final CoordinateReferenceSystem crs2 = factory.createCoordinateReferenceSystem(args[j]);
                final CoordinateOperation op;
                try {
                    op = opFactory.createOperation(crs1, crs2);
                } catch (OperationNotFoundException exception) {
                    out.println(exception.getLocalizedMessage());
                    continue;
                }
                if (separator == null) {
View Full Code Here

        if (equalsIgnoreMetadata(sourceCRS, targetCRS)) {
            // Slight optimization in order to avoid the overhead of loading the full referencing engine.
            return IdentityTransform.create(sourceCRS.getCoordinateSystem().getDimension());
        }
        CoordinateOperationFactory operationFactory = getCoordinateOperationFactory(lenient);
        return operationFactory.createOperation(sourceCRS, targetCRS).getMathTransform();
    }

    /**
     * Transforms the given envelope to the specified CRS. If the given envelope is null, or the
     * {@linkplain Envelope#getCoordinateReferenceSystem envelope CRS} is null, or the given
View Full Code Here

            if (sourceCRS != null) {
                if (!equalsIgnoreMetadata(sourceCRS, targetCRS)) {
                    final CoordinateOperationFactory factory = getCoordinateOperationFactory(true);
                    final CoordinateOperation operation;
                    try {
                        operation = factory.createOperation(sourceCRS, targetCRS);
                    } catch (FactoryException exception) {
                        throw new TransformException(Errors.format(
                                ErrorKeys.CANT_TRANSFORM_ENVELOPE), exception);
                    }
                    if (!operation.getMathTransform().isIdentity()) {
View Full Code Here

            if (sourceCRS == null) {
                throw new CannotReprojectException(Errors.format(ErrorKeys.UNSPECIFIED_CRS));
            }
            final Envelope        sourceEnvelope;
            final GeneralEnvelope targetEnvelope;
            final CoordinateOperation operation = factory.createOperation(sourceCRS, targetCRS);
            final boolean force2D = (sourceCRS != compatibleSourceCRS);
            step2          = factory.createOperation(targetCRS, compatibleSourceCRS).getMathTransform();
            step3          = (force2D ? sourceGG.getGridToCRS2D(CORNER) : sourceGG.getGridToCRS(CORNER)).inverse();
            sourceEnvelope = sourceCoverage.getEnvelope(); // Don't force this one to 2D.
            targetEnvelope = CRS.transform(operation, sourceEnvelope);
View Full Code Here

            }
            final Envelope        sourceEnvelope;
            final GeneralEnvelope targetEnvelope;
            final CoordinateOperation operation = factory.createOperation(sourceCRS, targetCRS);
            final boolean force2D = (sourceCRS != compatibleSourceCRS);
            step2          = factory.createOperation(targetCRS, compatibleSourceCRS).getMathTransform();
            step3          = (force2D ? sourceGG.getGridToCRS2D(CORNER) : sourceGG.getGridToCRS(CORNER)).inverse();
            sourceEnvelope = sourceCoverage.getEnvelope(); // Don't force this one to 2D.
            targetEnvelope = CRS.transform(operation, sourceEnvelope);
            targetEnvelope.setCoordinateReferenceSystem(targetCRS);
            // 'targetCRS' may be different than the one set by CRS.transform(...).
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.