Class GeoDiff
- java.lang.Object
-
- eu.europa.ec.eurostat.jgiscotools.geodiff.GeoDiff
-
public class GeoDiff extends Object
Analyse the differences between two versions of a dataset. Compute the difference in GeoDiff format. Note: both datasets are suppose to have a shared stable identifier.- Author:
- julien Gaffuri
-
-
Constructor Summary
Constructors Constructor Description GeoDiff(Collection<Feature> fs1, Collection<Feature> fs2)
GeoDiff(Collection<Feature> fs1, Collection<Feature> fs2, double resolution)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static void
applyChange(Feature f, Feature diff, String ct)
Apply a change to a feature.static void
applyChanges(Collection<Feature> fs, Collection<Feature> differences)
Apply changes to features.static Feature
compare(Feature fs1, Feature fs2, double resolution, List<String> attributesToIgnore)
Compare two versions of the same feature.static boolean
equals(Collection<Feature> fs1, Collection<Feature> fs2)
Analyse the differences between two datasets to check wether they are identical.static boolean
equals(Collection<Feature> fs1, Collection<Feature> fs2, double resolution)
Analyse the differences between two datasets to check wether they are identical.static Collection<Feature>
findIdStabilityIssues(Collection<Feature> differences, double resolution)
Detect among some differences the ones are are unecessary: The deletion and insertion of features with very similar geometries.List<String>
getAttributesToIgnore()
static HashMap<String,Class<?>>
getCommonAttributes(Collection<Feature> fs1, Collection<Feature> fs2)
Collection<Feature>
getDifferences()
static Collection<Feature>
getDifferences(Collection<Feature> fs1, Collection<Feature> fs2, double resolution)
Return the differences from a version of a dataset to another one.Collection<Feature>
getGeomDifferences()
Features representing the geometrical parts which have been deleted/inserted between the two versions.Collection<Feature>
getHausdorffGeomDifferences()
A collection of features representing the geometrical differences.Collection<Feature>
getIdentical()
double
getResolution()
void
setAttributesToIgnore(String... attributesToIgnore)
-
-
-
Constructor Detail
-
GeoDiff
public GeoDiff(Collection<Feature> fs1, Collection<Feature> fs2, double resolution)
- Parameters:
fs1
- The dataset in the first version.fs2
- The dataset in the second version.resolution
- The geometrical resolution of the dataset. Geometrical differences below this value will be ignored.
-
GeoDiff
public GeoDiff(Collection<Feature> fs1, Collection<Feature> fs2)
- Parameters:
fs1
- The dataset in the first version.fs2
- The dataset in the second version.
-
-
Method Detail
-
getResolution
public double getResolution()
- Returns:
- The geometrical resolution of the dataset. Geometrical differences below this value will be ignored.
-
getDifferences
public Collection<Feature> getDifferences()
- Returns:
- The differences between the two versions.
-
getIdentical
public Collection<Feature> getIdentical()
- Returns:
- The features that have are identical.
-
setAttributesToIgnore
public void setAttributesToIgnore(String... attributesToIgnore)
- Parameters:
attributesToIgnore
-
-
compare
public static Feature compare(Feature fs1, Feature fs2, double resolution, List<String> attributesToIgnore)
Compare two versions of the same feature. Both features are expected to have the same identifier and the same structure (list of attributes). The differences can be either on the attribute values, or on the geometry.- Parameters:
fs1
- The dataset in the first versionfs2
- The dataset in the second versionattributesToIgnore
-resolution
- The geometrical resolution of the dataset. Geometrical differences below this value will be ignored.- Returns:
- A feature representing the difference.
-
getHausdorffGeomDifferences
public Collection<Feature> getHausdorffGeomDifferences()
A collection of features representing the geometrical differences. For each feature whose geometry is different, a segment representing the hausdorff distance between the first and second version geometries is created. This feature allows assessing the magnitude of the geometrical difference.- Returns:
-
getGeomDifferences
public Collection<Feature> getGeomDifferences()
Features representing the geometrical parts which have been deleted/inserted between the two versions.- Returns:
-
findIdStabilityIssues
public static Collection<Feature> findIdStabilityIssues(Collection<Feature> differences, double resolution)
Detect among some differences the ones are are unecessary: The deletion and insertion of features with very similar geometries. This happen when id stability is not strictly followed.- Parameters:
differences
- The differences to check.resolution
- The spatial resolution value to consider two geometries as similar.- Returns:
- The collection of unecessary differences.
-
getDifferences
public static Collection<Feature> getDifferences(Collection<Feature> fs1, Collection<Feature> fs2, double resolution)
Return the differences from a version of a dataset to another one.- Parameters:
fs1
- The dataset first versionfs2
- The dataset second versionresolution
- The geometrical resolution of the dataset. Geometrical differences below this value will be ignored.- Returns:
- The differences
-
equals
public static boolean equals(Collection<Feature> fs1, Collection<Feature> fs2, double resolution)
Analyse the differences between two datasets to check wether they are identical.- Parameters:
fs1
- The first datasetfs2
- The second datasetresolution
- The geometrical resolution of the dataset. Geometrical differences below this value will be ignored.- Returns:
-
equals
public static boolean equals(Collection<Feature> fs1, Collection<Feature> fs2)
Analyse the differences between two datasets to check wether they are identical.- Parameters:
fs1
- The first datasetfs2
- The second dataset- Returns:
-
applyChanges
public static void applyChanges(Collection<Feature> fs, Collection<Feature> differences)
Apply changes to features.- Parameters:
fs
- The features to change, in their initial version.differences
- The changes to apply.
-
applyChange
public static void applyChange(Feature f, Feature diff, String ct)
Apply a change to a feature.- Parameters:
f
- The feature to change, in its initial version.diff
- The change. NB: this change cannot be a deletion or an insertionct
- The type of change, if known.
-
getCommonAttributes
public static HashMap<String,Class<?>> getCommonAttributes(Collection<Feature> fs1, Collection<Feature> fs2)
-
-