Package org.geotools.data.crs

Examples of org.geotools.data.crs.ForceCoordinateSystemFeatureResults


           
            if(queryCRS.equals(layerCRS)){
                layers[0] = featureLayer;
            } else {
                // workaround
                FeatureCollection<SimpleFeatureType, SimpleFeature> reprojectingFc = new ForceCoordinateSystemFeatureResults(
                        features, layerCRS);
                layers[0] = new FeatureLayer(reprojectingFc, style, layer.getName());
            }
        }
        else {
View Full Code Here


        }

        if ((meta.getNativeCRS() != null) && features.getSchema().getDefaultGeometry() != null
                && !CRS.equalsIgnoreMetadata(meta.getNativeCRS(), meta.getDeclaredCRS())) {
            try {
                features = new ForceCoordinateSystemFeatureResults(features, meta.getDeclaredCRS());
            } catch (Exception e) {
                LOGGER.severe("Could not map original CRS to external CRS, "
                    + "serving data in original CRS: " + e.getMessage());
                LOGGER.log(Level.FINE, "Detailed mapping error: ", e);
            }
View Full Code Here

        }
        CoordinateReferenceSystem nativeCRS = fc.getSchema().getGeometryDescriptor().getCoordinateReferenceSystem();
       
        if(nativeCRS == null) {
            if(declaredCRS != null) {
                fc =  new ForceCoordinateSystemFeatureResults(fc, declaredCRS);
                nativeCRS = declaredCRS;
            }
        } else if(srsHandling == ProjectionPolicy.FORCE_DECLARED && !nativeCRS.equals(declaredCRS)) {
            fc =  new ForceCoordinateSystemFeatureResults(fc, declaredCRS);
            nativeCRS = declaredCRS;
        } else if(srsHandling == ProjectionPolicy.REPROJECT_TO_DECLARED && targetCRS == null
                && !nativeCRS.equals(declaredCRS)) {
            fc = new ReprojectFeatureResults(fc,declaredCRS);
        }
View Full Code Here

        //check for the case of a crs specified post features in the json
        if (features.getSchema() != null
                && features.getSchema().getCoordinateReferenceSystem() == null
                && it.getHandler().getCRS() != null ) {
            try {
                return new ForceCoordinateSystemFeatureResults(features, it.getHandler().getCRS());
            } catch (SchemaException e) {
                throw (IOException) new IOException().initCause(e);
            }
        }
        return features;
View Full Code Here

            // if the datastore is producing null CRS, we recode.
            // if the datastore's CRS != real CRS, then we recode
            if ((rCS == null) || !CRS.equalsIgnoreMetadata(rCS, sourceCrs)) {
                // need to retag the features
                try {
                    return new ForceCoordinateSystemFeatureResults( (SimpleFeatureCollection) features, sourceCrs);
                } catch (Exception ee) {
                    LOGGER.log(Level.WARNING, ee.getLocalizedMessage(), ee);
                }
            }
        }
View Full Code Here

         * object creation
         */
        try {
            if (qCsr != null && cCsr != null) {
                if (cCs != null)
                    results = new ForceCoordinateSystemFeatureResults(results, cCs);
                results = new ReprojectFeatureResults(results, cCsr);
                if (qCs != null)
                    results = new ForceCoordinateSystemFeatureResults(results, qCs);
                results = new ReprojectFeatureResults(results, qCsr);
            } else if (qCs != null && cCsr != null) {
                // complex case 2, reprojected then forced
                // mergedQuery.setCoordinateSystem(cCs);
                // mergedQuery.setCoordinateSystemReproject(cCsr);
                try {
                    if (cCs != null)
                        results = new ForceCoordinateSystemFeatureResults(results, cCs);
                    results = new ReprojectFeatureResults(source.getFeatures(mergedQuery), cCsr);

                    results = new ForceCoordinateSystemFeatureResults(results, qCs);
                } catch (SchemaException e) {
                    throw new DataSourceException("This should not happen", e);
                }
            } else {
                // easy case, we can just put toghether one forced cs and one
                // reprojection cs
                // in the mixed query and let it go

                // mergedQuery.setCoordinateSystem(qCs != null ? qCs : cCs);
                // mergedQuery.setCoordinateSystemReproject(qCsr != null ? qCsr
                // : cCsr);
                CoordinateReferenceSystem forcedCS = qCs != null ? qCs : cCs;
                CoordinateReferenceSystem reprojectCS = qCsr != null ? qCsr : cCsr;

                if (forcedCS != null)
                    results = new ForceCoordinateSystemFeatureResults(results, forcedCS);
                if (reprojectCS != null)
                    results = new ReprojectFeatureResults(results, reprojectCS);
            }
        } catch (IOException e) {
            throw e;
View Full Code Here

            @DescribeParameter(name = "forcedCRS", min = 0, description = "Coordinate reference system to use for input feature collection (overrides native one)") CoordinateReferenceSystem forcedCRS,
            @DescribeParameter(name = "targetCRS", min = 0, description = "Target coordinate reference system to use for reprojection") CoordinateReferenceSystem targetCRS)
            throws Exception {

        if (forcedCRS != null) {
            features = new ForceCoordinateSystemFeatureResults(features, forcedCRS, false);
        }
        if (targetCRS != null) {
            // note, using ReprojectFeatureResults would work. However that would
            // just work by accident... see GEOS-4072
            features = new ReprojectingFeatureCollection(features, targetCRS);
View Full Code Here

            @DescribeParameter(name = "forcedCRS", min = 0, description = "Forces a certain CRS on features before reprojection") CoordinateReferenceSystem forcedCRS,
            @DescribeParameter(name = "targetCRS", min = 0, description = "Features will be reprojected from their native/forced CRS to the target CRS") CoordinateReferenceSystem targetCRS)
            throws Exception {

        if (forcedCRS != null) {
            features = new ForceCoordinateSystemFeatureResults(features, forcedCRS, false);
        }
        if (targetCRS != null) {
            // note, using ReprojectFeatureResults would work. However that would
            // just work by accident... see GEOS-4072
            features = new ReprojectingFeatureCollection(features, targetCRS);
View Full Code Here

     */
    public void testImportBuildings() throws Exception {
        FeatureTypeInfo ti = getCatalog().getFeatureTypeByName(getLayerId(MockData.BUILDINGS));
        SimpleFeatureCollection rawSource = (SimpleFeatureCollection) ti.getFeatureSource(null,
                null).getFeatures();
        ForceCoordinateSystemFeatureResults forced = new ForceCoordinateSystemFeatureResults(
                rawSource, CRS.decode("EPSG:4326"));

        ImportProcess importer = new ImportProcess(getCatalog());
        String result = importer.execute(forced, MockData.CITE_PREFIX, MockData.CITE_PREFIX,
                "Buildings2", null, null, null);
View Full Code Here

        }
        CoordinateReferenceSystem nativeCRS = fc.getSchema().getGeometryDescriptor().getCoordinateReferenceSystem();
       
        if(nativeCRS == null) {
            if(declaredCRS != null) {
                fc =  new ForceCoordinateSystemFeatureResults(fc, declaredCRS);
                nativeCRS = declaredCRS;
            }
        } else if(srsHandling == ProjectionPolicy.FORCE_DECLARED && !nativeCRS.equals(declaredCRS)) {
            fc =  new ForceCoordinateSystemFeatureResults(fc, declaredCRS);
            nativeCRS = declaredCRS;
        } else if(srsHandling == ProjectionPolicy.REPROJECT_TO_DECLARED && targetCRS == null
                && !nativeCRS.equals(declaredCRS)) {
            fc = new ReprojectFeatureResults(fc,declaredCRS);
        }
View Full Code Here

TOP

Related Classes of org.geotools.data.crs.ForceCoordinateSystemFeatureResults

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.