Package org.geotools.geopkg

Examples of org.geotools.geopkg.GeoPackage


        assertPathExists(root, "bar/widgets/featuretype.xml");
        assertPathExists(root, "bar/widgets/layer.xml");
        assertPathExists(root, "data/bar.gpkg");

        // ensure the geopackage has the right data in it
        GeoPackage gpkg = new GeoPackage(root.resolve("data/bar.gpkg").toFile());
        try {
            assertEquals(2, gpkg.features().size());
            assertNotNull(gpkg.feature("stuff"));
            assertNotNull(gpkg.feature("widgets"));
        }
        finally {
            gpkg.close();
        }

        // ensure the exported store config points to the geopackage
        DataStoreInfo store = new XStreamPersisterFactory().createXMLPersister()
            .load(new FileInputStream(root.resolve("bar/datastore.xml").toFile()), DataStoreInfo.class);
View Full Code Here


                s = clone;
            }
            else {
                // copy into a new geopackage
                GeoPackage gpkg = new GeoPackage(new File(wsDataDir, ds.getName()+".gpkg"));
                try {
                    ingestInto(gpkg, ds);
                }
                finally {
                    gpkg.close();
                }

                // update the connection parameters
                DataStoreInfo clone = copy(ds, catalog.getFactory().createDataStore(), DataStoreInfo.class);
                clone.setType("GeoPackage");

                Map<String,Serializable> oldParams = clone.getConnectionParameters();
                Map<String,Serializable> params = Maps.newHashMap();

                params.put(GeoPkgDataStoreFactory.DBTYPE.key, "geopkg");
                params.put(GeoPkgDataStoreFactory.DATABASE.key, toWorkspaceRelativePath(gpkg.getFile()));
                params.put(GeoPkgDataStoreFactory.NAMESPACE.key,
                    (Serializable) GeoPkgDataStoreFactory.NAMESPACE.lookUp(oldParams));

                oldParams.clear();
                oldParams.putAll(params);
View Full Code Here

        Hints.putSystemDefault(Hints.COMPARISON_TOLERANCE, 1e-9);
    }

    @Before
    public void setUp() throws Exception {
        geopkg = new GeoPackage(File.createTempFile("geopkg", "db", new File("target")));
        geopkg.init();
    }
View Full Code Here

        //this.geopkg = new GeoPackage(dataStore);
    }

    @Override
    public void initializeConnection(Connection cx) throws SQLException {
        new GeoPackage(dataStore.getDataSource()).init(cx);
    }
View Full Code Here

            if (epsgCode != null) {
                fe.setSrid(epsgCode);
            }
        }

        GeoPackage geopkg = geopkg();
        try {
            geopkg.addGeoPackageContentsEntry(fe);
            geopkg.addGeometryColumnsEntry(fe);

            //other geometry columns are possible
            for (PropertyDescriptor descr : featureType.getDescriptors()) {
                if (descr instanceof GeometryDescriptor) {
                    GeometryDescriptor gd1 = (GeometryDescriptor) descr;
                    if (gd1.getLocalName() != fe.getGeometryColumn()) {
                        FeatureEntry fe1 = new FeatureEntry();
                        fe1.init(fe);
                        fe1.setGeometryColumn(gd1.getLocalName());
                        fe1.setGeometryType(Geometries.getForBinding((Class) gd1.getType().getBinding()));
                        geopkg.addGeometryColumnsEntry(fe1);
                    }
                }
            }
        } catch (IOException e) {
            throw new SQLException(e);
View Full Code Here

        return super.createCRS(srid, cx);
    }

    GeoPackage geopkg() {
        return new GeoPackage(dataStore);
    }
View Full Code Here

        //this.geopkg = new GeoPackage(dataStore);
    }

    @Override
    public void initializeConnection(Connection cx) throws SQLException {
        new GeoPackage(dataStore.getDataSource()).init(cx);
    }
View Full Code Here

            if (epsgCode != null) {
                fe.setSrid(epsgCode);
            }
        }

        GeoPackage geopkg = geopkg();
        try {
            geopkg.addGeoPackageContentsEntry(fe);
            geopkg.addGeometryColumnsEntry(fe);

            //other geometry columns are possible
            for (PropertyDescriptor descr : featureType.getDescriptors()) {
                if (descr instanceof GeometryDescriptor) {
                    GeometryDescriptor gd1 = (GeometryDescriptor) descr;
                    if (gd1.getLocalName() != fe.getGeometryColumn()) {
                        FeatureEntry fe1 = new FeatureEntry();
                        fe1.init(fe);
                        fe1.setGeometryColumn(gd1.getLocalName());
                        fe1.setGeometryType(Geometries.getForBinding((Class) gd1.getType().getBinding()));
                        geopkg.addGeometryColumnsEntry(fe1);
                    }
                }
            }
        } catch (IOException e) {
            throw new SQLException(e);
View Full Code Here

        return super.createCRS(srid, cx);
    }

    GeoPackage geopkg() {
        return new GeoPackage(dataStore);
    }
View Full Code Here

   
    public GeoPackageReader(Object source, Hints hints) throws IOException {
       coverageFactory = CoverageFactoryFinder.getGridCoverageFactory(this.hints);
      
       sourceFile = GeoPackageFormat.getFileFromSource(source);
       GeoPackage file = new GeoPackage(sourceFile);
       try {
            for (TileEntry tile : file.tiles()){
                tiles.put(tile.getTableName(), tile);
            }
       } finally {
           file.close();
       }
    }
View Full Code Here

TOP

Related Classes of org.geotools.geopkg.GeoPackage

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.