I am trying to convert the Apache Sedona examples code from scala to java, and I am stucked in the line 128 of the SQL example, which says:
assert(boundary.take(1)(0).get(0)==geometryFactory.createPolygon(coordinates))
I am trying to understand it but I am not familiar to the scala syntax. Can somebody help me obtaining a java equivalent command?
boundary.take(1) gets an array of Rows from Spark DataFrame.
The following code works for me:
Note that you cannot compare a polygon with a geometry using
==
although you think they are the same polygon. This is because they technically have different typesPolygon
vsGeometry
. Please useequals
method to compare them.