Search in sources :

Example 1 with GeoPolicy

use of org.apache.rya.indexing.geotemporal.GeoTemporalIndexer.GeoPolicy in project incubator-rya by apache.

the class GeoTemporalMongoDBStorageStrategy method getGeoObjs.

private DBObject[] getGeoObjs(final Collection<IndexingExpr> geoFilters) {
    final List<DBObject> objs = new ArrayList<>();
    geoFilters.forEach(filter -> {
        final GeoPolicy policy = GeoPolicy.fromURI(filter.getFunction());
        final WKTReader reader = new WKTReader();
        final String geoStr = ((Value) filter.getArguments()[0]).stringValue();
        try {
            // This method is what is used in the GeoIndexer.
            final Geometry geo = reader.read(geoStr);
            objs.add(getGeoObject(geo, policy));
        } catch (final GeoTemporalIndexException | UnsupportedOperationException | ParseException e) {
            LOG.error("Unable to parse '" + geoStr + "'.", e);
        }
    });
    return objs.toArray(new DBObject[] {});
}
Also used : Geometry(com.vividsolutions.jts.geom.Geometry) GeoPolicy(org.apache.rya.indexing.geotemporal.GeoTemporalIndexer.GeoPolicy) GeoTemporalIndexException(org.apache.rya.indexing.geotemporal.GeoTemporalIndexException) ArrayList(java.util.ArrayList) Value(org.openrdf.model.Value) ParseException(com.vividsolutions.jts.io.ParseException) WKTReader(com.vividsolutions.jts.io.WKTReader) DBObject(com.mongodb.DBObject) BasicDBObject(com.mongodb.BasicDBObject)

Aggregations

BasicDBObject (com.mongodb.BasicDBObject)1 DBObject (com.mongodb.DBObject)1 Geometry (com.vividsolutions.jts.geom.Geometry)1 ParseException (com.vividsolutions.jts.io.ParseException)1 WKTReader (com.vividsolutions.jts.io.WKTReader)1 ArrayList (java.util.ArrayList)1 GeoTemporalIndexException (org.apache.rya.indexing.geotemporal.GeoTemporalIndexException)1 GeoPolicy (org.apache.rya.indexing.geotemporal.GeoTemporalIndexer.GeoPolicy)1 Value (org.openrdf.model.Value)1