I want to use Jts functions in spark in java. geomesa-spark/geomesa-spark-jts provides ways to register Jts methods and types with spark.
Official documentation mentioned way to initialize it in spark in scala but not in java.
I was not able to find initJts
or any other initialization method for java.
Documentation does not mention that it supports java , so I am not sure if it is usable in java at all.
Please suggest ways to use Jts in spark with java (not sedona, as it comes with lot of other things than just Jts).
Since initJTS is an implicit method declared in a Package Object, you will have to access it using the inner classes that are generated after compilation.
org.locationtech.geomesa.spark.jts.package$.MODULE$.initJTS(sparkSession.sqlContext());
It may not look good in code, however it works.
If you do not need all JTS UDFs, then you can pick the ones necessary and register them as UDFs. The individual function registration you can find inside initJTS.