Class TransformationUtil
java.lang.Object
org.tailormap.api.geotools.TransformationUtil
-
Method Summary
Modifier and TypeMethodDescriptionstatic @Nullable org.geotools.api.referencing.operation.MathTransformgetTransformationToApplication(@NonNull Application application, @NonNull org.geotools.api.data.SimpleFeatureSource simpleFeatureSource) Determine whether we need to transform geometries to the application CRS.static @Nullable org.geotools.api.referencing.operation.MathTransformgetTransformationToDataSource(@NonNull Application application, @NonNull org.geotools.api.data.SimpleFeatureSource simpleFeatureSource) Determine whether we need to transform geometry to data source crs.static org.geotools.api.filter.FiltertransformFilterGeometries(@NonNull org.geotools.api.filter.Filter filter, @Nullable org.geotools.api.referencing.operation.MathTransform transform) Transforms the geometries in the given (intersects) spatial filter using the specified transformation.
-
Method Details
-
getTransformationToApplication
public static @Nullable org.geotools.api.referencing.operation.MathTransform getTransformationToApplication(@NonNull Application application, @NonNull 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 applicationsimpleFeatureSource- the feature source used in the application- Returns:
nullwhen no transform is required and a valid transform otherwise- Throws:
org.geotools.api.referencing.FactoryException- when the CRS cannot be decoded
-
getTransformationToDataSource
public static @Nullable org.geotools.api.referencing.operation.MathTransform getTransformationToDataSource(@NonNull Application application, @NonNull 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 heterogeneous CRSs across a single geometry attribute this may not be accurate.- Parameters:
application- the referenced applicationsimpleFeatureSource- the feature source used in the application- Returns:
nullwhen no transform is required and a valid transform otherwise- Throws:
org.geotools.api.referencing.FactoryException- when the CRS cannot be decoded
-
transformFilterGeometries
public static org.geotools.api.filter.Filter transformFilterGeometries(@NonNull org.geotools.api.filter.Filter filter, @Nullable org.geotools.api.referencing.operation.MathTransform transform) Transforms the geometries in the given (intersects) spatial filter using the specified transformation.- Parameters:
filter- the spatial filter, currently only intersects filters are supportedtransform- the transformation to apply- Returns:
- the transformed filter
-