Class TransformationUtil


  • public class TransformationUtil
    extends Object
    • Method Detail

      • getTransformationToApplication

        public static org.geotools.api.referencing.operation.MathTransform getTransformationToApplication​(@NotNull
                                                                                                          @NotNull Application application,
                                                                                                          @NotNull
                                                                                                          @NotNull org.geotools.api.data.SimpleFeatureSource simpleFeatureSource)
                                                                                                   throws org.geotools.api.referencing.FactoryException
        Determine whether we need to transform geometries to the application CRS. Note that this uses the "default geometry" attribute of the feature source, in cases where a feature source has multiple geometry attributes (with possibly different CRSs) or heterogenous CRSs across a single geometry attribute this may not be accurate.
        Parameters:
        application - the referenced application
        simpleFeatureSource - the feature source used in the application
        Returns:
        null when no transform is required and a valid transform otherwise
        Throws:
        org.geotools.api.referencing.FactoryException - when the CRS cannot be decoded
      • getTransformationToDataSource

        public static org.geotools.api.referencing.operation.MathTransform getTransformationToDataSource​(@NotNull
                                                                                                         @NotNull Application application,
                                                                                                         @NotNull
                                                                                                         @NotNull org.geotools.api.data.SimpleFeatureSource simpleFeatureSource)
                                                                                                  throws org.geotools.api.referencing.FactoryException
        Determine whether we need to transform geometry to data source crs. Note that this uses the "default geometry" attribute of the feature source, in cases where a feature source has multiple geometry attributes (with possibly different CRSs) or heterogenous CRSs across a single geometry attribute this may not be accurate.
        Parameters:
        application - the referenced application
        simpleFeatureSource - the feature source used in the application
        Returns:
        null when no transform is required and a valid transform otherwise
        Throws:
        org.geotools.api.referencing.FactoryException - when the CRS cannot be decoded