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() . 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 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 File: TransactionTest.java    From geopackage-android with 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 File: FeatureTileUtils.java    From geopackage-android with 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 File: TransactionTest.java    From geopackage-java with 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 File: FeatureTileUtils.java    From geopackage-java with 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 File: FeatureTileUtils.java    From geopackage-java with 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 File: FeatureTileUtils.java    From geopackage-android with 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 File: FeatureTileUtils.java    From geopackage-java with 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);
}