Java Code Examples for mil.nga.geopackage.geom.GeoPackageGeometryData

The following examples show how to use mil.nga.geopackage.geom.GeoPackageGeometryData. 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   Source File: FeatureRowData.java    License: MIT License 6 votes vote down vote up
/**
 * Build a JSON compatible object
 *
 * @param includePoints     true to include point geometries, ignored if includeGeometries is true
 * @param includeGeometries true to include all geometry types
 * @return JSON compatible object
 */
public Object jsonCompatible(boolean includePoints, boolean includeGeometries) {

    Map<String, Object> jsonValues = new HashMap<>();

    for (String key : values.keySet()) {
        Object jsonValue = null;
        Object value = values.get(key);
        if (key.equals(geometryColumn)) {
            GeoPackageGeometryData geometryData = (GeoPackageGeometryData) value;
            if (geometryData.getGeometry() != null) {
                if (includeGeometries || (includePoints && geometryData.getGeometry().getGeometryType() == GeometryType.POINT)) {
                    jsonValue = FeatureConverter.toMap(geometryData.getGeometry());
                }
            } else {
                jsonValue = value;
            }
            if (jsonValue != null) {
                jsonValues.put(key, jsonValue);
            }
        }
    }

    return jsonValues;
}
 
Example 2
Source Project: geopackage-android   Source File: GeoPackageGeometryDataUtils.java    License: MIT License 6 votes vote down vote up
/**
 * Compare two geometry datas and verify they are equal
 *
 * @param expected
 * @param actual
 */
public static void compareGeometryData(GeoPackageGeometryData expected,
                                       GeoPackageGeometryData actual) {

    // Compare geometry data attributes
    TestCase.assertEquals(expected.isExtended(), actual.isExtended());
    TestCase.assertEquals(expected.isEmpty(), actual.isEmpty());
    TestCase.assertEquals(expected.getByteOrder(), actual.getByteOrder());
    TestCase.assertEquals(expected.getSrsId(), actual.getSrsId());
    compareEnvelopes(expected.getEnvelope(), actual.getEnvelope());
    TestCase.assertEquals(expected.getWkbGeometryIndex(),
            actual.getWkbGeometryIndex());

    // Compare header bytes
    compareByteArrays(expected.getHeaderBytes(), actual.getHeaderBytes());

    // Compare geometries
    compareGeometries(expected.getGeometry(), actual.getGeometry());

    // Compare well-known binary geometries
    compareByteArrays(expected.getWkbBytes(), actual.getWkbBytes());

    // Compare all bytes
    compareByteArrays(expected.getBytes(), actual.getBytes());

}
 
Example 3
Source Project: geopackage-android   Source File: GeoPackageGeometryDataUtils.java    License: MIT License 6 votes vote down vote up
/**
 * Compare two geometry envelopes and verify they are equal
 *
 * @param expected
 * @param actual
 */
private static void compareEnvelopes(GeometryEnvelope expected,
                                     GeometryEnvelope actual) {

    if (expected == null) {
        TestCase.assertNull(actual);
    } else {
        TestCase.assertNotNull(actual);

        TestCase.assertEquals(GeoPackageGeometryData.getIndicator(expected),
                GeoPackageGeometryData.getIndicator(actual));
        TestCase.assertEquals(expected.getMinX(), actual.getMinX());
        TestCase.assertEquals(expected.getMaxX(), actual.getMaxX());
        TestCase.assertEquals(expected.getMinY(), actual.getMinY());
        TestCase.assertEquals(expected.getMaxY(), actual.getMaxY());
        TestCase.assertEquals(expected.hasZ(), actual.hasZ());
        TestCase.assertEquals(expected.getMinZ(), actual.getMinZ());
        TestCase.assertEquals(expected.getMaxZ(), actual.getMaxZ());
        TestCase.assertEquals(expected.hasM(), actual.hasM());
        TestCase.assertEquals(expected.getMinM(), actual.getMinM());
        TestCase.assertEquals(expected.getMaxM(), actual.getMaxM());
    }

}
 
Example 4
Source Project: geopackage-android   Source 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 5
Source Project: geopackage-java   Source File: GeoPackageGeometryDataUtils.java    License: MIT License 6 votes vote down vote up
/**
 * Compare two geometry datas and verify they are equal
 * 
 * @param expected
 * @param actual
 */
public static void compareGeometryData(GeoPackageGeometryData expected,
		GeoPackageGeometryData actual) {

	// Compare geometry data attributes
	TestCase.assertEquals(expected.isExtended(), actual.isExtended());
	TestCase.assertEquals(expected.isEmpty(), actual.isEmpty());
	TestCase.assertEquals(expected.getByteOrder(), actual.getByteOrder());
	TestCase.assertEquals(expected.getSrsId(), actual.getSrsId());
	compareEnvelopes(expected.getEnvelope(), actual.getEnvelope());
	TestCase.assertEquals(expected.getWkbGeometryIndex(),
			actual.getWkbGeometryIndex());

	// Compare header bytes
	compareByteArrays(expected.getHeaderBytes(), actual.getHeaderBytes());

	// Compare geometries
	compareGeometries(expected.getGeometry(), actual.getGeometry());

	// Compare well-known binary geometries
	compareByteArrays(expected.getWkbBytes(), actual.getWkbBytes());

	// Compare all bytes
	compareByteArrays(expected.getBytes(), actual.getBytes());

}
 
Example 6
Source Project: geopackage-java   Source File: GeoPackageGeometryDataUtils.java    License: MIT License 6 votes vote down vote up
/**
 * Compare two geometry envelopes and verify they are equal
 * 
 * @param expected
 * @param actual
 */
private static void compareEnvelopes(GeometryEnvelope expected,
		GeometryEnvelope actual) {

	if (expected == null) {
		TestCase.assertNull(actual);
	} else {
		TestCase.assertNotNull(actual);

		TestCase.assertEquals(
				GeoPackageGeometryData.getIndicator(expected),
				GeoPackageGeometryData.getIndicator(actual));
		TestCase.assertEquals(expected.getMinX(), actual.getMinX());
		TestCase.assertEquals(expected.getMaxX(), actual.getMaxX());
		TestCase.assertEquals(expected.getMinY(), actual.getMinY());
		TestCase.assertEquals(expected.getMaxY(), actual.getMaxY());
		TestCase.assertEquals(expected.hasZ(), actual.hasZ());
		TestCase.assertEquals(expected.getMinZ(), actual.getMinZ());
		TestCase.assertEquals(expected.getMaxZ(), actual.getMaxZ());
		TestCase.assertEquals(expected.hasM(), actual.hasM());
		TestCase.assertEquals(expected.getMinM(), actual.getMinM());
		TestCase.assertEquals(expected.getMaxM(), actual.getMaxM());
	}

}
 
Example 7
Source Project: geopackage-android-map   Source File: FeatureInfoBuilder.java    License: MIT License 5 votes vote down vote up
/**
 * Project the geometry into the provided projection
 *
 * @param geometryData geometry data
 * @param projection   projection
 */
public void projectGeometry(GeoPackageGeometryData geometryData, Projection projection) {

    if (geometryData.getGeometry() != null) {

        try {
            SpatialReferenceSystemDao srsDao = DaoManager.createDao(featureDao.getDb().getConnectionSource(), SpatialReferenceSystem.class);
            int srsId = geometryData.getSrsId();
            SpatialReferenceSystem srs = srsDao.queryForId((long) srsId);

            if (!projection.equals(srs.getOrganization(), srs.getOrganizationCoordsysId())) {

                Projection geomProjection = srs.getProjection();
                ProjectionTransform transform = geomProjection.getTransformation(projection);

                Geometry projectedGeometry = transform.transform(geometryData.getGeometry());
                geometryData.setGeometry(projectedGeometry);
                SpatialReferenceSystem projectionSrs = srsDao.getOrCreateCode(projection.getAuthority(), Long.parseLong(projection.getCode()));
                geometryData.setSrsId((int) projectionSrs.getSrsId());
            }
        } catch (SQLException e) {
            throw new GeoPackageException("Failed to project geometry to projection with Authority: "
                    + projection.getAuthority() + ", Code: " + projection.getCode(), e);
        }
    }

}
 
Example 8
Source Project: geopackage-android   Source File: FeatureRow.java    License: MIT License 5 votes vote down vote up
/**
 * {@inheritDoc}
 * <p>
 * Handles geometry columns
 */
@Override
protected void columnToContentValue(ContentValues contentValues,
                                    FeatureColumn column, Object value) {

    if (column.isGeometry()) {

        String columnName = column.getName();

        if (value instanceof GeoPackageGeometryData) {
            GeoPackageGeometryData geometryData = (GeoPackageGeometryData) value;
            try {
                contentValues.put(columnName, geometryData.toBytes());
            } catch (IOException e) {
                throw new GeoPackageException(
                        "Failed to write Geometry Data bytes. column: "
                                + columnName,
                        e);
            }
        } else if (value instanceof byte[]) {
            contentValues.put(columnName, (byte[]) value);
        } else {
            throw new GeoPackageException(
                    "Unsupported update geometry column value type. column: "
                            + columnName + ", value type: "
                            + value.getClass().getName());
        }
    } else {
        super.columnToContentValue(contentValues, column, value);
    }

}
 
Example 9
Source Project: geopackage-android   Source File: FeatureRow.java    License: MIT License 5 votes vote down vote up
/**
 * Get the simple features geometry value
 *
 * @return geometry
 * @since 3.1.0
 */
public Geometry getGeometryValue() {
    GeoPackageGeometryData data = getGeometry();
    Geometry geometry = null;
    if (data != null) {
        geometry = data.getGeometry();
    }
    return geometry;
}
 
Example 10
Source Project: geopackage-android   Source File: FeatureRow.java    License: MIT License 5 votes vote down vote up
/**
 * Get the geometry envelope
 *
 * @return geometry envelope
 * @since 3.1.0
 */
public GeometryEnvelope getGeometryEnvelope() {
    GeoPackageGeometryData data = getGeometry();
    GeometryEnvelope envelope = null;
    if (data != null) {
        envelope = data.getOrBuildEnvelope();
    }
    return envelope;
}
 
Example 11
Source Project: geopackage-android   Source File: FeatureIndexer.java    License: MIT License 5 votes vote down vote up
/**
 * Index the feature row
 *
 * @param geoPackageId   GeoPackage id
 * @param row            feature row
 * @param possibleUpdate possible update flag
 * @return true if indexed
 */
private boolean index(long geoPackageId, FeatureRow row, boolean possibleUpdate) {

    boolean indexed = false;

    GeoPackageGeometryData geomData = row.getGeometry();
    if (geomData != null) {

        // Get the envelope
        GeometryEnvelope envelope = geomData.getEnvelope();

        // If no envelope, build one from the geometry
        if (envelope == null) {
            Geometry geometry = geomData.getGeometry();
            if (geometry != null) {
                envelope = GeometryEnvelopeBuilder.buildEnvelope(geometry);
            }
        }

        // Create the new index row
        if (envelope != null) {
            GeometryMetadata metadata = geometryMetadataDataSource.populate(geoPackageId, featureDao.getTableName(), row.getId(), envelope);
            if (possibleUpdate) {
                geometryMetadataDataSource.createOrUpdate(metadata);
            } else {
                geometryMetadataDataSource.create(metadata);
            }
            indexed = true;
        }
    }

    return indexed;
}
 
Example 12
Source Project: geopackage-android   Source 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 13
Source Project: geopackage-android   Source File: FeatureTileUtils.java    License: MIT License 5 votes vote down vote up
public static void setPoint(FeatureRow featureRow, double x, double y) {
    GeoPackageGeometryData geomData = new GeoPackageGeometryData(
            ProjectionConstants.EPSG_WORLD_GEODETIC_SYSTEM);
    Point point = new Point(false, false, x, y);
    geomData.setGeometry(point);
    featureRow.setGeometry(geomData);
}
 
Example 14
Source Project: geopackage-android   Source 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 15
Source Project: geopackage-core-java   Source File: FeatureTableCoreIndex.java    License: MIT License 5 votes vote down vote up
/**
 * Index the geometry id and geometry data
 * 
 * @param tableIndex
 *            table index
 * @param geomId
 *            geometry id
 * @param geomData
 *            geometry data
 * 
 * @return true if indexed
 */
protected boolean index(TableIndex tableIndex, long geomId,
		GeoPackageGeometryData geomData) {

	boolean indexed = false;

	if (geomData != null) {

		// Get or build the envelope
		GeometryEnvelope envelope = geomData.getOrBuildEnvelope();

		// Create the new index row
		if (envelope != null) {
			GeometryIndex geometryIndex = geometryIndexDao
					.populate(tableIndex, geomId, envelope);
			try {
				geometryIndexDao.createOrUpdate(geometryIndex);
				indexed = true;
			} catch (SQLException e) {
				throw new GeoPackageException(
						"Failed to create or update Geometry Index. GeoPackage: "
								+ geoPackage.getName() + ", Table Name: "
								+ tableName + ", Geom Id: " + geomId,
						e);
			}
		}
	}

	return indexed;
}
 
Example 16
Source Project: geopackage-core-java   Source File: RTreeIndexCoreExtension.java    License: MIT License 5 votes vote down vote up
/**
 * Get or build a geometry envelope from the Geometry Data
 * 
 * @param data
 *            geometry data
 * @return geometry envelope
 */
protected GeometryEnvelope getEnvelope(GeoPackageGeometryData data) {
	GeometryEnvelope envelope = null;
	if (data != null) {
		envelope = data.getOrBuildEnvelope();
	}
	return envelope;
}
 
Example 17
Source Project: geopackage-java   Source File: RTreeIndexExtension.java    License: MIT License 5 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public void createMinXFunction() {
	createFunction(MIN_X_FUNCTION, new GeometryFunction() {
		@Override
		public Object execute(GeoPackageGeometryData data) {
			Object value = null;
			GeometryEnvelope envelope = getEnvelope(data);
			if (envelope != null) {
				value = envelope.getMinX();
			}
			return value;
		}
	});
}
 
Example 18
Source Project: geopackage-java   Source File: RTreeIndexExtension.java    License: MIT License 5 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public void createMaxXFunction() {
	createFunction(MAX_X_FUNCTION, new GeometryFunction() {
		@Override
		public Object execute(GeoPackageGeometryData data) {
			Object value = null;
			GeometryEnvelope envelope = getEnvelope(data);
			if (envelope != null) {
				value = envelope.getMaxX();
			}
			return value;
		}
	});
}
 
Example 19
Source Project: geopackage-java   Source File: RTreeIndexExtension.java    License: MIT License 5 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public void createMinYFunction() {
	createFunction(MIN_Y_FUNCTION, new GeometryFunction() {
		@Override
		public Object execute(GeoPackageGeometryData data) {
			Object value = null;
			GeometryEnvelope envelope = getEnvelope(data);
			if (envelope != null) {
				value = envelope.getMinY();
			}
			return value;
		}
	});
}
 
Example 20
Source Project: geopackage-java   Source File: RTreeIndexExtension.java    License: MIT License 5 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public void createMaxYFunction() {
	createFunction(MAX_Y_FUNCTION, new GeometryFunction() {
		@Override
		public Object execute(GeoPackageGeometryData data) {
			Object value = null;
			GeometryEnvelope envelope = getEnvelope(data);
			if (envelope != null) {
				value = envelope.getMaxY();
			}
			return value;
		}
	});
}
 
Example 21
Source Project: geopackage-java   Source File: RTreeIndexExtension.java    License: MIT License 5 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public void createIsEmptyFunction() {
	createFunction(IS_EMPTY_FUNCTION, new GeometryFunction() {
		@Override
		public Object execute(GeoPackageGeometryData data) {
			return data == null || data.isEmpty()
					|| data.getGeometry() == null;
		}
	});
}
 
Example 22
Source Project: geopackage-java   Source File: FeatureRow.java    License: MIT License 5 votes vote down vote up
/**
 * {@inheritDoc}
 * 
 * Handles geometry columns
 */
@Override
protected void columnToContentValue(ContentValues contentValues,
		FeatureColumn column, Object value) {

	if (column.isGeometry()) {

		String columnName = column.getName();

		if (value instanceof GeoPackageGeometryData) {
			GeoPackageGeometryData geometryData = (GeoPackageGeometryData) value;
			try {
				contentValues.put(columnName, geometryData.toBytes());
			} catch (IOException e) {
				throw new GeoPackageException(
						"Failed to write Geometry Data bytes. column: "
								+ columnName,
						e);
			}
		} else if (value instanceof byte[]) {
			contentValues.put(columnName, (byte[]) value);
		} else {
			throw new GeoPackageException(
					"Unsupported update geometry column value type. column: "
							+ columnName + ", value type: "
							+ value.getClass().getName());
		}
	} else {
		super.columnToContentValue(contentValues, column, value);
	}

}
 
Example 23
Source Project: geopackage-java   Source File: FeatureRow.java    License: MIT License 5 votes vote down vote up
/**
 * Get the simple features geometry value
 * 
 * @return geometry
 * @since 3.1.0
 */
public Geometry getGeometryValue() {
	GeoPackageGeometryData data = getGeometry();
	Geometry geometry = null;
	if (data != null) {
		geometry = data.getGeometry();
	}
	return geometry;
}
 
Example 24
Source Project: geopackage-java   Source File: FeatureRow.java    License: MIT License 5 votes vote down vote up
/**
 * Get the geometry envelope
 * 
 * @return geometry envelope
 * @since 3.1.0
 */
public GeometryEnvelope getGeometryEnvelope() {
	GeoPackageGeometryData data = getGeometry();
	GeometryEnvelope envelope = null;
	if (data != null) {
		envelope = data.getOrBuildEnvelope();
	}
	return envelope;
}
 
Example 25
Source Project: geopackage-java   Source 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 26
Source Project: geopackage-java   Source File: FeatureTileUtils.java    License: MIT License 5 votes vote down vote up
public static void setPoint(FeatureRow featureRow, double x, double y) {
	GeoPackageGeometryData geomData = new GeoPackageGeometryData(
			ProjectionConstants.EPSG_WORLD_GEODETIC_SYSTEM);
	Point point = new Point(false, false, x, y);
	geomData.setGeometry(point);
	featureRow.setGeometry(geomData);
}
 
Example 27
Source Project: geopackage-java   Source 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 28
Source Project: geopackage-java   Source 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 29
Source Project: geopackage-android-map   Source File: FeatureInfoBuilder.java    License: MIT License 4 votes vote down vote up
/**
 * Build a feature results information message
 *
 * @param results       feature index results
 * @param tolerance     distance tolerance
 * @param clickLocation map click location
 * @param projection    desired geometry projection
 * @return feature table data or null if not results
 */
public FeatureTableData buildTableDataAndClose(FeatureIndexResults results, double tolerance, LatLng clickLocation, Projection projection) {

    FeatureTableData tableData = null;

    // Fine filter results so that the click location is within the tolerance of each feature row result
    FeatureIndexResults filteredResults = fineFilterResults(results, tolerance, clickLocation);

    long featureCount = filteredResults.count();
    if (featureCount > 0) {

        int maxFeatureInfo = 0;
        if (geometryType == GeometryType.POINT) {
            maxFeatureInfo = maxPointDetailedInfo;
        } else {
            maxFeatureInfo = maxFeatureDetailedInfo;
        }

        if (featureCount <= maxFeatureInfo) {

            DataColumnsDao dataColumnsDao = getDataColumnsDao();

            List<FeatureRowData> rows = new ArrayList<>();

            for (FeatureRow featureRow : filteredResults) {

                Map<String, Object> values = new HashMap<>();
                String geometryColumnName = null;

                int geometryColumn = featureRow.getGeometryColumnIndex();
                for (int i = 0; i < featureRow.columnCount(); i++) {

                    Object value = featureRow.getValue(i);

                    String columnName = featureRow.getColumnName(i);

                    columnName = getColumnName(dataColumnsDao, featureRow, columnName);

                    if (i == geometryColumn) {
                        geometryColumnName = columnName;
                        if (projection != null && value != null) {
                            GeoPackageGeometryData geomData = (GeoPackageGeometryData) value;
                            projectGeometry(geomData, projection);
                        }
                    }

                    if (value != null) {
                        values.put(columnName, value);
                    }
                }

                FeatureRowData featureRowData = new FeatureRowData(values, geometryColumnName);
                rows.add(featureRowData);
            }

            tableData = new FeatureTableData(featureDao.getTableName(), featureCount, rows);
        } else {
            tableData = new FeatureTableData(featureDao.getTableName(), featureCount);
        }
    }

    results.close();

    return tableData;
}
 
Example 30
Source Project: geopackage-android-map   Source File: FeatureInfoBuilder.java    License: MIT License 4 votes vote down vote up
/**
 * Fine filter the index results verifying the click location is within the tolerance of each feature row
 *
 * @param results       feature index results
 * @param tolerance     distance tolerance
 * @param clickLocation click location
 * @return filtered feature index results
 */
private FeatureIndexResults fineFilterResults(FeatureIndexResults results, double tolerance, LatLng clickLocation) {

    FeatureIndexResults filteredResults = null;
    if (ignoreGeometryTypes.contains(geometryType)) {
        filteredResults = new FeatureIndexListResults();
    } else if (clickLocation == null && ignoreGeometryTypes.isEmpty()) {
        filteredResults = results;
    } else {

        FeatureIndexListResults filteredListResults = new FeatureIndexListResults();

        GoogleMapShapeConverter converter = new GoogleMapShapeConverter(
                featureDao.getProjection());

        for (FeatureRow featureRow : results) {

            GeoPackageGeometryData geomData = featureRow.getGeometry();
            if (geomData != null) {
                Geometry geometry = geomData.getGeometry();
                if (geometry != null) {

                    if (!ignoreGeometryTypes.contains(geometry.getGeometryType())) {

                        if (clickLocation != null) {

                            GoogleMapShape mapShape = converter.toShape(geometry);
                            if (MapUtils.isPointOnShape(clickLocation, mapShape, geodesic, tolerance)) {

                                filteredListResults.addRow(featureRow);

                            }
                        } else {
                            filteredListResults.addRow(featureRow);
                        }

                    }
                }
            }

        }

        filteredResults = filteredListResults;
    }

    return filteredResults;
}