/** * Checks if gdalwarp is available * * @throws IOException */ public static boolean isAvailable() throws IOException { return new GdalWarpTransform(new ArrayList<String>()).checkAvailable(); }
@Override protected File getExecutable() throws IOException { return getExecutableFromPath("gdalwarp"); }
private GdalWarpTransform buildGdalWarp() { List<String> options = new ArrayList<>(); options.add("-t_srs"); options.add("EPSG:4326"); GdalWarpTransform warp = new GdalWarpTransform(options); return warp; } }
@Override protected List<String> getReplacementTargetNames(ImportData data) throws IOException { File input = getInputFile(data); String name = input.getName(); String baseName = FilenameUtils.getBaseName(name); String extension = FilenameUtils.getExtension(name); List<String> names = new ArrayList<>(); names.add(name); names.add(baseName + ".prj"); names.add(baseName + ".wld"); try { // try to get a format specific world file extension Set<String> worldExtensions = WorldImageFormat.getWorldExtension(extension); for (String we : worldExtensions) { names.add(baseName + we); } } catch (IllegalArgumentException e) { // in case the file type is not recognized we get an exception. That's fine. } return Collections.singletonList(name); }
@Test public void testWarpFromGroundControlPoint() throws Exception { Assume.assumeTrue(GdalWarpTransform.isAvailable()); File dir = unpack("geotiff/box_gcp_fixed.tif.bz2"); File tif = new File(dir, "box_gcp_fixed.tif");