BeanShell script to find features with repeated points
import com.vividsolutions.jump.feature.*;
repeatedPoints(geometry) {
geometry .coordinates .length - new HashSet(Arrays .asList(geometry .coordinates)) .size();
}
debugFC = wc .layerManager .getLayer("debug") .featureCollectionWrapper .ultimateWrappee;
for (feature : wc .layerManager .getLayer("navtech roads") .featureCollectionWrapper .features) {
BasicFeature debugFeature = new BasicFeature(debugFC.featureSchema);
debugFeature.setAttribute("GEOMETRY", feature.geometry);
debugFeature.setAttribute("REPEATEDPTS", repeatedPoints(feature.geometry));
debugFC.add(debugFeature);
}
repeatedPoints(geometry) {
geometry .coordinates .length - new HashSet(Arrays .asList(geometry .coordinates)) .size();
}
debugFC = wc .layerManager .getLayer("debug") .featureCollectionWrapper .ultimateWrappee;
for (feature : wc .layerManager .getLayer("navtech roads") .featureCollectionWrapper .features) {
BasicFeature debugFeature = new BasicFeature(debugFC.featureSchema);
debugFeature.setAttribute("GEOMETRY", feature.geometry);
debugFeature.setAttribute("REPEATEDPTS", repeatedPoints(feature.geometry));
debugFC.add(debugFeature);
}
0 Comments:
Post a Comment
<< Home