Class SimpleFeatureUtil


  • public class SimpleFeatureUtil
    extends Object
    Conversion functions from GeoTools SimpleFeatures from/to Feature
    Author:
    julien Gaffuri
    • Constructor Detail

      • SimpleFeatureUtil

        public SimpleFeatureUtil()
    • Method Detail

      • get

        public static ArrayList<Feature> get​(org.geotools.data.simple.SimpleFeatureCollection sfs,
                                             String attId)
        Convert GeoTools SimpleFeatures into features
        Parameters:
        sfs -
        attId -
        Returns:
      • get

        public static org.geotools.data.simple.SimpleFeatureCollection get​(Collection<? extends Feature> fs,
                                                                           org.opengis.feature.simple.SimpleFeatureType ft)
        Convert features into GeoTools SimpleFeature
        Parameters:
        fs -
        ft -
        Returns:
      • getFeatureType

        public static <T extends Feature> org.opengis.feature.simple.SimpleFeatureType getFeatureType​(Collection<T> fs,
                                                                                                      String geomColName,
                                                                                                      org.opengis.referencing.crs.CoordinateReferenceSystem crs)
        Get GeoTools FeatureType from features. NB: All features are assumed to have the same attributes names/types and geometry types.
        Type Parameters:
        T -
        Parameters:
        fs -
        geomColName -
        crs -
        Returns:
      • getFeatureType

        public static <T extends Feature> org.opengis.feature.simple.SimpleFeatureType getFeatureType​(T f,
                                                                                                      String geomColName,
                                                                                                      org.opengis.referencing.crs.CoordinateReferenceSystem crs)
        Get GeoTools FeatureType from features.
        Type Parameters:
        T -
        Parameters:
        f -
        geomColName -
        crs -
        Returns:
      • getAttributeGeomTypes

        public static <T extends FeatureHashMap<String,​Class<?>> getAttributeGeomTypes​(Collection<T> fs,
                                                                                               String geomColName)
        Get attribute and geometry types for a list of features.
        Type Parameters:
        T -
        Parameters:
        fs -
        Returns:
      • getAttributeGeomTypes

        public static <T extends FeatureHashMap<String,​Class<?>> getAttributeGeomTypes​(Collection<T> fs)
        Type Parameters:
        T -
        Parameters:
        fs -
        Returns:
      • getFeaturesFromGeometries

        public static <T extends org.locationtech.jts.geom.Geometry> Collection<Feature> getFeaturesFromGeometries​(Collection<T> geoms)
        Create features from geometries
        Type Parameters:
        T -
        Parameters:
        geoms -
        Returns: