public class ShapefileWriter extends Object
GeometryCollection geoms;
File shp = new File("myshape.shp");
File shx = new File("myshape.shx");
ShapefileWriter writer = new ShapefileWriter(
shp.getChannel(),shx.getChannel()
);
writer.write(geoms,ShapeType.ARC);
This example assumes that each shape in the collection is a LineString.| Constructor and Description |
|---|
ShapefileWriter(FileChannel shpChannel,
FileChannel shxChannel)
Creates a new instance of ShapeFileWriter
|
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Close the underlying Channels.
|
FileChannel |
getShpChannel() |
void |
writeGeometry(org.locationtech.jts.geom.Geometry g)
Write a single Geometry to this shapefile.
|
void |
writeHeaders(ShapeType type)
Write the headers for this shapefile.Use this function before inserting the first geometry, then when all geometries are inserted.
|
public ShapefileWriter(FileChannel shpChannel, FileChannel shxChannel) throws IOException
shpChannel - shxChannel - IOExceptionpublic FileChannel getShpChannel()
public void writeHeaders(ShapeType type) throws IOException
type - Shape typeIOExceptionpublic void writeGeometry(org.locationtech.jts.geom.Geometry g)
throws IOException
g - IOExceptionpublic void close()
throws IOException
IOExceptionCopyright © 2019 CNRS. All rights reserved.