Class ShapefileWriter2

java.lang.Object
nz.org.riskscape.engine.output.RiskscapeWriter
nz.org.riskscape.engine.output.ShapefileWriter2
All Implemented Interfaces:
Closeable, AutoCloseable

public class ShapefileWriter2 extends nz.org.riskscape.engine.output.RiskscapeWriter

A RiskscapeWriter that talks to geotools's codecs to avoid the performance impact of using all the feature source diffing code and index generation.

Writing out > 300k rows with the ShapefileWriter began to slow things down, eventually grinding to a halt at about 550k rows due to a slight mismatch and possible misuse of the Geotools ContentStore API.

See ShapefileFeatureWriter for more details/reference, as a lot of the behaviour / details of how the codec work were figured out from there.

Varies from the previous writer by dropping column prefixes from parent struct.

TODO * add in file size checks from other code

  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected Charset
     
    protected TimeZone
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    ShapefileWriter2(File shpPath, nz.org.riskscape.engine.types.Struct type, nz.org.riskscape.engine.SRIDSet sridSet, nz.org.riskscape.problem.ProblemSink problemSink)
     
    ShapefileWriter2(File shpPath, nz.org.riskscape.engine.types.Struct type, nz.org.riskscape.engine.SRIDSet sridSet, nz.org.riskscape.problem.ProblemSink problemSink, boolean prjSingleLine)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
     
    protected org.geotools.data.shapefile.dbf.DbaseFileHeader
     
    protected org.geotools.data.shapefile.dbf.DbaseFileWriter
     
    protected org.geotools.data.shapefile.shp.ShapefileWriter
     
     
    void
    write(nz.org.riskscape.engine.Tuple value)
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • timeZone

      protected TimeZone timeZone
    • charset

      protected Charset charset
  • Constructor Details

    • ShapefileWriter2

      public ShapefileWriter2(File shpPath, nz.org.riskscape.engine.types.Struct type, nz.org.riskscape.engine.SRIDSet sridSet, nz.org.riskscape.problem.ProblemSink problemSink) throws IOException
      Throws:
      IOException
    • ShapefileWriter2

      public ShapefileWriter2(File shpPath, nz.org.riskscape.engine.types.Struct type, nz.org.riskscape.engine.SRIDSet sridSet, nz.org.riskscape.problem.ProblemSink problemSink, boolean prjSingleLine) throws IOException
      Throws:
      IOException
  • Method Details

    • createDbaseHeader

      protected org.geotools.data.shapefile.dbf.DbaseFileHeader createDbaseHeader()
    • createShpWriter

      protected org.geotools.data.shapefile.shp.ShapefileWriter createShpWriter() throws IOException
      Throws:
      IOException
    • createDbaseWriter

      protected org.geotools.data.shapefile.dbf.DbaseFileWriter createDbaseWriter() throws IOException
      Throws:
      IOException
    • close

      public void close() throws IOException
      Throws:
      IOException
    • write

      public void write(nz.org.riskscape.engine.Tuple value)
      Specified by:
      write in class nz.org.riskscape.engine.output.RiskscapeWriter
    • getStoredAt

      public URI getStoredAt()
      Specified by:
      getStoredAt in class nz.org.riskscape.engine.output.RiskscapeWriter