GeoPackage geopkg() { return new GeoPackage(dataStore); }
public GeoPackageReader(Object source, Hints hints) throws IOException { coverageFactory = CoverageFactoryFinder.getGridCoverageFactory(this.hints); sourceFile = GeoPackageFormat.getFileFromSource(source); file = new GeoPackage(sourceFile, null, null, true); for (TileEntry tile : file.tiles()) { tiles.put(tile.getTableName(), tile); } // have a sane default when hit with no name, useful in particular // when the geopackage only has one coverage coverageName = tiles.keySet().iterator().next(); // add the overview count and allocate the final List<TileMatrix> tileMatricies = tiles.get(coverageName).getTileMatricies(); this.numOverviews = tileMatricies.size() - 1; overViewResolutions = new double[numOverviews][2]; // first tile matrix is the one with the lowest resolution, last one is native for (int i = 0; i < tileMatricies.size() - 1; i++) { final TileMatrix matrix = tileMatricies.get(i); overViewResolutions[tileMatricies.size() - i - 2] = new double[] {matrix.getXPixelSize(), matrix.getYPixelSize()}; } }
GeoPackage geopkg() { return new GeoPackage(dataStore); }
public File getTargetFile() { if (targetFile == null) { try { targetFile = File.createTempFile("GeoGigGeoPkgExport", ".gpkg"); targetFile.deleteOnExit(); GeoPackage gpkg = new GeoPackage(targetFile); try { gpkg.init(); } finally { gpkg.close(); } } catch (IOException e) { throw Throwables.propagate(e); } } return targetFile; }
public GeoPackageReader(Object source, Hints hints) throws IOException { coverageFactory = CoverageFactoryFinder.getGridCoverageFactory(this.hints); sourceFile = GeoPackageFormat.getFileFromSource(source); file = new GeoPackage(sourceFile, null, null, true); for (TileEntry tile : file.tiles()) { tiles.put(tile.getTableName(), tile); } // have a sane default when hit with no name, useful in particular // when the geopackage only has one coverage coverageName = tiles.keySet().iterator().next(); }
@Override protected void runInternal(GeogigCLI cli) throws IOException { File databaseFile = new File(commonArgs.database); Preconditions.checkArgument(databaseFile.exists(), "Database file not found."); final GeoPackage geopackage = new GeoPackage(databaseFile); final DataSource dataSource = geopackage.getDataSource(); try (Connection connection = dataSource.getConnection()) { metadata = new GeopkgGeogigMetadata(connection); super.runInternal(cli); } catch (SQLException e) { throw new RuntimeException(e); } finally { metadata.close(); geopackage.close(); } }
@Override protected void runInternal(GeogigCLI cli) throws IOException { File databaseFile = new File(commonArgs.database); Preconditions.checkArgument(databaseFile.exists(), "Database file not found."); final GeoPackage geopackage = new GeoPackage(databaseFile); final DataSource dataSource = geopackage.getDataSource(); try (Connection connection = dataSource.getConnection()) { metadata = new GeopkgGeogigMetadata(connection); super.runInternal(cli); } catch (SQLException e) { throw new RuntimeException(e); } finally { metadata.close(); geopackage.close(); } }
@Override protected void runInternal(GeogigCLI cli) throws IOException { File databaseFile = new File(commonArgs.database); Preconditions.checkArgument(databaseFile.exists(), "Database file not found."); final GeoPackage geopackage = new GeoPackage(databaseFile); final DataSource dataSource = geopackage.getDataSource(); try (Connection connection = dataSource.getConnection()) { metadata = new GeopkgGeogigMetadata(connection); super.runInternal(cli); } catch (SQLException e) { Throwables.propagate(e); } finally { metadata.close(); geopackage.close(); } }
public void createFIDMappingTable(ConcurrentMap<String, String> fidMappings, String targetTableName) throws IOException { final GeoPackage geopackage = new GeoPackage(geopackageDbFile); try { final DataSource dataSource = geopackage.getDataSource(); try (Connection connection = dataSource.getConnection()) { try (GeopkgGeogigMetadata metadata = new GeopkgGeogigMetadata(connection)) { metadata.createFidMappingTable(targetTableName, fidMappings); } } catch (SQLException e) { throw new RuntimeException(e); } } finally { geopackage.close(); } }
public void createFIDMappingTable(ConcurrentMap<String, String> fidMappings, String targetTableName) throws IOException { final GeoPackage geopackage = new GeoPackage(geopackageDbFile); try { final DataSource dataSource = geopackage.getDataSource(); try (Connection connection = dataSource.getConnection()) { try (GeopkgGeogigMetadata metadata = new GeopkgGeogigMetadata(connection)) { metadata.createFidMappingTable(targetTableName, fidMappings); } } catch (SQLException e) { throw Throwables.propagate(e); } } finally { geopackage.close(); } }
public void createChangeLog(final String targetTableName, Map<String, ChangeType> changedNodes) throws IOException, SQLException { final GeoPackage geopackage = new GeoPackage(geopackageDbFile); final DataSource dataSource = geopackage.getDataSource(); try (Connection connection = dataSource.getConnection(); GeopkgGeogigMetadata metadata = new GeopkgGeogigMetadata(connection)) { metadata.createChangeLog(targetTableName); metadata.populateChangeLog(targetTableName, changedNodes); } finally { geopackage.close(); } }
public void createChangeLog(final String targetTableName, Map<String, ChangeType> changedNodes) throws IOException, SQLException { final GeoPackage geopackage = new GeoPackage(geopackageDbFile); final DataSource dataSource = geopackage.getDataSource(); try (Connection connection = dataSource.getConnection(); GeopkgGeogigMetadata metadata = new GeopkgGeogigMetadata(connection)) { metadata.createChangeLog(targetTableName); metadata.populateChangeLog(targetTableName, changedNodes); } finally { geopackage.close(); } }
final GeoPackage geopackage = new GeoPackage(geopackageDbFile); try { FeatureEntry featureEntry = geopackage.feature(targetTableName);
final GeoPackage geopackage = new GeoPackage(geopackageDbFile); try { FeatureEntry featureEntry = geopackage.feature(targetTableName);
public File createEmptyDatabase() throws Exception { File file = newFile(); GeoPackage geoPackage = new GeoPackage(file); try { geoPackage.init(); } finally { geoPackage.close(); } return file; }
public File createEmptyDatabase() throws Exception { File file = newFile(); GeoPackage geoPackage = new GeoPackage(file); try { geoPackage.init(); } finally { geoPackage.close(); } return file; }
@Then("^the result is a valid GeoPackage file$") public void gpkg_CheckResponseIsGeoPackage() throws Throwable { checkContentType(Variants.GEOPKG_MEDIA_TYPE.getType()); File tmp = File.createTempFile("gpkg_functional_test", ".gpkg", context.getTempFolder()); tmp.deleteOnExit(); try (InputStream stream = context.getLastResponseInputStream()) { try (OutputStream to = new FileOutputStream(tmp)) { ByteStreams.copy(stream, to); } } GeoPackage gpkg = new GeoPackage(tmp); try { List<FeatureEntry> features = gpkg.features(); System.err.printf("Found gpkg tables: %s\n", Lists.transform(features, (e) -> e.getTableName())); } finally { gpkg.close(); } }
GeoPackage geopackage; try { geopackage = new GeoPackage(geopackageDbFile); } catch (IOException e) { throw Throwables.propagate(e);
final GeoPackage geopkg = new GeoPackage(geopackage); try { final DataSource dataSource = geopkg.getDataSource();
final GeoPackage geopkg = new GeoPackage(geopackage); try { final DataSource dataSource = geopkg.getDataSource();