public class ShpPartitioner extends java.lang.Object implements Partitioner
Modifier and Type | Field and Description |
---|---|
(package private) java.lang.String |
encoding |
(package private) java.lang.String |
fileExtension |
(package private) java.util.List<java.lang.String> |
outputFiles |
Constructor and Description |
---|
ShpPartitioner() |
Modifier and Type | Method and Description |
---|---|
private org.geotools.data.FeatureWriter<org.opengis.feature.simple.SimpleFeatureType,org.opengis.feature.simple.SimpleFeature> |
createWriter(java.lang.String inputFileName,
java.lang.String tmpDir,
org.opengis.feature.simple.SimpleFeatureType schema,
int part)
Creates a writer to be used in copying the features for a specific partition of the input shapefile
|
java.lang.String[] |
split(java.lang.String filePath,
java.lang.String tmpDir,
int numParts)
Splits an input .CSV file into a specified number of partitions.
|
java.lang.String[] |
split(java.lang.String filePath,
java.lang.String tmpDir,
int numParts,
java.lang.String encoding)
Splits an input shapefile into a specified number of partitions.
|
private void |
writeToShapefile(org.opengis.feature.simple.SimpleFeature f,
org.geotools.data.FeatureWriter<org.opengis.feature.simple.SimpleFeatureType,org.opengis.feature.simple.SimpleFeature> writer)
Writes a given feature into a shapefile using a dedicated writer.
|
java.lang.String encoding
java.lang.String fileExtension
java.util.List<java.lang.String> outputFiles
public java.lang.String[] split(java.lang.String filePath, java.lang.String tmpDir, int numParts, java.lang.String encoding) throws java.io.IOException
split
in interface Partitioner
filePath
- Path to the input shapefiletmpDir
- Folder to hold the output partitions (i.e., files with the same extension)numParts
- Number of partitions to be createdjava.io.IOException
private org.geotools.data.FeatureWriter<org.opengis.feature.simple.SimpleFeatureType,org.opengis.feature.simple.SimpleFeature> createWriter(java.lang.String inputFileName, java.lang.String tmpDir, org.opengis.feature.simple.SimpleFeatureType schema, int part)
inputFileName
- The name of the shapefile containing all the input datatmpDir
- Folder to hold the output shapefile partitions (with the same extension)schema
- Attribute schema of input shapefile, also to be retained in the resulting partitionpart
- Serial number of this partitionprivate void writeToShapefile(org.opengis.feature.simple.SimpleFeature f, org.geotools.data.FeatureWriter<org.opengis.feature.simple.SimpleFeatureType,org.opengis.feature.simple.SimpleFeature> writer) throws java.io.IOException
f
- A feature to be written into the shapefilewriter
- A writer that undertakes storing of features into a given shapefile partitionjava.io.IOException
public java.lang.String[] split(java.lang.String filePath, java.lang.String tmpDir, int numParts) throws java.io.IOException
Partitioner
split
in interface Partitioner
filePath
- Path to the input .CSV filetmpDir
- Folder to hold the output partitions (i.e., files with the same extension)numParts
- Number of partitions to be createdjava.io.IOException