Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[geomesa-users] International date line dilemma for non-point geometries, possible bug?

Hi,

I currently use GeoMesa to index non-point geometries (e.g. LineString, Polygon, MultiPoint), and I have recently switched from using a January version of GeoMesa to using a version that is current (as of the last week or so).

In the January version of GeoMesa, I had implemented an international date line solution for non-point geometries as follows:
- When indexing a non-point geometry (e.g. Polygon) that overlapped the international date line, I would make sure all of the longitudinal values were unwrapped.  In my implementation, this had the consequence of having my indexed geometries span anywhere from -540 degrees longitude to 540 degrees longitude (with at least a portion of the geometry in the [-180, 180] region).
- When querying using GeoMesa, I would actually perform multiple queries in the appropriate redundant regions in space [-540, -180], [-180, 180], and [180, 540] to make sure I captured any geometries that spanned the international date line.


With the latest version of GeoMesa, I get the following exception when I try to index a non-point geometry (by unwrapping the longitude) that spans the international date line:
Exception in thread "main" java.lang.Exception: ERROR:  Could not find a suitable 0-bit MBR for the target geometry:  POLYGON ((179.31530746783775 -39.87427143505418, 179.31530746783775 -37.87427143505418, 181.31530746783775 -37.87427143505418, 181.31530746783775 -39.87427143505418, 179.31530746783775 -39.87427143505418))
	at geomesa.utils.geohash.GeohashUtils$.getMinimumBoundingGeohash(GeohashUtils.scala:241)
	at geomesa.utils.geohash.GeohashUtils$.decomposeGeometry_(GeohashUtils.scala:535)
	at geomesa.utils.geohash.GeohashUtils$.decomposeGeometry(GeohashUtils.scala:564)
	at geomesa.core.index.IndexEncoder.encode(IndexEntry.scala:70)
	at geomesa.core.index.IndexSchema.encode(IndexSchema.scala:84)
	at geomesa.core.data.AccumuloFeatureWriter.writeToAccumulo(AccumuloFeatureWriter.scala:104)
	at geomesa.core.data.AppendAccumuloFeatureWriter.write(AccumuloFeatureWriter.scala:130)
	at org.geotools.data.AbstractFeatureStore.addFeatures(AbstractFeatureStore.java:324)
	at geomesa.core.data.AccumuloFeatureStore.addFeatures(AccumuloFeatureStore.scala:53)


When I try to query outside the [-180, 180] region I get the following exception (even if data does not exist outside of the [-180, 180] region:
Exception in thread "main" java.lang.IllegalStateException: getX called on empty Point
	at com.vividsolutions.jts.geom.Point.getX(Point.java:124)
	at geomesa.utils.geohash.GeohashUtils$.getCentroid(GeohashUtils.scala:256)
	at geomesa.utils.geohash.GeohashUtils$.getMinimumBoundingGeohash(GeohashUtils.scala:228)
	at geomesa.utils.geohash.GeohashUtils$.decomposeGeometry_(GeohashUtils.scala:535)
	at geomesa.utils.geohash.GeohashUtils$.decomposeGeometry(GeohashUtils.scala:564)
	at geomesa.utils.geohash.GeohashUtils$.getUniqueGeohashSubstringsInPolygon(GeohashUtils.scala:672)
	at geomesa.core.index.GeoHashPlanner$class.polyToGeoHashes(QueryPlanners.scala:275)
	at geomesa.core.index.GeoHashKeyPlanner.polyToGeoHashes(QueryPlanners.scala:308)
	at geomesa.core.index.GeoHashPlanner$class.polyToPlan(QueryPlanners.scala:280)
	at geomesa.core.index.GeoHashKeyPlanner.polyToPlan(QueryPlanners.scala:308)
	at geomesa.core.index.GeoHashPlanner$class.getKeyPlan(QueryPlanners.scala:302)
	at geomesa.core.index.GeoHashKeyPlanner.getKeyPlan(QueryPlanners.scala:308)
	at geomesa.core.index.GeoHashKeyPlanner.getKeyPlan(QueryPlanners.scala:309)
	at geomesa.core.index.CompositePlanner$$anonfun$9.apply(QueryPlanners.scala:396)
	at geomesa.core.index.CompositePlanner$$anonfun$9.apply(QueryPlanners.scala:396)
	at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:244)
	at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:244)
	at scala.collection.immutable.List.foreach(List.scala:318)
	at scala.collection.TraversableLike$class.map(TraversableLike.scala:244)
	at scala.collection.AbstractTraversable.map(Traversable.scala:105)
	at geomesa.core.index.CompositePlanner.getKeyPlan(QueryPlanners.scala:396)
	at geomesa.core.index.IndexQueryPlanner.planQuery(IndexQueryPlanner.scala:171)
	at geomesa.core.index.IndexQueryPlanner.getIterator(IndexQueryPlanner.scala:100)
	at geomesa.core.index.IndexSchema.query(IndexSchema.scala:98)
	at geomesa.core.data.AccumuloFeatureReader.<init>(AccumuloFeatureReader.scala:32)
	at geomesa.core.data.AccumuloDataStore.getFeatureReader(AccumuloDataStore.scala:294)
	at geomesa.core.data.AccumuloDataStore.getFeatureReader(AccumuloDataStore.scala:55)
	at org.geotools.data.AbstractDataStore.getFeatureReader(AbstractDataStore.java:369)
	at org.geotools.data.DefaultFeatureResults.reader(DefaultFeatureResults.java:215)
	at org.geotools.data.store.DataFeatureCollection.openIterator(DataFeatureCollection.java:231)
	at org.geotools.data.store.DataFeatureCollection.iterator(DataFeatureCollection.java:199)
	at org.geotools.data.store.DataFeatureCollection.features(DataFeatureCollection.java:188)
	at org.geotools.data.store.DataFeatureCollection.features(DataFeatureCollection.java:79)
	...


My questions are:
1) Is this behavior a bug?
2) if it's not a bug, what are some alternate approaches to indexing/querying non-point geometries that span the international date line?  Any direct guidance would be appreciated.


My ideal GeoMesa solution would be:
A) When I index geometries, I could provide GeoMesa unwrapped longitudes in order to remove ambiguity as to what the geometry represents in actual space (e.g. a small polygon crossing the international dateline vs. a large polygon covering almost the entire world).
B) When I query, I would prefer querying only the [-180, 180] longitudinal region and have GeoMesa/GeoTools be smart enough to detect overlaps with my unwrapped indexed geometries.

Thanks,
Beau


Back to the top