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 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
  • 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