Examples of ShapefileWriter


Examples of ch.epfl.lbd.io.writers.ShapeFileWriter

      }
    }
   
   
    //save shp file
    ShapeFileWriter writer = null;
    writer = new ShapeFileWriter(output);
    writer.open();
    writer.write(geometries);
   
    //closing Readers, Writers
    reader.close();
    writer.close();
  }
View Full Code Here

Examples of ch.epfl.lbd.io.writers.ShapeFileWriter

public class TestShpFileWriter extends Tester {

    @Override
    public void run()throws Exception{
      super.run();
       ShapeFileWriter writer = null;
       try{
         writer = new ShapeFileWriter("src/assets/shp/region_out");
       }
       catch (Exception e) {
        e.printStackTrace();
      }
      writer.open();
     
      ShapeFileReader reader = null;
      try{
        reader = new ShapeFileReader(new File("src/assets/shp/region.shp"));
       }
       catch (Exception e) {
        e.printStackTrace();
      }
      reader.open();
      Geometry[] geometries = reader.readAll();

      Assert.assertEquals(3, geometries.length);
      writer.write(geometries);
      reader.close();
      writer.close();
    }
View Full Code Here

Examples of org.geotools.data.shapefile.shp.ShapefileWriter

        transferCache = new Object[cnt];

        // open underlying writers
        FileChannel shpChannel = storageFiles.get(SHP).getWriteChannel();
        FileChannel shxChannel = storageFiles.get(SHX).getWriteChannel();
        shpWriter = new ShapefileWriter(shpChannel, shxChannel);

        dbfHeader = ShapefileDataStore.createDbaseHeader(featureType);
        dbfChannel = storageFiles.get(DBF).getWriteChannel();
        dbfWriter = new DbaseFileWriter(dbfHeader, dbfChannel, dbfCharset, dbfTimeZone);
View Full Code Here

Examples of org.geotools.data.shapefile.shp.ShapefileWriter

        StorageFile prjStoragefile = shpFiles.getStorageFile(PRJ);

        FileChannel shpChannel = shpStoragefile.getWriteChannel();
        FileChannel shxChannel = shxStoragefile.getWriteChannel();

        ShapefileWriter writer = new ShapefileWriter(shpChannel, shxChannel);
        try {
            // by spec, if the file is empty, the shape envelope should be ignored
            writer.writeHeaders(new Envelope(), shapeType, 0, 100);
        } finally {
            writer.close();
            assert !shpChannel.isOpen();
            assert !shxChannel.isOpen();
        }

        DbaseFileHeader dbfheader = createDbaseHeader(featureType);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.