mil.nga.geopackage.features.user.FeatureCursor Java Examples

The following examples show how to use mil.nga.geopackage.features.user.FeatureCursor. 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: FeatureIndexer.java    From geopackage-android with MIT License 5 votes vote down vote up
/**
 * Index the feature table
 *
 * @return count
 */
private int indexTable() {

    int count = 0;

    // Get or create the table metadata
    TableMetadataDataSource tableDs = new TableMetadataDataSource(db);
    TableMetadata metadata = tableDs.getOrCreate(featureDao.getDatabase(), featureDao.getTableName());

    // Delete existing index rows
    geometryMetadataDataSource.delete(featureDao.getDatabase(), featureDao.getTableName());

    long offset = 0;
    int chunkCount = 0;

    // Index all features
    while (chunkCount >= 0) {

        FeatureCursor cursor = featureDao.queryForChunk(chunkLimit, offset);
        chunkCount = indexRows(metadata.getGeoPackageId(), cursor);

        if (chunkCount > 0) {
            count += chunkCount;
        }

        offset += chunkLimit;
    }

    // Update the last indexed time
    if (progress == null || progress.isActive()) {
        updateLastIndexed(db, metadata.getGeoPackageId());
    }

    return count;
}
 
Example #2
Source File: DefaultFeatureTiles.java    From geopackage-android with MIT License 5 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public Bitmap drawTile(int zoom, BoundingBox boundingBox, FeatureCursor cursor) {

    FeatureTileCanvas canvas = new FeatureTileCanvas(tileWidth, tileHeight);

    ProjectionTransform transform = getProjectionToWebMercatorTransform(featureDao.getProjection());
    BoundingBox expandedBoundingBox = expandBoundingBox(boundingBox);

    boolean drawn = false;
    while (cursor.moveToNext()) {
        FeatureRow row = cursor.getRow();
        if (drawFeature(zoom, boundingBox, expandedBoundingBox, transform, canvas, row)) {
            drawn = true;
        }
    }
    cursor.close();

    Bitmap bitmap = null;
    if (drawn) {
        bitmap = canvas.createBitmap();
        bitmap = checkIfDrawn(bitmap);
    } else {
        canvas.recycle();
    }

    return bitmap;
}
 
Example #3
Source File: FeatureIndexManager.java    From geopackage-android with MIT License 5 votes vote down vote up
/**
 * Query for feature index results within the Geometry Envelope
 *
 * @param columns   columns
 * @param envelope  geometry envelope
 * @param where     where clause
 * @param whereArgs where arguments
 * @return feature index results, close when done
 * @since 3.5.0
 */
public FeatureIndexResults query(String[] columns,
                                 GeometryEnvelope envelope, String where, String[] whereArgs) {
    FeatureIndexResults results = null;
    for (FeatureIndexType type : getLocation()) {
        try {
            switch (type) {
                case GEOPACKAGE:
                    FeatureCursor geoPackageCursor = featureTableIndex
                            .queryFeatures(columns, envelope, where, whereArgs);
                    results = new FeatureIndexFeatureResults(
                            geoPackageCursor);
                    break;
                case METADATA:
                    FeatureCursor geometryMetadataCursor = featureIndexer.queryFeatures(columns, envelope, where, whereArgs);
                    results = new FeatureIndexFeatureResults(geometryMetadataCursor);
                    break;
                case RTREE:
                    FeatureCursor rTreeCursor = rTreeIndexTableDao
                            .queryFeatures(columns, envelope, where, whereArgs);
                    results = new FeatureIndexFeatureResults(rTreeCursor);
                    break;
                default:
                    throw new GeoPackageException(
                            "Unsupported feature index type: " + type);
            }
            break;
        } catch (Exception e) {
            if (continueOnError) {
                Log.e(FeatureIndexManager.class.getSimpleName(), "Failed to query from feature index: " + type, e);
            } else {
                throw e;
            }
        }
    }
    if (results == null) {
        results = manualFeatureQuery.query(columns, envelope, where, whereArgs);
    }
    return results;
}
 
Example #4
Source File: FeatureIndexer.java    From geopackage-android with MIT License 5 votes vote down vote up
/**
 * Query using the id query and criteria
 *
 * @param idQuery   id query
 * @param where     where statement
 * @param whereArgs where args
 * @return feature cursor
 */
private FeatureCursor query(FeatureIndexerIdQuery idQuery, String where, String[] whereArgs) {
    FeatureCursor cursor = null;
    if (idQuery.aboveMaxArguments(whereArgs)) {
        cursor = new FeatureIndexerIdCursor(featureDao.query(where, whereArgs), idQuery);
    } else {
        cursor = featureDao.queryIn(idQuery.getSql(), idQuery.getArgs(), where, whereArgs);
    }
    return cursor;
}
 
Example #5
Source File: GeoPackageExample.java    From geopackage-android with MIT License 5 votes vote down vote up
private static void createFeatureStylesGeometry2(GeoPackage geoPackage,
                                                 List<StyleRow> styles, List<IconRow> icons) throws IOException {

    FeatureDao featureDao = geoPackage.getFeatureDao("geometry2");
    FeatureTableStyles geometry2Styles = new FeatureTableStyles(geoPackage,
            featureDao.getTable());

    geometry2Styles.setTableStyle(GeometryType.POINT, styles.get(0));
    geometry2Styles.setTableStyle(GeometryType.LINESTRING, styles.get(1));
    geometry2Styles.setTableStyle(GeometryType.POLYGON, styles.get(0));
    geometry2Styles.setTableStyle(GeometryType.GEOMETRY, styles.get(2));

    geometry2Styles.createStyleRelationship();
    geometry2Styles.createIconRelationship();

    FeatureCursor features = featureDao.queryForAll();
    while (features.moveToNext()) {
        FeatureRow featureRow = features.getRow();
        switch (featureRow.getGeometryType()) {
            case POINT:
                geometry2Styles.setIcon(featureRow, icons.get(0));
                break;
            case LINESTRING:
                geometry2Styles.setStyle(featureRow, styles.get(0));
                break;
            case POLYGON:
                geometry2Styles.setStyle(featureRow, styles.get(1));
                break;
            default:
        }
    }
    features.close();

}
 
Example #6
Source File: FeatureIndexer.java    From geopackage-android with MIT License 5 votes vote down vote up
/**
 * Index the feature rows in the cursor
 *
 * @param geoPackageId GeoPackage id
 * @param cursor       feature cursor
 * @return count, -1 if no results or canceled
 */
private int indexRows(long geoPackageId, FeatureCursor cursor) {

    int count = -1;

    try {
        while ((progress == null || progress.isActive())
                && cursor.moveToNext()) {
            if (count < 0) {
                count++;
            }
            try {
                FeatureRow row = cursor.getRow();
                if (row.isValid()) {
                    boolean indexed = index(geoPackageId, row, false);
                    if (indexed) {
                        count++;
                    }
                    if (progress != null) {
                        progress.addProgress(1);
                    }
                }
            } catch (Exception e) {
                Log.e(FeatureIndexer.class.getSimpleName(), "Failed to index feature. Table: "
                        + featureDao.getTableName() + ", Position: " + cursor.getPosition(), e);
            }
        }
    } finally {
        cursor.close();
    }

    return count;
}
 
Example #7
Source File: GeoPackageExample.java    From geopackage-android with MIT License 4 votes vote down vote up
private static void insertRelatedTablesMediaExtensionRows(Activity activity, Context testContext,
                                                          GeoPackage geoPackage, ExtendedRelation relation, String query,
                                                          String name, String file, String contentType, String description,
                                                          String source) throws IOException {

    RelatedTablesExtension relatedTables = new RelatedTablesExtension(
            geoPackage);

    FeatureDao featureDao = geoPackage.getFeatureDao(relation
            .getBaseTableName());
    MediaDao mediaDao = relatedTables.getMediaDao(relation);
    UserMappingDao userMappingDao = relatedTables.getMappingDao(relation);

    MediaRow mediaRow = mediaDao.newRow();

    TestUtils.copyAssetFileToInternalStorage(activity, testContext, file);
    String mediaImageName = TestUtils.getAssetFileInternalStorageLocation(activity, file);
    Bitmap mediaImage = BitmapFactory.decodeFile(mediaImageName);

    mediaRow.setData(mediaImage, Bitmap.CompressFormat.PNG);
    mediaRow.setContentType(contentType);
    RelatedTablesUtils.populateUserRow(mediaDao.getTable(), mediaRow,
            MediaTable.requiredColumns());
    DublinCoreMetadata.setValue(mediaRow, DublinCoreType.TITLE, name);
    DublinCoreMetadata.setValue(mediaRow, DublinCoreType.DESCRIPTION,
            description);
    DublinCoreMetadata.setValue(mediaRow, DublinCoreType.SOURCE, source);
    long mediaRowId = mediaDao.create(mediaRow);

    FeatureCursor featureCursor = featureDao.queryForLike(
            TEXT_COLUMN, query);
    while (featureCursor.moveToNext()) {
        FeatureRow featureRow = featureCursor.getRow();
        UserMappingRow userMappingRow = userMappingDao.newRow();
        userMappingRow.setBaseId(featureRow.getId());
        userMappingRow.setRelatedId(mediaRowId);
        RelatedTablesUtils.populateUserRow(userMappingDao.getTable(),
                userMappingRow, UserMappingTable.requiredColumns());
        String featureName = featureRow.getValue(TEXT_COLUMN).toString();
        DublinCoreMetadata.setValue(userMappingRow, DublinCoreType.TITLE,
                featureName + " - " + name);
        DublinCoreMetadata.setValue(userMappingRow,
                DublinCoreType.DESCRIPTION, featureName + " - "
                        + description);
        DublinCoreMetadata.setValue(userMappingRow, DublinCoreType.SOURCE,
                source);
        userMappingDao.create(userMappingRow);
    }
    featureCursor.close();
}
 
Example #8
Source File: FeatureUtils.java    From geopackage-android with MIT License 4 votes vote down vote up
/**
 * Test delete
 *
 * @param geoPackage GeoPackage
 * @throws SQLException upon error
 */
public static void testDelete(GeoPackage geoPackage) throws SQLException {

    GeometryColumnsDao geometryColumnsDao = geoPackage
            .getGeometryColumnsDao();

    if (geometryColumnsDao.isTableExists()) {
        List<GeometryColumns> results = geometryColumnsDao.queryForAll();

        for (GeometryColumns geometryColumns : results) {

            FeatureDao dao = geoPackage.getFeatureDao(geometryColumns);
            TestCase.assertNotNull(dao);

            FeatureCursor cursor = dao.queryForAll();
            int count = cursor.getCount();
            if (count > 0) {

                // Choose random feature
                int random = (int) (Math.random() * count);
                cursor.moveToPosition(random);

                FeatureRow featureRow = cursor.getRow();
                cursor.close();

                // Delete row
                try {
                    TestCase.assertEquals(1, dao.delete(featureRow));
                } catch (SQLiteException e) {
                    if (TestUtils.isFutureSQLiteException(e)) {
                        continue;
                    } else {
                        throw e;
                    }
                }

                // Verify deleted
                FeatureRow queryFeatureRow = dao.queryForIdRow(featureRow
                        .getId());
                TestCase.assertNull(queryFeatureRow);
                cursor = dao.queryForAll();
                TestCase.assertEquals(count - 1, cursor.getCount());
                cursor.close();
            }
            cursor.close();
        }
    }
}
 
Example #9
Source File: GeoPackageGeometryDataUtils.java    From geopackage-android with MIT License 4 votes vote down vote up
/**
 * Test transforming geometries between projections
 *
 * @param geoPackage
 * @throws SQLException
 * @throws IOException
 */
public static void testGeometryProjectionTransform(GeoPackage geoPackage)
        throws SQLException, IOException {

    GeometryColumnsDao geometryColumnsDao = geoPackage
            .getGeometryColumnsDao();

    if (geometryColumnsDao.isTableExists()) {
        List<GeometryColumns> results = geometryColumnsDao.queryForAll();

        for (GeometryColumns geometryColumns : results) {

            FeatureDao dao = geoPackage.getFeatureDao(geometryColumns);
            TestCase.assertNotNull(dao);

            FeatureCursor cursor = dao.queryForAll();

            while (cursor.moveToNext()) {

                GeoPackageGeometryData geometryData = cursor.getGeometry();
                if (geometryData != null) {

                    Geometry geometry = geometryData.getGeometry();

                    if (geometry != null) {

                        SpatialReferenceSystemDao srsDao = geoPackage
                                .getSpatialReferenceSystemDao();
                        long srsId = geometryData.getSrsId();
                        SpatialReferenceSystem srs = srsDao
                                .queryForId(srsId);

                        long epsg = srs.getOrganizationCoordsysId();
                        Projection projection = srs.getProjection();
                        long toEpsg = -1;
                        if (epsg == ProjectionConstants.EPSG_WORLD_GEODETIC_SYSTEM) {
                            toEpsg = ProjectionConstants.EPSG_WEB_MERCATOR;
                        } else {
                            toEpsg = ProjectionConstants.EPSG_WORLD_GEODETIC_SYSTEM;
                        }
                        ProjectionTransform transformTo = projection
                                .getTransformation(toEpsg);
                        ProjectionTransform transformFrom = srs.getTransformation(transformTo
                                .getToProjection());

                        byte[] bytes = geometryData.getWkbBytes();

                        Geometry projectedGeometry = transformTo
                                .transform(geometry);
                        GeoPackageGeometryData projectedGeometryData = new GeoPackageGeometryData(
                                -1);
                        projectedGeometryData
                                .setGeometry(projectedGeometry);
                        projectedGeometryData.toBytes();
                        byte[] projectedBytes = projectedGeometryData
                                .getWkbBytes();

                        if (epsg > 0) {
                            TestCase.assertFalse(equalByteArrays(bytes,
                                    projectedBytes));
                        }

                        Geometry restoredGeometry = transformFrom
                                .transform(projectedGeometry);

                        compareGeometries(geometry, restoredGeometry, .001);
                    }
                }

            }
            cursor.close();
        }
    }
}
 
Example #10
Source File: GoogleMapShapeConverterUtils.java    From geopackage-android-map with MIT License 4 votes vote down vote up
/**
 * Test shapes
 * 
 * @param geoPackage
 * @throws SQLException
 */
public static void testShapes(GeoPackage geoPackage) throws SQLException {

	GeometryColumnsDao geometryColumnsDao = geoPackage
			.getGeometryColumnsDao();

	if (geometryColumnsDao.isTableExists()) {
		List<GeometryColumns> results = geometryColumnsDao.queryForAll();

		for (GeometryColumns geometryColumns : results) {

			FeatureDao dao = geoPackage.getFeatureDao(geometryColumns);

			GoogleMapShapeConverter converter = new GoogleMapShapeConverter(
					dao.getProjection());
			converter.setExteriorOrientation(null);
			converter.setHoleOrientation(null);

			// Query for all
			FeatureCursor cursor = dao.queryForAll();
			while (cursor.moveToNext()) {
				FeatureRow featureRow = cursor.getRow();

				GeoPackageGeometryData geometryData = featureRow
						.getGeometry();

				if (geometryData != null) {
					Geometry geometry = geometryData.getGeometry();
					GeometryType geometryType = geometry.getGeometryType();

					switch (geometryType) {
					case POINT:
						convertPoint(converter, (Point) geometry);
						break;
					case LINESTRING:
						convertLineString(converter, (LineString) geometry);
						break;
					case POLYGON:
						convertPolygon(converter, (Polygon) geometry);
						break;
					case MULTIPOINT:
						convertMultiPoint(converter, (MultiPoint) geometry);
						break;
					case MULTILINESTRING:
						convertMultiLineString(converter,
								(MultiLineString) geometry);
						break;
					case MULTIPOLYGON:
						convertMultiPolygon(converter,
								(MultiPolygon) geometry);
						break;
					case CIRCULARSTRING:
						convertLineString(converter,
								(CircularString) geometry);
						break;
					case COMPOUNDCURVE:
						convertCompoundCurve(converter,
								(CompoundCurve) geometry);
						break;
					case POLYHEDRALSURFACE:
						convertMultiPolygon(converter,
								(PolyhedralSurface) geometry);
						break;
					case TIN:
						convertMultiPolygon(converter, (TIN) geometry);
						break;
					case TRIANGLE:
						convertPolygon(converter, (Triangle) geometry);
						break;
					default:
					}
				}

			}
			cursor.close();

		}
	}

}
 
Example #11
Source File: RTreeIndexTableDao.java    From geopackage-android with MIT License 3 votes vote down vote up
/**
 * Query for features within the bounding box in the provided projection
 *
 * @param boundingBox bounding box
 * @param projection  projection
 * @param fieldValues field values
 * @return feature cursor
 * @since 3.4.0
 */
public FeatureCursor queryFeatures(BoundingBox boundingBox,
                                   Projection projection, Map<String, Object> fieldValues) {
    BoundingBox featureBoundingBox = projectBoundingBox(boundingBox,
            projection);
    return queryFeatures(featureBoundingBox, fieldValues);
}
 
Example #12
Source File: FeatureTableIndex.java    From geopackage-android with MIT License 3 votes vote down vote up
/**
 * Query for Features within the bounding box in the provided projection
 *
 * @param columns     columns
 * @param boundingBox bounding box
 * @param projection  projection of the provided bounding box
 * @return feature results
 * @since 3.5.0
 */
public FeatureCursor queryFeatures(String[] columns,
                                   BoundingBox boundingBox, Projection projection) {
    BoundingBox featureBoundingBox = getFeatureBoundingBox(boundingBox,
            projection);
    return queryFeatures(columns, featureBoundingBox);
}
 
Example #13
Source File: RTreeIndexTableDao.java    From geopackage-android with MIT License 3 votes vote down vote up
/**
 * Query for features within the bounds
 *
 * @param columns columns
 * @param minX    min x
 * @param minY    min y
 * @param maxX    max x
 * @param maxY    max y
 * @return results
 * @since 3.5.0
 */
public FeatureCursor queryFeatures(String[] columns, double minX,
                                   double minY, double maxX, double maxY) {
    validateRTree();
    String where = buildWhere(minX, minY, maxX, maxY);
    String[] whereArgs = buildWhereArgs(minX, minY, maxX, maxY);
    return featureDao.queryIn(columns, queryIdsSQL(where), whereArgs);
}
 
Example #14
Source File: RTreeIndexTableDao.java    From geopackage-android with MIT License 3 votes vote down vote up
/**
 * Query for features within the bounds
 *
 * @param minX        min x
 * @param minY        min y
 * @param maxX        max x
 * @param maxY        max y
 * @param fieldValues field values
 * @return cursor
 * @since 3.4.0
 */
public FeatureCursor queryFeatures(double minX, double minY, double maxX,
                                   double maxY, Map<String, Object> fieldValues) {
    validateRTree();
    String where = buildWhere(minX, minY, maxX, maxY);
    String[] whereArgs = buildWhereArgs(minX, minY, maxX, maxY);
    return featureDao.queryIn(queryIdsSQL(where), whereArgs, fieldValues);
}
 
Example #15
Source File: RTreeIndexTableDao.java    From geopackage-android with MIT License 3 votes vote down vote up
/**
 * Query for features within the bounds
 *
 * @param columns     columns
 * @param minX        min x
 * @param minY        min y
 * @param maxX        max x
 * @param maxY        max y
 * @param fieldValues field values
 * @return results
 * @since 3.5.0
 */
public FeatureCursor queryFeatures(String[] columns, double minX,
                                   double minY, double maxX, double maxY,
                                   Map<String, Object> fieldValues) {
    validateRTree();
    String where = buildWhere(minX, minY, maxX, maxY);
    String[] whereArgs = buildWhereArgs(minX, minY, maxX, maxY);
    return featureDao.queryIn(columns, queryIdsSQL(where), whereArgs,
            fieldValues);
}
 
Example #16
Source File: RTreeIndexTableDao.java    From geopackage-android with MIT License 3 votes vote down vote up
/**
 * Query for features within the bounds
 *
 * @param columns   columns
 * @param minX      min x
 * @param minY      min y
 * @param maxX      max x
 * @param maxY      max y
 * @param where     where clause
 * @param whereArgs where arguments
 * @return results
 * @since 3.5.0
 */
public FeatureCursor queryFeatures(String[] columns, double minX,
                                   double minY, double maxX, double maxY, String where,
                                   String[] whereArgs) {
    validateRTree();
    String whereBounds = buildWhere(minX, minY, maxX, maxY);
    String[] whereBoundsArgs = buildWhereArgs(minX, minY, maxX, maxY);
    return featureDao.queryIn(columns, queryIdsSQL(whereBounds),
            whereBoundsArgs, where, whereArgs);
}
 
Example #17
Source File: RTreeIndexTableDao.java    From geopackage-android with MIT License 3 votes vote down vote up
/**
 * Query for features within the bounds
 *
 * @param minX      min x
 * @param minY      min y
 * @param maxX      max x
 * @param maxY      max y
 * @param where     where clause
 * @param whereArgs where arguments
 * @return cursor
 * @since 3.4.0
 */
public FeatureCursor queryFeatures(double minX, double minY, double maxX,
                                   double maxY, String where, String[] whereArgs) {
    validateRTree();
    String whereBounds = buildWhere(minX, minY, maxX, maxY);
    String[] whereBoundsArgs = buildWhereArgs(minX, minY, maxX, maxY);
    return featureDao.queryIn(queryIdsSQL(whereBounds), whereBoundsArgs,
            where, whereArgs);
}
 
Example #18
Source File: FeatureTableIndex.java    From geopackage-android with MIT License 3 votes vote down vote up
/**
 * Query for Features within the bounding box in the provided projection
 *
 * @param boundingBox bounding box
 * @param projection  projection of the provided bounding box
 * @return feature cursor
 * @since 3.4.0
 */
public FeatureCursor queryFeatures(BoundingBox boundingBox,
                                   Projection projection) {
    BoundingBox featureBoundingBox = getFeatureBoundingBox(boundingBox,
            projection);
    return queryFeatures(featureBoundingBox);
}
 
Example #19
Source File: FeatureTableIndex.java    From geopackage-android with MIT License 3 votes vote down vote up
/**
 * Query for Features within the bounding box in the provided projection
 *
 * @param boundingBox bounding box
 * @param projection  projection of the provided bounding box
 * @param fieldValues field values
 * @return feature cursor
 * @since 3.4.0
 */
public FeatureCursor queryFeatures(BoundingBox boundingBox,
                                   Projection projection, Map<String, Object> fieldValues) {
    BoundingBox featureBoundingBox = getFeatureBoundingBox(boundingBox,
            projection);
    return queryFeatures(featureBoundingBox, fieldValues);
}
 
Example #20
Source File: FeatureTableIndex.java    From geopackage-android with MIT License 3 votes vote down vote up
/**
 * Query for Features within the bounding box in the provided projection
 *
 * @param columns     columns
 * @param boundingBox bounding box
 * @param projection  projection of the provided bounding box
 * @param fieldValues field values
 * @return feature results
 * @since 3.5.0
 */
public FeatureCursor queryFeatures(String[] columns,
                                   BoundingBox boundingBox, Projection projection,
                                   Map<String, Object> fieldValues) {
    BoundingBox featureBoundingBox = getFeatureBoundingBox(boundingBox,
            projection);
    return queryFeatures(columns, featureBoundingBox, fieldValues);
}
 
Example #21
Source File: FeatureIndexer.java    From geopackage-android with MIT License 3 votes vote down vote up
/**
 * Query for features within the bounding box in the provided projection
 *
 * @param columns     columns
 * @param boundingBox bounding box
 * @param projection  projection
 * @return feature results
 * @since 3.5.0
 */
public FeatureCursor queryFeatures(String[] columns, BoundingBox boundingBox,
                                   Projection projection) {
    BoundingBox featureBoundingBox = getFeatureBoundingBox(boundingBox,
            projection);
    return queryFeatures(columns, featureBoundingBox);
}
 
Example #22
Source File: FeatureIndexer.java    From geopackage-android with MIT License 3 votes vote down vote up
/**
 * Query for features within the geometry envelope
 *
 * @param envelope    geometry envelope
 * @param fieldValues field values
 * @return feature results
 * @since 3.4.0
 */
public FeatureCursor queryFeatures(GeometryEnvelope envelope,
                                   Map<String, Object> fieldValues) {
    String where = featureDao.buildWhere(fieldValues.entrySet());
    String[] whereArgs = featureDao.buildWhereArgs(fieldValues.values());
    return queryFeatures(envelope, where, whereArgs);
}
 
Example #23
Source File: FeatureTableIndex.java    From geopackage-android with MIT License 3 votes vote down vote up
/**
 * Query for Features within the bounding box in the provided projection
 *
 * @param columns     columns
 * @param boundingBox bounding box
 * @param projection  projection of the provided bounding box
 * @param where       where clause
 * @param whereArgs   where arguments
 * @return feature results
 * @since 3.5.0
 */
public FeatureCursor queryFeatures(String[] columns,
                                   BoundingBox boundingBox, Projection projection, String where,
                                   String[] whereArgs) {
    BoundingBox featureBoundingBox = getFeatureBoundingBox(boundingBox,
            projection);
    return queryFeatures(columns, featureBoundingBox, where, whereArgs);
}
 
Example #24
Source File: FeatureIndexer.java    From geopackage-android with MIT License 3 votes vote down vote up
/**
 * Query for features within the bounding box in the provided projection
 *
 * @param boundingBox bounding box
 * @param projection  projection
 * @param fieldValues field values
 * @return feature results
 * @since 3.4.0
 */
public FeatureCursor queryFeatures(BoundingBox boundingBox,
                                   Projection projection, Map<String, Object> fieldValues) {
    BoundingBox featureBoundingBox = getFeatureBoundingBox(boundingBox,
            projection);
    return queryFeatures(featureBoundingBox, fieldValues);
}
 
Example #25
Source File: RTreeIndexTableDao.java    From geopackage-android with MIT License 3 votes vote down vote up
/**
 * Query for features within the bounding box in the provided projection
 *
 * @param columns     columns
 * @param boundingBox bounding box
 * @param projection  projection
 * @return feature results
 * @since 3.5.0
 */
public FeatureCursor queryFeatures(String[] columns,
                                   BoundingBox boundingBox, Projection projection) {
    BoundingBox featureBoundingBox = projectBoundingBox(boundingBox,
            projection);
    return queryFeatures(columns, featureBoundingBox);
}
 
Example #26
Source File: RTreeIndexTableDao.java    From geopackage-android with MIT License 3 votes vote down vote up
/**
 * Query for features within the bounding box in the provided projection
 *
 * @param columns     columns
 * @param boundingBox bounding box
 * @param projection  projection
 * @param fieldValues field values
 * @return feature results
 * @since 3.5.0
 */
public FeatureCursor queryFeatures(String[] columns,
                                   BoundingBox boundingBox, Projection projection,
                                   Map<String, Object> fieldValues) {
    BoundingBox featureBoundingBox = projectBoundingBox(boundingBox,
            projection);
    return queryFeatures(columns, featureBoundingBox, fieldValues);
}
 
Example #27
Source File: RTreeIndexTableDao.java    From geopackage-android with MIT License 2 votes vote down vote up
/**
 * Query for features within the bounding box
 *
 * @param columns     columns
 * @param boundingBox bounding box
 * @param where       where clause
 * @return feature results
 * @since 3.5.0
 */
public FeatureCursor queryFeatures(String[] columns,
                                   BoundingBox boundingBox, String where) {
    return queryFeatures(columns, boundingBox, where, null);
}
 
Example #28
Source File: FeatureIndexer.java    From geopackage-android with MIT License 2 votes vote down vote up
/**
 * Query for features within the geometry envelope
 *
 * @param columns   columns
 * @param envelope  geometry envelope
 * @param where     where clause
 * @param whereArgs where arguments
 * @return feature results
 * @since 3.5.0
 */
public FeatureCursor queryFeatures(String[] columns, GeometryEnvelope envelope,
                                   String where, String[] whereArgs) {
    FeatureIndexerIdQuery idQuery = buildIdQuery(queryIds(envelope));
    return query(columns, idQuery, where, whereArgs);
}
 
Example #29
Source File: RTreeIndexTableDao.java    From geopackage-android with MIT License 2 votes vote down vote up
/**
 * Query for features within the bounding box
 *
 * @param boundingBox bounding box
 * @param where       where clause
 * @return feature cursor
 * @since 3.4.0
 */
public FeatureCursor queryFeatures(BoundingBox boundingBox,
                                   String where) {
    return queryFeatures(boundingBox, where, null);
}
 
Example #30
Source File: FeatureIndexerIdCursor.java    From geopackage-android with MIT License 2 votes vote down vote up
/**
 * Constructor
 *
 * @param cursor  feature cursor
 * @param idQuery id query
 */
public FeatureIndexerIdCursor(FeatureCursor cursor, FeatureIndexerIdQuery idQuery) {
    this(cursor.getTable(), cursor.getWrappedCursor(), idQuery);
}