I have a dataset with a 2 columns: one column is of location names and the other column is polygons with the coordinates that outline the corresponding locations. This dataset is from a csv file that I've loaded into Databricks using Scala. Using this, I need to place another dataset containing lat/long points inside the polygons specified for each location (likely using the Magellan library), but both columns in the file are being read as strings when the second column needs to be casted as a polygon somehow for the magellan operations to work.
I've already tried casting as a polygon/shape, but nothing has worked so far. The dataset is formatted like this:
+-------------+--------------------+
| location| outline|
+-------------+--------------------+
| Location A|POLYGON ((-111.11...|
| Location B|POLYGON ((-99.111...|
| Location C|POLYGON ((-99.111...|
| Location D|POLYGON ((-99.111...|
| Location E|POLYGON ((-99.111...|
| Location F|POLYGON ((-111.11...|
| Location G|POLYGON ((-99.111...|
| Location H|POLYGON ((-99.111...|
| Location I|POLYGON ((-111.11...|
| Location J|POLYGON ((-111.11...|
| Location K|POLYGON ((-99.111...|
| Location L|POLYGON ((-99.111...|
| Location M|POLYGON ((-99.111...|
| Location N|POLYGON ((-99.111...|
| Location O|POLYGON ((-111.11...|
| Location P|POLYGON ((-99.111...|
| Location Q|POLYGON ((-99.111...|
| Location R|POLYGON ((-99.111...|
| Location S|POLYGON ((-111.11...|
+-------------+--------------------+
so I just need the second column to be converted from a string to an actual polygon.
I need the second column (outline) to be an actual polygon (not a string) so that I can place points inside of the polygons.