-
Notifications
You must be signed in to change notification settings - Fork 62
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
convert regular DF to simba supported geometries #87
Comments
Theoretically, you can do anything supported by Spark SQL DataFrame to a Simba DataFrame. As Simba DataFrame inherits from that of Spark SQL. To represent additional fields, you simply add them to your structure. For example, you can define: case class PointData(x: Point, payload: Int, tag: String) And Simba will be able to automatically detect its fields and build the data frame. It will give you a schema like: -- DataFrame |
I see. And What about polygons? You seem to use |
So assuming a Data frame with Polygons like below
is this how the conversion is supposed to be?
|
I think you can try this:
I don't know if it can work, but you can try. |
This would fail with com.vividsolutions.jts.io.ParseException: Unknown WKB type 71 already when trying to parse the WKT. |
Well, I think this is a parsing problem of JTS, which is out of my scope now. And just to remind, general geometric objects including polygons are still under development. |
Would about:
not sure if it will join later on, but df.show works. |
Nevertheless, I don't think it will work for joins since our current join algorithm does not support polygons, which is technically caused by no partitioner for polygons and it assumes the join keys will be evaluated as Point. This is coming from our legacy hacks for its original prototype (designed just for points). Still, I treat partitioning general geometry objects as a research problem. |
Does simba have som UDF to support creation of a simbaDF out of a regular data frame? I.e. like magellans
df.withColumn("point", point('x, 'y))
If I am required to manually map all points / polygons to simba Geometry, how can I represent additional fiels?
val ps = (0 until 10000).map(x => PointData(Point(Array(x.toDouble, x.toDouble)), x + 1)).toDS
How can I parse WKT polygons to a simba supported geometry format?
The text was updated successfully, but these errors were encountered: