Kontinuation commented on issue #987:
URL: https://github.com/apache/sedona/issues/987#issuecomment-1719403052
I've manually generated some data and tried running the join, I think I've
found the problem.
Coordinates read from shapefiles are in lon-lat order, which needs to be
swapped to lat-lon order before transforming from EPSG:4326 or EPSG:4269 to
EPSG:5070. Implementing `getAoiShapeDf` and `getClusterShapeDf` in the
following way will give us the correct transformed dataframes:
```scala
def getAoiShapeDf: DataFrame = {
val aoiShapefileLocation = "/path/to/aoi"
val aoiShapeRdd =
ShapefileReader.readToGeometryRDD(session.sparkContext, aoiShapefileLocation)
val aoiShapeDf = Adapter.toDf(aoiShapeRdd, session)
.withColumn("geometry",
expr("ST_Transform(ST_FlipCoordinates(geometry), 'EPSG:4269', 'EPSG:5070')"))
aoiShapeDf
}
def getClusterShapeDf: DataFrame = {
val clusterShapefileLocation = "/path/to/dish_optoclusters"
val clusterShapeRdd =
ShapefileReader.readToGeometryRDD(session.sparkContext,
clusterShapefileLocation)
val clusterShapeDf = Adapter.toDf(clusterShapeRdd, session)
.withColumn("geometry",
expr("ST_Transform(ST_FlipCoordinates(geometry), 'EPSG:4326', 'EPSG:5070')"))
clusterShapeDf
}
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]