Hi,
I imported the geoserver's data nyc:tiger_roads
and nyc:landmarks into geomesa, visualized those
layer. and then the layer were
opened in openlayers, when i drag the
layer to see different part, i found some feature
dispeared, as the following picture:

While i wrote a Test code, according to the
quickstart example , to read from the Positon
layer(201600 features) in same query condition, and
executed it every 5 seconds to continue query,
unfortunately i got different results size, may be
20160, mat be 19592 or 18218 or others
. key
codes as the following:
static Filter createFilter(String geomField, double x0,
double y0,
double x1, double y1, String dateField,
String t0, String t1,
String attributesQuery) throws CQLException,
IOException {
// there are many different geometric predicates
that might be used;
// here, we just use a bounding-box (BBOX)
predicate as an example.
// this is useful for a rectangular query area
String cqlGeometry = "BBOX(" + geomField + ", "
+ x0 + ", " + y0 + ", "
+ x1 + ", " + y1 + ")";
// there are also quite a few temporal
predicates; here, we use a
// "DURING" predicate, because we have a fixed
range of times that
// we want to query
String cqlDates = "(" + dateField + " DURING " +
t0 + "/" + t1 + ")";
// there are quite a few predicates that can
operate on other attribute
// types; the GeoTools Filter constant "INCLUDE"
is a default that means
// to accept everything
String cqlAttributes = attributesQuery == null ?
"INCLUDE"
: attributesQuery;
String cql = /*cqlGeometry + " AND " +
*/cqlAttributes + " AND " + cqlDates;
return CQL.toFilter(cql);
}
static int queryFeatures(String simpleFeatureTypeName,
DataStore dataStore, String geomField,
double x0, double y0,
double x1, double y1, String dateField,
String t0, String t1,
String attributesQuery) throws CQLException,
IOException {
// construct a (E)CQL filter from the search
parameters,
// and use that as the basis for the query
Filter cqlFilter = createFilter(geomField, x0,
y0, x1, y1, dateField,
t0, t1, attributesQuery);
Query query = new Query(simpleFeatureTypeName,
cqlFilter);
// submit the query, and get back an iterator
over matching features
FeatureSource featureSource =
dataStore.getFeatureSource(simpleFeatureTypeName);
FeatureIterator featureItr =
featureSource.getFeatures(query).features();
// AccumuloFeatureReader reader =
((AccumuloDataStore) dataStore)
//
.getFeatureReader(simpleFeatureTypeName, query);
////
//
reader.explainQuery(reader.explainQuery$default$1(),
// reader.explainQuery$default$2());
// loop through all results
int n = 0;
while (featureItr.hasNext()) {
Feature feature = featureItr.next();
// System.out.println((++n) + ". "
// +
feature.getProperty("simNumber").getValue() + "|"
// +
feature.getProperty("geom").getValue() + "|"
// +
feature.getProperty("timeStamp").getValue());
++n;
}
featureItr.close();
return n/*featureSource.getCount(query)*/;
}
public static void main(String[] args) throws Exception
{
// find out where -- in Accumulo -- the user
wants to store data
CommandLineParser parser = new BasicParser();
Options options = getCommonRequiredOptions();
CommandLine cmd = parser.parse(options, args);
// verify that we can see this Accumulo
destination in a GeoTools manner
Map<String, String> dsConf =
getAccumuloDataStoreConf(cmd);
DataStore dataStore =
DataStoreFinder.getDataStore(dsConf);
assert dataStore != null;
// establish specifics concerning the
SimpleFeatureType to store
String simpleFeatureTypeName = "Position";
// query a few Features from this table
List<Runnable> tasks = new
ArrayList<Runnable>();
int clients = 1;
for(int i=0; i<clients; i++){
tasks.add(new
GeomesaQueryTask(simpleFeatureTypeName, dataStore));
}
ScheduledThreadPoolExecutor exec = new
ScheduledThreadPoolExecutor(clients);
for(Runnable run : tasks){
exec.scheduleAtFixedRate(run, 0 , 5000 ,
TimeUnit.MILLISECONDS);
}
}
static Random random = new Random(10);
static String[] sims = new String[]{"013519171000",
"013519171001", "013519171002", "013519171003",
"013519171004", "013519171005", "013519171006",
"013519171007", "013519171008", "013519171009"};
private static class GeomesaQueryTask implements
Runnable {
private String featureName;
private DataStore dataStore;
public GeomesaQueryTask(String
simpleFeatureTypeName, DataStore dataStore) {
this.featureName = simpleFeatureTypeName;
this.dataStore = dataStore;
}
public void run() {
try {
double lonStart =73.33;
double latStart = 3.51;
double lonEnd = 135.05;
double latEnd = 53.33;
long start = System.currentTimeMillis();
String sim = sims[random.nextInt(10)];
int num = queryFeatures(featureName,
dataStore, "geom", lonStart,latStart,
lonEnd, latEnd, "timeStamp",
"2015-01-05T00:00:00",
"2015-01-14T23:59:59",
"(simNumber = '"+sim+"')");
long end = System.currentTimeMillis();
System.out.println(Thread.currentThread().getName()+"
read "+ num +" entries, consume " + (end -start) +
"ms");
} catch (Exception e) {
e.printStackTrace();
}
}
}