Java Code Examples for mil.nga.geopackage.features.user.FeatureDao#insert()

The following examples show how to use mil.nga.geopackage.features.user.FeatureDao#insert() . These examples are extracted from open source projects. 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 Project: geopackage-android   File: FeatureTileUtils.java    License: MIT License 6 votes vote down vote up
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 Project: geopackage-android   File: TransactionTest.java    License: MIT License 5 votes vote down vote up
/**
 * 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 Project: geopackage-android   File: FeatureTileUtils.java    License: MIT License 5 votes vote down vote up
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 Project: geopackage-java   File: TransactionTest.java    License: MIT License 5 votes vote down vote up
/**
 * 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 Project: geopackage-java   File: FeatureTileUtils.java    License: MIT License 5 votes vote down vote up
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 Project: geopackage-java   File: FeatureTileUtils.java    License: MIT License 5 votes vote down vote up
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 Project: geopackage-android   File: FeatureTileUtils.java    License: MIT License 4 votes vote down vote up
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 Project: geopackage-java   File: FeatureTileUtils.java    License: MIT License 4 votes vote down vote up
public static long insertPoint(FeatureDao featureDao, double x, double y) {
	FeatureRow featureRow = featureDao.newRow();
	setPoint(featureRow, x, y);
	return featureDao.insert(featureRow);
}