I was using ES7 ShapeParser which is no more supported in ES8 it seems:
def validateES(gf: GeoFeature): Unit = {
val geom = Json.stringify(Json.toJson(gf.ftr.geometry))
val parser = XContentType.JSON.xContent().createParser(null, null, geom)
parser.nextToken()
try {
val parsed = ShapeParser.parse(parser)
val shape = parsed.buildS4J()
} catch {
case ioe: IOException => throw new IllegalArgumentException(s"Invalid geometry: ${ioe.getMessage}")
}
}
Based on my understanding, I updated the code as follows:
def validateES(gf: GeoFeature): Unit = {
val geom = Json.stringify(Json.toJson(gf.ftr.geometry))
val parser = XContentType.JSON.xContent().createParser(XContentParserConfiguration.EMPTY, geom)
parser.nextToken()
try {
val parsed = GeoShapeParser.parse(parser)
val shape = parsed.buildS4J()
} catch {
case ioe: IOException => throw new IllegalArgumentException(s"Invalid geometry: ${ioe.getMessage}")
}
}
However I am not getting any method parse
in GeoShapeParser
. Can anyone help me figure out the right code when upgrading to es8?
Thanks in advance!