Skip to content
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

[SEDONA-206] Performance regression of ST_Transform #727

Merged
merged 3 commits into from
Dec 12, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions common/src/main/java/org/apache/sedona/common/Functions.java
Original file line number Diff line number Diff line change
Expand Up @@ -191,20 +191,20 @@ public static Geometry transform(Geometry geometry, String sourceCRS, String tar
return JTS.transform(geometry, transform);
}

private static CoordinateReferenceSystem parseCRSString(String CRSString) throws FactoryException {
private static CoordinateReferenceSystem parseCRSString(String CRSString)
throws FactoryException
{
try {
return CRS.parseWKT(CRSString);
return CRS.decode(CRSString);
}
catch (FactoryException ex1) {
catch (NoSuchAuthorityCodeException e) {
try {
return CRS.decode(CRSString);
} catch (NoSuchAuthorityCodeException ex4) {
throw new NoSuchAuthorityCodeException("that Authority code cannot be found", CRSString, CRSString);
} catch (FactoryException ex6) {
throw new FactoryException("WKT format is illegal");
return CRS.parseWKT(CRSString);
}
catch (FactoryException ex) {
throw new FactoryException("First failed to read as a well-known CRS code: \n" + e.getMessage() + "\nThen failed to read as a WKT CRS string: \n" + ex.getMessage());
}
}

}

public static Geometry flipCoordinates(Geometry geometry) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import org.locationtech.jts.geom.{Geometry, Polygon}
import org.locationtech.jts.io.WKTWriter
import org.locationtech.jts.linearref.LengthIndexedLine
import org.locationtech.jts.operation.distance3d.Distance3DOp
import org.opengis.referencing.{FactoryException, NoSuchAuthorityCodeException}
import org.opengis.referencing.FactoryException
import org.scalatest.{GivenWhenThen, Matchers}
import org.xml.sax.InputSource

Expand Down Expand Up @@ -205,7 +205,7 @@ class functionTestScala extends TestBaseScala with Matchers with GeometrySample
val d = org.apache.sedona.common.Functions.transform(polygeom, epsgString, epsgFactoryErrorString)
}

intercept[NoSuchAuthorityCodeException]{
intercept[FactoryException]{
val d2 = org.apache.sedona.common.Functions.transform(polygeom, epsgString, epsgNoSuchAuthorityString)
}

Expand Down