I am using Point geometry type in geomesa for strong lat-long details in feature type. In one of the use case while storing a new feature I don't have value for lat-long so I tried sending null object for createPoint function, but the library 'jts' throwing exception while processing null Geometry type. Here is the source code. By seeing the implementation of jtslibrary, It seems difficult for storing null in geomesa Point. What are the possibilities I can go for? Here is the snapshot of my code:

sf.setAttribute(Attributes.GEOMETRY.getValue(), JTSFactoryFinder.getGeometryFactory().createPoint((Coordinate)null/*new Coordinate(event.lat, event.lng)*/));

Attaching logs for exception:

java.lang.IllegalStateException: getX called on empty Point
    at com.vividsolutions.jts.geom.Point.getX(Point.java:124)
    at org.locationtech.geomesa.utils.uuid.Z3UuidGenerator$.createUuid(Z3FeatureIdGenerator.scala:93)
    at org.locationtech.geomesa.utils.uuid.Z3UuidGenerator$.createUuid(Z3FeatureIdGenerator.scala:70)
    at org.locationtech.geomesa.utils.uuid.Z3FeatureIdGenerator.createId(Z3FeatureIdGenerator.scala:32)
    at org.locationtech.geomesa.index.geotools.GeoMesaFeatureWriter$.featureWithFid(GeoMesaFeatureWriter.scala:64)
    at org.locationtech.geomesa.index.geotools.GeoMesaFeatureWriter.writeFeature(GeoMesaFeatureWriter.scala:128)
    at org.locationtech.geomesa.index.geotools.GeoMesaAppendFeatureWriter$class.write(GeoMesaFeatureWriter.scala:194)
    at org.locationtech.geomesa.accumulo.data.AccumuloAppendFeatureWriter.write(AccumuloFeatureWriter.scala:19)
    at com.hps.GeomesaClient.insert(GeomesaClient.java:129)

Something else must be throwing your null pointer exception - I can run the following:

import org.geotools.geometry.jts.JTSFactoryFinder;

import com.vividsolutions.jts.geom.Coordinate;
import com.vividsolutions.jts.geom.Point;

public class EmptyGeom {

  public static void main(String[] args) {

    Point p = JTSFactoryFinder.getGeometryFactory().createPoint((Coordinate)null/*new Coordinate(event.lat, event.lng)*/);


which gives the expected result of:

| improve this answer | |
  • The exception is thrown while calling getX on empty point, not on creating an empty point. Sorry for the late attachments of log. – Suresh Prajapati May 15 '17 at 10:58
  • 1
    looks like geomesa's org.locationtech.geomesa.utils.uuid.Z3UuidGenerator needs an isEmpty check – Ian Turton May 15 '17 at 12:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.