Tag Info

New answers tagged


Shapefiles are essentially write once (in GeoTools) so read in the file and then write the features including the new ones out to a new shapefile.


Mark's answer is great! It really helped me out. Here's a slightly modified version of Mark's code. The major difference is that this code does not rely on the java.awt.image package to compute the image size, number of bands, or pixel values. Instead, it uses the GeoTools Coverage API. import org.geotools.coverage.grid.io.GridCoverage2DReader; import ...


Using the following code I can get an answer of 38355.3256m (which is probably close enough) - I imagine that with a more careful choice of central point a more "accurate" result might be obtained. Geometry g1 = reader.read("LINESTRING(13.45 52.47,13.46 52.48)"); Geometry g2 = reader.read("LINESTRING(13.00 52.00,13.1 52.2)"); ...


While this doesn't actually help you I can read a Grid file using the following code: File raster = new File("../../data/nzdem/nzdem500/hdr.adf"); AbstractGridFormat format = GridFormatFinder.findFormat(raster); AbstractGridCoverage2DReader reader = format.getReader(raster); GridCoverage2D cov; try { cov = reader.read(null); ...

Top 50 recent answers are included