Java Code Examples for mil.nga.geopackage.features.user.FeatureDao#newRow()
The following examples show how to use
mil.nga.geopackage.features.user.FeatureDao#newRow() .
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 | 6 votes |
public static long insertPolygon(FeatureDao featureDao, double[][]... points) { FeatureRow featureRow = featureDao.newRow(); GeoPackageGeometryData geomData = new GeoPackageGeometryData( ProjectionConstants.EPSG_WORLD_GEODETIC_SYSTEM); Polygon polygon = new Polygon(false, false); for (double[][] ring : points) { LineString lineString = getLineString(ring); polygon.addRing(lineString); } geomData.setGeometry(polygon); featureRow.setGeometry(geomData); return featureDao.insert(featureRow); }
Example 2
Source File: TransactionTest.java From geopackage-android with MIT License | 5 votes |
/** * Insert a row into the feature table * * @param featureDao feature dao */ private void insertRow(FeatureDao featureDao) { FeatureRow row = featureDao.newRow(); GeoPackageGeometryData geometry = new GeoPackageGeometryData( featureDao.getGeometryColumns().getSrsId()); geometry.setGeometry(new Point(0, 0)); row.setGeometry(geometry); featureDao.insert(row); }
Example 3
Source File: FeatureTileUtils.java From geopackage-android with MIT License | 5 votes |
public static long insertLine(FeatureDao featureDao, double[][] points) { FeatureRow featureRow = featureDao.newRow(); GeoPackageGeometryData geomData = new GeoPackageGeometryData( ProjectionConstants.EPSG_WORLD_GEODETIC_SYSTEM); LineString lineString = getLineString(points); geomData.setGeometry(lineString); featureRow.setGeometry(geomData); return featureDao.insert(featureRow); }
Example 4
Source File: TransactionTest.java From geopackage-java with MIT License | 5 votes |
/** * Insert a row into the feature table * * @param featureDao * feature dao */ private void insertRow(FeatureDao featureDao) { FeatureRow row = featureDao.newRow(); GeoPackageGeometryData geometry = new GeoPackageGeometryData(featureDao .getGeometryColumns().getSrsId()); geometry.setGeometry(new Point(0, 0)); row.setGeometry(geometry); featureDao.insert(row); }
Example 5
Source File: FeatureTileUtils.java From geopackage-java with MIT License | 5 votes |
public static long insertLine(FeatureDao featureDao, double[][] points) { FeatureRow featureRow = featureDao.newRow(); GeoPackageGeometryData geomData = new GeoPackageGeometryData( ProjectionConstants.EPSG_WORLD_GEODETIC_SYSTEM); LineString lineString = getLineString(points); geomData.setGeometry(lineString); featureRow.setGeometry(geomData); return featureDao.insert(featureRow); }
Example 6
Source File: FeatureTileUtils.java From geopackage-java with MIT License | 5 votes |
public static long insertPolygon(FeatureDao featureDao, double[][]... points) { FeatureRow featureRow = featureDao.newRow(); GeoPackageGeometryData geomData = new GeoPackageGeometryData( ProjectionConstants.EPSG_WORLD_GEODETIC_SYSTEM); Polygon polygon = new Polygon(false, false); for (double[][] ring : points) { LineString lineString = getLineString(ring); polygon.addRing(lineString); } geomData.setGeometry(polygon); featureRow.setGeometry(geomData); return featureDao.insert(featureRow); }
Example 7
Source File: FeatureTileUtils.java From geopackage-android with MIT License | 4 votes |
public static long insertPoint(FeatureDao featureDao, double x, double y) { FeatureRow featureRow = featureDao.newRow(); setPoint(featureRow, x, y); return featureDao.insert(featureRow); }
Example 8
Source File: GeoPackageTestUtils.java From geopackage-android with MIT License | 4 votes |
/** * Validate feature table with metadata * * @param geoPackage * @throws SQLException */ private static void validateFeatureTableWithMetadata(GeoPackage geoPackage, GeometryColumns geometryColumns, String idColumn, List<FeatureColumn> additionalColumns) throws SQLException { GeometryColumnsDao dao = geoPackage.getGeometryColumnsDao(); GeometryColumns queryGeometryColumns = dao.queryForId(geometryColumns .getId()); TestCase.assertNotNull(queryGeometryColumns); TestCase.assertEquals(geometryColumns.getTableName(), queryGeometryColumns.getTableName()); TestCase.assertEquals(geometryColumns.getColumnName(), queryGeometryColumns.getColumnName()); TestCase.assertEquals(GeometryType.POINT, queryGeometryColumns.getGeometryType()); TestCase.assertEquals(geometryColumns.getZ(), queryGeometryColumns.getZ()); TestCase.assertEquals(geometryColumns.getM(), queryGeometryColumns.getM()); FeatureDao featureDao = geoPackage.getFeatureDao(geometryColumns .getTableName()); FeatureRow featureRow = featureDao.newRow(); TestCase.assertEquals( 2 + (additionalColumns != null ? additionalColumns.size() : 0), featureRow.columnCount()); if (idColumn == null) { idColumn = "id"; } TestCase.assertEquals(idColumn, featureRow.getColumnName(0)); TestCase.assertEquals(geometryColumns.getColumnName(), featureRow.getColumnName(1)); if (additionalColumns != null) { TestCase.assertEquals("test_text", featureRow.getColumnName(2)); TestCase.assertEquals("test_real", featureRow.getColumnName(3)); TestCase.assertEquals("test_boolean", featureRow.getColumnName(4)); TestCase.assertEquals("test_blob", featureRow.getColumnName(5)); TestCase.assertEquals("test_integer", featureRow.getColumnName(6)); TestCase.assertEquals("test_text_limited", featureRow.getColumnName(7)); TestCase.assertEquals("test_blob_limited", featureRow.getColumnName(8)); } }
Example 9
Source File: FeatureTileUtils.java From geopackage-java with MIT License | 4 votes |
public static long insertPoint(FeatureDao featureDao, double x, double y) { FeatureRow featureRow = featureDao.newRow(); setPoint(featureRow, x, y); return featureDao.insert(featureRow); }
Example 10
Source File: GeoPackageTestUtils.java From geopackage-java with MIT License | 4 votes |
/** * Validate feature table with metadata * * @param geoPackage * @throws SQLException */ private static void validateFeatureTableWithMetadata(GeoPackage geoPackage, GeometryColumns geometryColumns, String idColumn, List<FeatureColumn> additionalColumns) throws SQLException { GeometryColumnsDao dao = geoPackage.getGeometryColumnsDao(); GeometryColumns queryGeometryColumns = dao .queryForId(geometryColumns.getId()); TestCase.assertNotNull(queryGeometryColumns); TestCase.assertEquals(geometryColumns.getTableName(), queryGeometryColumns.getTableName()); TestCase.assertEquals(geometryColumns.getColumnName(), queryGeometryColumns.getColumnName()); TestCase.assertEquals(GeometryType.POINT, queryGeometryColumns.getGeometryType()); TestCase.assertEquals(geometryColumns.getZ(), queryGeometryColumns.getZ()); TestCase.assertEquals(geometryColumns.getM(), queryGeometryColumns.getM()); FeatureDao featureDao = geoPackage .getFeatureDao(geometryColumns.getTableName()); FeatureRow featureRow = featureDao.newRow(); TestCase.assertEquals( 2 + (additionalColumns != null ? additionalColumns.size() : 0), featureRow.columnCount()); if (idColumn == null) { idColumn = "id"; } TestCase.assertEquals(idColumn, featureRow.getColumnName(0)); TestCase.assertEquals(geometryColumns.getColumnName(), featureRow.getColumnName(1)); if (additionalColumns != null) { TestCase.assertEquals("test_text", featureRow.getColumnName(2)); TestCase.assertEquals("test_real", featureRow.getColumnName(3)); TestCase.assertEquals("test_boolean", featureRow.getColumnName(4)); TestCase.assertEquals("test_blob", featureRow.getColumnName(5)); TestCase.assertEquals("test_integer", featureRow.getColumnName(6)); TestCase.assertEquals("test_text_limited", featureRow.getColumnName(7)); TestCase.assertEquals("test_blob_limited", featureRow.getColumnName(8)); } }