Java Code Examples for mil.nga.geopackage.GeoPackage#createFeatureTableWithMetadata()
The following examples show how to use
mil.nga.geopackage.GeoPackage#createFeatureTableWithMetadata() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: FeatureTileUtils.java From geopackage-android with MIT License | 7 votes |
/** * Create feature dao * * @return */ public static FeatureDao createFeatureDao(GeoPackage geoPackage) { BoundingBox boundingBox = new BoundingBox(); GeometryColumns geometryColumns = new GeometryColumns(); geometryColumns.setId(new TableColumnKey("feature_tiles", "geom")); geometryColumns.setGeometryType(GeometryType.GEOMETRY); geometryColumns.setZ((byte) 0); geometryColumns.setM((byte) 0); geoPackage.createFeatureTableWithMetadata( geometryColumns, boundingBox, ProjectionConstants.EPSG_WORLD_GEODETIC_SYSTEM); FeatureDao featureDao = geoPackage.getFeatureDao(geometryColumns); return featureDao; }
Example 2
Source File: GeoPackageTestUtils.java From geopackage-android with MIT License | 6 votes |
/** * Test create feature table with metadata * * @param geoPackage * @throws SQLException */ public static void testCreateFeatureTableWithMetadata(GeoPackage geoPackage) throws SQLException { GeometryColumns geometryColumns = new GeometryColumns(); geometryColumns.setId(new TableColumnKey("feature_metadata", "geom")); geometryColumns.setGeometryType(GeometryType.POINT); geometryColumns.setZ((byte) 1); geometryColumns.setM((byte) 0); BoundingBox boundingBox = new BoundingBox(-90, -45, 90, 45); SpatialReferenceSystem srs = geoPackage.getSpatialReferenceSystemDao().getOrCreateCode( ProjectionConstants.AUTHORITY_EPSG, ProjectionConstants.EPSG_WEB_MERCATOR); geometryColumns = geoPackage.createFeatureTableWithMetadata( geometryColumns, boundingBox, srs.getId()); validateFeatureTableWithMetadata(geoPackage, geometryColumns, null, null); }
Example 3
Source File: GeoPackageTestUtils.java From geopackage-android with MIT License | 6 votes |
/** * Test create feature table with metadata and id column * * @param geoPackage * @throws SQLException */ public static void testCreateFeatureTableWithMetadataIdColumn( GeoPackage geoPackage) throws SQLException { GeometryColumns geometryColumns = new GeometryColumns(); geometryColumns.setId(new TableColumnKey("feature_metadata2", "geom2")); geometryColumns.setGeometryType(GeometryType.POINT); geometryColumns.setZ((byte) 1); geometryColumns.setM((byte) 0); BoundingBox boundingBox = new BoundingBox(-90, -45, 90, 45); SpatialReferenceSystem srs = geoPackage.getSpatialReferenceSystemDao().getOrCreateCode( ProjectionConstants.AUTHORITY_EPSG, ProjectionConstants.EPSG_WEB_MERCATOR); String idColumn = "my_id"; geometryColumns = geoPackage.createFeatureTableWithMetadata( geometryColumns, idColumn, boundingBox, srs.getId()); validateFeatureTableWithMetadata(geoPackage, geometryColumns, idColumn, null); }
Example 4
Source File: GeoPackageTestUtils.java From geopackage-android with MIT License | 6 votes |
/** * Test create feature table with metadata and additional columns * * @param geoPackage * @throws SQLException */ public static void testCreateFeatureTableWithMetadataAdditionalColumns( GeoPackage geoPackage) throws SQLException { GeometryColumns geometryColumns = new GeometryColumns(); geometryColumns.setId(new TableColumnKey("feature_metadata3", "geom3")); geometryColumns.setGeometryType(GeometryType.POINT); geometryColumns.setZ((byte) 1); geometryColumns.setM((byte) 0); BoundingBox boundingBox = new BoundingBox(-90, -45, 90, 45); List<FeatureColumn> additionalColumns = getFeatureColumns(); SpatialReferenceSystem srs = geoPackage.getSpatialReferenceSystemDao().getOrCreateCode( ProjectionConstants.AUTHORITY_EPSG, ProjectionConstants.EPSG_WEB_MERCATOR); geometryColumns = geoPackage.createFeatureTableWithMetadata( geometryColumns, additionalColumns, boundingBox, srs.getId()); validateFeatureTableWithMetadata(geoPackage, geometryColumns, null, additionalColumns); }
Example 5
Source File: GeoPackageTestUtils.java From geopackage-android with MIT License | 6 votes |
/** * Test create feature table with metadata, id column, and additional * columns * * @param geoPackage * @throws SQLException */ public static void testCreateFeatureTableWithMetadataIdColumnAdditionalColumns( GeoPackage geoPackage) throws SQLException { GeometryColumns geometryColumns = new GeometryColumns(); geometryColumns.setId(new TableColumnKey("feature_metadata4", "geom4")); geometryColumns.setGeometryType(GeometryType.POINT); geometryColumns.setZ((byte) 1); geometryColumns.setM((byte) 0); BoundingBox boundingBox = new BoundingBox(-90, -45, 90, 45); List<FeatureColumn> additionalColumns = getFeatureColumns(); SpatialReferenceSystem srs = geoPackage.getSpatialReferenceSystemDao().getOrCreateCode( ProjectionConstants.AUTHORITY_EPSG, ProjectionConstants.EPSG_WEB_MERCATOR); String idColumn = "my_other_id"; geometryColumns = geoPackage.createFeatureTableWithMetadata( geometryColumns, idColumn, additionalColumns, boundingBox, srs.getId()); validateFeatureTableWithMetadata(geoPackage, geometryColumns, idColumn, additionalColumns); }
Example 6
Source File: GeoPackageRepository.java From geopackage-mapcache-android with MIT License | 6 votes |
/** * Create feature table in the given geopackage */ public boolean createFeatureTable(String gpName, BoundingBox boundingBox, GeometryType geometryType, String tableName){ GeometryColumns geometryColumns = new GeometryColumns(); geometryColumns.setId(new TableColumnKey(tableName, "geom")); geometryColumns.setGeometryType(geometryType); geometryColumns.setZ((byte) 0); geometryColumns.setM((byte) 0); GeoPackage geoPackage = manager.open(gpName); try { GeometryColumns created = geoPackage.createFeatureTableWithMetadata( geometryColumns, boundingBox, ProjectionConstants.EPSG_WORLD_GEODETIC_SYSTEM); if(created != null) { return true; } } finally { geoPackage.close(); } return false; }
Example 7
Source File: FeatureTileUtils.java From geopackage-java with MIT License | 6 votes |
/** * Create feature dao * * @return feature dao */ public static FeatureDao createFeatureDao(GeoPackage geoPackage) { BoundingBox boundingBox = new BoundingBox(); GeometryColumns geometryColumns = new GeometryColumns(); geometryColumns.setId(new TableColumnKey(TABLE_NAME, "geom")); geometryColumns.setGeometryType(GeometryType.GEOMETRY); geometryColumns.setZ((byte) 0); geometryColumns.setM((byte) 0); geoPackage.createFeatureTableWithMetadata(geometryColumns, boundingBox, ProjectionConstants.EPSG_WORLD_GEODETIC_SYSTEM); FeatureDao featureDao = geoPackage.getFeatureDao(geometryColumns); return featureDao; }
Example 8
Source File: GeoPackageTestUtils.java From geopackage-java with MIT License | 6 votes |
/** * Test create feature table with metadata * * @param geoPackage * @throws SQLException */ public static void testCreateFeatureTableWithMetadata(GeoPackage geoPackage) throws SQLException { GeometryColumns geometryColumns = new GeometryColumns(); geometryColumns.setId(new TableColumnKey("feature_metadata", "geom")); geometryColumns.setGeometryType(GeometryType.POINT); geometryColumns.setZ((byte) 1); geometryColumns.setM((byte) 0); BoundingBox boundingBox = new BoundingBox(-90, -45, 90, 45); SpatialReferenceSystem srs = geoPackage.getSpatialReferenceSystemDao() .getOrCreateCode(ProjectionConstants.AUTHORITY_EPSG, ProjectionConstants.EPSG_WEB_MERCATOR); geometryColumns = geoPackage.createFeatureTableWithMetadata( geometryColumns, boundingBox, srs.getId()); validateFeatureTableWithMetadata(geoPackage, geometryColumns, null, null); }
Example 9
Source File: GeoPackageTestUtils.java From geopackage-java with MIT License | 6 votes |
/** * Test create feature table with metadata and id column * * @param geoPackage * @throws SQLException */ public static void testCreateFeatureTableWithMetadataIdColumn( GeoPackage geoPackage) throws SQLException { GeometryColumns geometryColumns = new GeometryColumns(); geometryColumns.setId(new TableColumnKey("feature_metadata2", "geom2")); geometryColumns.setGeometryType(GeometryType.POINT); geometryColumns.setZ((byte) 1); geometryColumns.setM((byte) 0); BoundingBox boundingBox = new BoundingBox(-90, -45, 90, 45); SpatialReferenceSystem srs = geoPackage.getSpatialReferenceSystemDao() .getOrCreateCode(ProjectionConstants.AUTHORITY_EPSG, ProjectionConstants.EPSG_WEB_MERCATOR); String idColumn = "my_id"; geometryColumns = geoPackage.createFeatureTableWithMetadata( geometryColumns, idColumn, boundingBox, srs.getId()); validateFeatureTableWithMetadata(geoPackage, geometryColumns, idColumn, null); }
Example 10
Source File: GeoPackageTestUtils.java From geopackage-java with MIT License | 6 votes |
/** * Test create feature table with metadata and additional columns * * @param geoPackage * @throws SQLException */ public static void testCreateFeatureTableWithMetadataAdditionalColumns( GeoPackage geoPackage) throws SQLException { GeometryColumns geometryColumns = new GeometryColumns(); geometryColumns.setId(new TableColumnKey("feature_metadata", "geom")); geometryColumns.setGeometryType(GeometryType.POINT); geometryColumns.setZ((byte) 1); geometryColumns.setM((byte) 0); BoundingBox boundingBox = new BoundingBox(-90, -45, 90, 45); List<FeatureColumn> additionalColumns = getFeatureColumns(); SpatialReferenceSystem srs = geoPackage.getSpatialReferenceSystemDao() .getOrCreateCode(ProjectionConstants.AUTHORITY_EPSG, ProjectionConstants.EPSG_WEB_MERCATOR); geometryColumns = geoPackage.createFeatureTableWithMetadata( geometryColumns, additionalColumns, boundingBox, srs.getId()); validateFeatureTableWithMetadata(geoPackage, geometryColumns, null, additionalColumns); }
Example 11
Source File: GeoPackageTestUtils.java From geopackage-java with MIT License | 6 votes |
/** * Test create feature table with metadata, id column, and additional * columns * * @param geoPackage * @throws SQLException */ public static void testCreateFeatureTableWithMetadataIdColumnAdditionalColumns( GeoPackage geoPackage) throws SQLException { GeometryColumns geometryColumns = new GeometryColumns(); geometryColumns.setId(new TableColumnKey("feature_metadata", "geom")); geometryColumns.setGeometryType(GeometryType.POINT); geometryColumns.setZ((byte) 1); geometryColumns.setM((byte) 0); BoundingBox boundingBox = new BoundingBox(-90, -45, 90, 45); List<FeatureColumn> additionalColumns = getFeatureColumns(); SpatialReferenceSystem srs = geoPackage.getSpatialReferenceSystemDao() .getOrCreateCode(ProjectionConstants.AUTHORITY_EPSG, ProjectionConstants.EPSG_WEB_MERCATOR); String idColumn = "my_other_id"; geometryColumns = geoPackage.createFeatureTableWithMetadata( geometryColumns, idColumn, additionalColumns, boundingBox, srs.getId()); validateFeatureTableWithMetadata(geoPackage, geometryColumns, idColumn, additionalColumns); }
Example 12
Source File: FeatureIndexManagerUtils.java From geopackage-android with MIT License | 5 votes |
/** * Test large index * * @param activity activity * @param geoPackage GeoPackage * @param numFeatures num features * @param verbose verbose printing * @throws SQLException upon error */ public static void testLargeIndex(Activity activity, GeoPackage geoPackage, int numFeatures, boolean verbose) throws SQLException { String featureTable = "large_index"; GeometryColumns geometryColumns = new GeometryColumns(); geometryColumns.setId(new TableColumnKey(featureTable, "geom")); geometryColumns.setGeometryType(GeometryType.POLYGON); geometryColumns.setZ((byte) 0); geometryColumns.setM((byte) 0); BoundingBox boundingBox = new BoundingBox(-180, -90, 180, 90); SpatialReferenceSystem srs = geoPackage.getSpatialReferenceSystemDao() .getOrCreateCode(ProjectionConstants.AUTHORITY_EPSG, ProjectionConstants.EPSG_WORLD_GEODETIC_SYSTEM); List<FeatureColumn> additionalColumns = GeoPackageTestUtils .getFeatureColumns(); geometryColumns = geoPackage.createFeatureTableWithMetadata( geometryColumns, additionalColumns, boundingBox, srs.getId()); FeatureDao featureDao = geoPackage.getFeatureDao(geometryColumns); System.out.println(); System.out.println("Inserting Feature Rows: " + numFeatures); TestUtils.addRowsToFeatureTable(geoPackage, geometryColumns, featureDao.getTable(), numFeatures, false, false, false); testTimedIndex(activity, geoPackage, featureTable, true, verbose); }
Example 13
Source File: FeatureIndexManagerUtils.java From geopackage-java with MIT License | 5 votes |
/** * Test large index * * @param geoPackage * GeoPackage * @param numFeatures * num features * @param verbose * verbose printing * @throws SQLException * upon error */ public static void testLargeIndex(GeoPackage geoPackage, int numFeatures, boolean verbose) throws SQLException { String featureTable = "large_index"; GeometryColumns geometryColumns = new GeometryColumns(); geometryColumns.setId(new TableColumnKey(featureTable, "geom")); geometryColumns.setGeometryType(GeometryType.POLYGON); geometryColumns.setZ((byte) 0); geometryColumns.setM((byte) 0); BoundingBox boundingBox = new BoundingBox(-180, -90, 180, 90); SpatialReferenceSystem srs = geoPackage.getSpatialReferenceSystemDao() .getOrCreateCode(ProjectionConstants.AUTHORITY_EPSG, ProjectionConstants.EPSG_WORLD_GEODETIC_SYSTEM); List<FeatureColumn> additionalColumns = GeoPackageTestUtils .getFeatureColumns(); geometryColumns = geoPackage.createFeatureTableWithMetadata( geometryColumns, additionalColumns, boundingBox, srs.getId()); FeatureDao featureDao = geoPackage.getFeatureDao(geometryColumns); System.out.println(); System.out.println("Inserting Feature Rows: " + numFeatures); TestUtils.addRowsToFeatureTable(geoPackage, geometryColumns, featureDao.getTable(), numFeatures, false, false, false); testTimedIndex(geoPackage, featureTable, true, verbose); }