Class FeatureUtils


  • public class FeatureUtils
    extends Object
    Unstable API. Use at own risk.
    • Constructor Detail

      • FeatureUtils

        public FeatureUtils()
    • Method Detail

      • createFeatureCollection

        public static org.geotools.feature.DefaultFeatureCollection createFeatureCollection​(URL url,
                                                                                            org.opengis.referencing.crs.CoordinateReferenceSystem targetCrs,
                                                                                            org.locationtech.jts.geom.Geometry clipGeometry)
                                                                                     throws IOException
        Throws:
        IOException
      • getFeatureSource

        public static org.geotools.data.FeatureSource<org.opengis.feature.simple.SimpleFeatureType,​org.opengis.feature.simple.SimpleFeature> getFeatureSource​(URL url)
                                                                                                                                                             throws IOException
        Throws:
        IOException
      • clipFeatureCollectionToProductBounds

        public static org.geotools.feature.DefaultFeatureCollection clipFeatureCollectionToProductBounds​(org.geotools.feature.FeatureCollection<org.opengis.feature.simple.SimpleFeatureType,​org.opengis.feature.simple.SimpleFeature> featureCollection,
                                                                                                         Product product,
                                                                                                         FeatureUtils.FeatureCrsProvider crsProvider,
                                                                                                         ProgressMonitor pm)
      • loadFeatureCollectionFromShapefile

        public static org.geotools.feature.FeatureCollection<org.opengis.feature.simple.SimpleFeatureType,​org.opengis.feature.simple.SimpleFeature> loadFeatureCollectionFromShapefile​(File shapefile)
                                                                                                                                                                                      throws IOException
        Throws:
        IOException
      • createFeatureTypeName

        public static String createFeatureTypeName​(String defaultGeometry)
      • createFeatureId

        public static String createFeatureId​(int base)
      • clipCollection

        public static org.geotools.feature.DefaultFeatureCollection clipCollection​(org.geotools.feature.FeatureCollection<org.opengis.feature.simple.SimpleFeatureType,​org.opengis.feature.simple.SimpleFeature> sourceCollection,
                                                                                   org.opengis.referencing.crs.CoordinateReferenceSystem defaultSourceCrs,
                                                                                   org.locationtech.jts.geom.Geometry clipGeometry,
                                                                                   org.opengis.referencing.crs.CoordinateReferenceSystem clipCrs,
                                                                                   String targetID,
                                                                                   org.opengis.referencing.crs.CoordinateReferenceSystem targetCrs,
                                                                                   ProgressMonitor pm)
        Clips the given sourceCollection against the clipGeometry and reprojects the clipped features to the targetCrs.
        Parameters:
        sourceCollection - the feature collection to be clipped and reprojected. If it does not have an associated CRS, the one specified by defaultSourceCrs is used.
        defaultSourceCrs - if sourceCollection does not have an associated CRS, this one is used.
        clipGeometry - the geometry used for clipping
        clipCrs - the CRS of the clipGeometry
        targetID - the ID of the resulting FeatureCollection. If null the ID of the sourceCollection is used.
        targetCrs - the CRS the FeatureCollection is reprojected to. If null no reprojection is applied.
        Returns:
        the clipped and possibly reprojected FeatureCollection
        Throws:
        IllegalStateException - if the sourceCollection has no associated CRS and defaultSourceCrs is null
      • getTransform

        public static org.geotools.geometry.jts.GeometryCoordinateSequenceTransformer getTransform​(org.opengis.referencing.crs.CoordinateReferenceSystem sourceCrs,
                                                                                                   org.opengis.referencing.crs.CoordinateReferenceSystem targetCrs)
      • createGeoBoundaryPolygon

        public static org.locationtech.jts.geom.Geometry createGeoBoundaryPolygon​(Product product)