Skip to content

Commit

Permalink
fix crs (#955)
Browse files Browse the repository at this point in the history
  • Loading branch information
AndreiKingsley authored Nov 18, 2024
1 parent 98093dd commit c4bb29c
Showing 1 changed file with 1 addition and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,9 @@ class GeoDataFrame<T : WithGeometry>(val df: DataFrame<T>, val crs: CoordinateRe
* @return A new `GeoDataFrame` with reprojected geometries and the specified CRS.
*/
fun applyCrs(targetCrs: CoordinateReferenceSystem): GeoDataFrame<T> {
if (crs == null) {
return GeoDataFrame(df, targetCrs)
}
if (targetCrs == this.crs) return this
// Use WGS 84 by default TODO
val sourceCRS: CoordinateReferenceSystem = this.crs
val sourceCRS: CoordinateReferenceSystem = this.crs ?: DEFAULT_CRS
val transform = CRS.findMathTransform(sourceCRS, targetCrs, true)
return GeoDataFrame(
df.update { geometry }.with { JTS.transform(it, transform) },
Expand Down

0 comments on commit c4bb29c

Please sign in to comment.