Hi GeoMesa Devs,
I am encountering issue when
trying to query by using geomesa-hbase on
geomesa_2.11-2.1.0. Previously, I took
geomesa2.11-2.0.2 to make the following query,
the returned result is stable and unique. In
order to utilize new characteristics of
geomesa_2.11-2.1.0 like precision indexing and
hbase partition, I turned to it but found that
based on the same hbase catalog and the same
fiter and query, every time the result is
unstable and different. It seems that the input
is constant but result is various, which makes
me confused.
Relevant code is following:
` ...
val typeName = "..."
val ds =
DataStoreFinder.getDataStore(params).asInstanceOf[HBaseDataStore]
val ff:FilterFactory2 =
CommonFactoryFinder.getFilterFactory2
val calc = new GeodeticCalculator()
val geoFac = new GeometryFactory
def metersToDegrees(meters:
Double, point: Point):Double = {
calc.setStartingGeographicPoint(point.getX, point.getY);
calc.setDirection(0,meters)
val dest2D = calc.getDestinationGeographicPoint
val destPoint = geoFac.creatPoint(new Coordinate(dest2D.getX, dest2D.getY))
point.distance(destPoint)
}
def bufferGeo(geom: Geometry,
meters: Double): Geometry = {
geom.buffer(metersToDegrees(meters, geom.getCentoid))
}
def testSpatialQuery(): Unit ={
val source = ds.getFeatureSource(typeName)
val geomProperty = ff.property(source.getSchema.getGeometryDescriptor.getName)
val geomtryFactory = JTSFactoryFinder.getGeometryFactory
val coord = new Coorinate(120.496, 32.512)
val point = geomtryFactory.createPoint(coord)
val geometry = bufferGeo(point, 1000)
val geomFilter = ff.intersects(geomProperty, ff.literal(geometry))
val combineFilter = ff.and(geomFilter, ECQL.toFilter("occurtime during 2018-02-12T00:10:00.000Z/2018-02-12T23:59:00.000Z"))
val featureCollection = source.getFeatures(combineFilter)
val iterator = featureCollection.features()
var count = 0
while (iterator.hasNext){
val sf = iterator.next()
count = count + 1
}
println("Total count " + count)
} `