@Test public void testRenderOffDateline() throws Exception { File coverageFile = DataUtilities.urlToFile( GridCoverageReaderHelperTest.class.getResource( "test-data/off_dateline.tif")); assertTrue(coverageFile.exists()); GeoTiffReader offDatelineReader = new GeoTiffReader(coverageFile); ReferencedEnvelope envelope = new ReferencedEnvelope(-180, 0, -90, 90, DefaultGeographicCRS.WGS84); GridCoverageRenderer renderer = new GridCoverageRenderer( DefaultGeographicCRS.WGS84, envelope, new Rectangle(0, 0, 450, 450), null); RasterSymbolizer symbolizer = new StyleBuilder().createRasterSymbolizer(); Interpolation interpolation = Interpolation.getInstance(Interpolation.INTERP_NEAREST); RenderedImage image = renderer.renderImage( offDatelineReader, null, symbolizer, interpolation, null, 256, 256); assertNotNull(image); File reference = new File( "src/test/resources/org/geotools/renderer/lite/gridcoverage2d/offDateline.png"); ImageAssert.assertEquals(reference, image, 0); }
/** * Test the VocabFunction making use of a sample mapping provided by Alastair. * * @throws URISyntaxException */ @Test public void testVocabFunction() { URL file = getClass().getResource("/test-data/minoc_lithology_mapping.properties"); assertNotNull(file); FilterFactory2 ff = CommonFactoryFinder.getFilterFactory2(null); Function function = ff.function( "Vocab", ff.literal("1LIST"), ff.literal(DataUtilities.urlToFile(file).getPath())); Object value = function.evaluate(null); assertEquals( "urn:cgi:classifier:CGI:SimpleLithology:2008:calcareous_carbonate_sedimentary_rock", value); }
/** * Delete a URL (file) * * @param u DOCUMENT ME! */ private void delete(URL u) { File f = DataUtilities.urlToFile(u); f.delete(); }
/** * Helper method to check if for "url" parameter. * * @return url parameters as a File, or null if not applicable */ public File getFile(){ URL url = (URL) connectionParameters.get("url"); return DataUtilities.urlToFile(url); } /**
@Test public void testReadResolution3003InvalidArea() throws Exception { coverageFile = DataUtilities.urlToFile( GridCoverageRendererTest.class.getResource("test-data/test3003.tif")); assertTrue(coverageFile.exists());
protected FileChannel getDBFChannel() throws FileNotFoundException, MalformedURLException { URL url = new URL(filename+".dbf"); File f = DataUtilities.urlToFile(url); if (!f.exists()) url = new URL(filename+".DBF"); f = DataUtilities.urlToFile(url); if (!f.exists()) throw new FileNotFoundException("DBF file not found"); RandomAccessFile raf = new RandomAccessFile(f, "r"); return raf.getChannel(); }
public void testReadOffDatelineBothSides() throws Exception { coverageFile = DataUtilities.urlToFile(getClass().getResource("test-data/off_dateline.tif")); assertTrue(coverageFile.exists()); GeoTiffReader reader = new GeoTiffReader(coverageFile);
protected FileChannel getDBFChannel() throws FileNotFoundException, MalformedURLException { URL url = new URL(filename+".dbf"); File f = DataUtilities.urlToFile(url); if (!f.exists()) url = new URL(filename+".DBF"); f = DataUtilities.urlToFile(url); if (!f.exists()) throw new FileNotFoundException("DBF file not found"); RandomAccessFile raf = new RandomAccessFile(f, "r"); return raf.getChannel(); }
protected synchronized void addIndex(String attribute) throws FileNotFoundException, IOException { File f = DataUtilities.urlToFile(summaryURL); PrintWriter out = new PrintWriter(new FileWriter(f,true)); out.println(attribute); out.flush(); out.close(); }
protected synchronized void addIndex(String attribute) throws FileNotFoundException, IOException { File f = DataUtilities.urlToFile(summaryURL); PrintWriter out = new PrintWriter(new FileWriter(f,true)); out.println(attribute); out.flush(); out.close(); }
public boolean hasIndex(String attribute) throws FileNotFoundException, IOException { URL url = getIndexURL(attribute); if (url == null) return false; return DataUtilities.urlToFile(url).exists(); }
@Override public FileDataStore createDataStore(URL url) throws IOException { File file = DataUtilities.urlToFile(url); return createDataStoreFromFile(file); }
public boolean canProcess(Map<String, Serializable> params) { try { URL url = (URL) URLP.lookUp(params); File f = DataUtilities.urlToFile(url); return f != null && f.exists() && f.isDirectory(); } catch (Exception e) { return false; } }
public boolean hasIndex(String attribute) throws FileNotFoundException, IOException { URL url = getIndexURL(attribute); if (url == null) return false; return DataUtilities.urlToFile(url).exists(); }
/** * Tests whether an index for this attribute exists. * * @param attribute * @return */ public boolean existsIndex(String attribute) throws FileNotFoundException, IOException { URL url = getIndexURL(attribute); if (url == null) return false; File f = DataUtilities.urlToFile(url); return f.exists(); }
private void deleteFile(ShpFileType shpFileType) { URL url = shpFiles.acquireWrite(shpFileType, this); try { File toDelete = DataUtilities.urlToFile(url); if (toDelete.exists()) { toDelete.delete(); } } finally { shpFiles.unlockWrite(url, this); } }
private void deleteFile(ShpFileType shpFileType) { URL url = shpFiles.acquireWrite(shpFileType, this); try { File toDelete = DataUtilities.urlToFile(url); if (toDelete.exists()) { toDelete.delete(); } } finally { shpFiles.unlockWrite(url, this); } }
private File fileFromParams(Map<String, Serializable> params) throws IOException { File file = (File) FILE_PARAM.lookUp(params); if (file != null) { return file; } URL url = (URL) URL_PARAM.lookUp(params); if (url != null) { return DataUtilities.urlToFile(url); } return null; }
@Before public void setUp() throws Exception { System.setProperty(TEST_SYSTEM_PROPERTY, TEST_SYSTEM_PROPERTY_VALUE); System.setProperty(TEST_FILE_SYSTEM_PROPERTY, DataUtilities.urlToFile( InterpolationProperties.class.getResource("/" + IDENTIFIER + ".file.properties")).getPath()); }