transform JavapairRDD to dataframe using scala

189 Views Asked by At

I have a javapairRDD in below format

org.apache.spark.api.java.JavaPairRDD[com.vividsolutions.jts.geom.Geometry,com.vividsolutions.jts.geom.Geometry]

Key is a polygon and value is a point in the polygon

eg:

[(polygon(1,2,3,4), POINT (-80.0140735758427 40.43926684782609) )]

How to I transform this javapairRDD to Dataframe with three columns ?

df: String, double, double

Here my first column will be a polygon, second column as longitude and third column as latitude

Any help will be appreciated

1

There are 1 best solutions below

0
user2981952 On BEST ANSWER

below solution worked

javapairrddvariable.rdd.toDF()