Advertisement
kijato

OpenJump, Beanshell - deleteNotEOVGeometry

May 21st, 2020
1,663
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.22 KB | None | 0 0
  1. {
  2.   import com.vividsolutions.jump.workbench.ui.*;
  3.   import java.util.*;
  4.  
  5. // 'EOTR100000_envelop', st_geomfromtext('POLYGON((384000 32000, 384000 384000, 960000 384000, 960000 32000, 384000 32000))',23700);
  6. // 'EOTR25000_envelop', st_geomfromtext('POLYGON((420000 40000, 420000 368000, 948000 368000, 948000 40000, 420000 40000))',23700);
  7.  
  8.   //Layer layer = wc.getLayerManager().getLayer("teszt");
  9.   //if (layer == null) { print ("Layer not found"); return; }
  10.  
  11.   Layer layer;
  12.   Layer[] layers = wc.LayerNamePanel.selectedLayers;
  13.   if (layers.length != 1) {
  14.     wc.workbench.frame.warnUser("Exactly one layer must be selected");
  15.     return;
  16.   }
  17.   layer = layers[0];
  18.   print(layers);
  19.  
  20.   FeatureSchema schema = layer.getFeatureCollectionWrapper().getFeatureSchema();
  21.  
  22.   Iterator iter = layer.getFeatureCollectionWrapper().iterator();
  23.   String layerName = "GEOMETRY";
  24.   int layerIndex = schema.getAttributeIndex(layerName);
  25.   while ( iter.hasNext() ) {
  26.       BasicFeature bf = (BasicFeature)iter.next();
  27.       print(bf.getAttribute(layerIndex));
  28.   }
  29.  
  30.   for (f : layer.featureCollectionWrapper.features) {
  31.    //for (c:f.geometry.getCoordinates()) c.z = Double.NaN;
  32.     print(f.geometry.getEnvelope());
  33.   }
  34.  
  35.  
  36. print("");
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement