public class Csv2Shape
extends java.lang.Object
Note: to keep things simple in the code below the input file should not have additional spaces or tabs between fields.
Constructor and Description |
---|
Csv2Shape() |
Modifier and Type | Method and Description |
---|---|
private static org.opengis.feature.simple.SimpleFeatureType |
createFeatureType()
Here is how you can use a SimpleFeatureType builder to create the schema for your shapefile dynamically.
|
private static java.io.File |
getNewShapeFile(java.io.File csvFile)
Prompt the user for the name and path to use for the output shapefile.
|
static void |
saveToShapefile(java.io.File file)
TODO
|
public static void saveToShapefile(java.io.File file) throws java.lang.Exception
file
- java.lang.Exception
private static java.io.File getNewShapeFile(java.io.File csvFile)
csvFile
- the input csv file used to create a default shapefile nameprivate static org.opengis.feature.simple.SimpleFeatureType createFeatureType()
This method is an improvement on the code used in the main method above (where we used DataUtilities.createFeatureType) because we can set a Coordinate Reference System for the FeatureType and a a maximum field length for the 'name' field dddd