/** * Forces the FID index to be regenerated * * @throws IOException */ public void generateFidIndex() throws IOException { FidIndexer.generate(shpFiles); }
/** * Forces the FID index to be regenerated * * @throws IOException */ public void generateFidIndex() throws IOException { FidIndexer.generate(shpFiles); }
/** * Generates the FID index file for the shpFile */ public static synchronized void generate(URL shpURL) throws IOException { generate(new ShpFiles(shpURL)); }
/** * Generates the FID index file for the shpFile */ public static synchronized void generate(URL shpURL) throws IOException { generate(new ShpFiles(shpURL)); }
/** * If the fid index can be used and it is missing this method will try to create it * @return */ boolean existsOrCreateFidIndex() { if(indexUseable(ShpFileType.FIX)) { return true; } else { if(isLocal()) { try { FidIndexer.generate(shpFiles); return true; } catch(IOException e) { LOGGER.log(Level.WARNING, "Failed to create fid index"); return false; } } else { return false; } } }
/** * If the fid index can be used and it is missing this method will try to create it * @return */ boolean existsOrCreateFidIndex() { if(indexUseable(ShpFileType.FIX)) { return true; } else { if(isLocal()) { try { FidIndexer.generate(shpFiles); return true; } catch(IOException e) { LOGGER.log(Level.WARNING, "Failed to create fid index"); return false; } } else { return false; } } }
/** * Release resources and flush the header information. */ public void close() throws IOException { super.close(); fidWriter.close(); try { if (shpFiles.isLocal()) { if (indexedShapefileDataStore.needsGeneration(ShpFileType.FIX)) { FidIndexer.generate(shpFiles); } deleteFile(ShpFileType.QIX); if (indexedShapefileDataStore.treeType == IndexType.QIX) { indexedShapefileDataStore.buildQuadTree(); } } } catch (Throwable e) { indexedShapefileDataStore.treeType = IndexType.NONE; ShapefileDataStoreFactory.LOGGER.log(Level.WARNING, "Error creating Spatial index", e); } }
/** * Release resources and flush the header information. */ public void close() throws IOException { super.close(); fidWriter.close(); try { if (shpFiles.isLocal()) { if (indexedShapefileDataStore.needsGeneration(ShpFileType.FIX)) { FidIndexer.generate(shpFiles); } deleteFile(ShpFileType.QIX); if (indexedShapefileDataStore.treeType == IndexType.QIX) { indexedShapefileDataStore.buildQuadTree(); } } } catch (Throwable e) { indexedShapefileDataStore.treeType = IndexType.NONE; ShapefileDataStoreFactory.LOGGER.log(Level.WARNING, "Error creating Spatial index", e); } }
FidIndexer.generate(shpURL);
/** * DOCUMENT ME! * * @param typeName * @param r * @param readerSchema * * * @throws SchemaException * @throws IOException */ protected FeatureReader createFeatureReader(String typeName, Reader r, FeatureType readerSchema) throws SchemaException, IOException { if (isLocal() && fixURL!=null ) { if (!(new File(fixURL.getFile()).exists())) fixURL=FidIndexer.generate(shpURL); if( fixURL==null ) return new org.geotools.data.FIDFeatureReader(r, new ShapeFIDReader(getCurrentTypeName(), r), readerSchema); return new org.geotools.data.FIDFeatureReader(r, new IndexedFidReader(getCurrentTypeName(), r, getReadChannel(fixURL)), readerSchema); } else { return new org.geotools.data.FIDFeatureReader(r, new ShapeFIDReader(getCurrentTypeName(), r), readerSchema); } }