I would like to use Goode's Homolosine projection with GeoTools. This projection is fully supported by both PROJ and GDAL. However, when I try to create a CoordinateReferenceSystem
object with this projection, GeoTools complains it has no transformation. For instance, the following little programme:
import org.geotools.referencing.CRS;
import org.geotools.referencing.crs.DefaultGeographicCRS;
import org.opengis.referencing.crs.CoordinateReferenceSystem;
import org.opengis.referencing.operation.MathTransform;
public class WGS84toHomolosine
{
static CoordinateReferenceSystem WORLDCRS = DefaultGeographicCRS.WGS84;
static String wkt = "PROJCS[\"Homolosine\",\n" +
" GEOGCS[\"WGS 84\",\n" +
" DATUM[\"WGS_1984\",\n" +
" SPHEROID[\"WGS 84\",6378137,298.257223563,\n" +
" AUTHORITY[\"EPSG\",\"7030\"]],\n" +
" AUTHORITY[\"EPSG\",\"6326\"]],\n" +
" PRIMEM[\"Greenwich\",0,\n" +
" AUTHORITY[\"EPSG\",\"8901\"]],\n" +
" UNIT[\"degree\",0.0174532925199433,\n" +
" AUTHORITY[\"EPSG\",\"9122\"]],\n" +
" AUTHORITY[\"EPSG\",\"4326\"]],\n" +
" PROJECTION[\"Interrupted_Goode_Homolosine\"],\n" +
" UNIT[\"Meter\",1]]";
static CoordinateReferenceSystem crs;
static MathTransform transform;
public static void main(String[] args)
{
// TODO Auto-generated method stub
try
{
crs = CRS.parseWKT(wkt);
transform = CRS.findMathTransform(WORLDCRS, crs, true);
}
catch (Exception e)
{
// TODO Auto-generated catch block
e.printStackTrace();
}
System.out.println(transform.toWKT());
System.out.println(transform.getClass().getCanonicalName());
}
}
Regurgitates this output:
org.opengis.referencing.NoSuchIdentifierException: No transform for classification "Interrupted_Goode_Homolosine".
at org.geotools.referencing.operation.DefaultMathTransformFactory.lambda$getProvider$1(DefaultMathTransformFactory.java:267)
at java.util.Optional.orElseThrow(Optional.java:290)
at org.geotools.referencing.operation.DefaultMathTransformFactory.getProvider(DefaultMathTransformFactory.java:264)
at org.geotools.referencing.operation.DefaultMathTransformFactory.getDefaultParameters(DefaultMathTransformFactory.java:297)
at org.geotools.referencing.wkt.Parser.parseProjection(Parser.java:632)
at org.geotools.referencing.wkt.Parser.parseProjCS(Parser.java:988)
at org.geotools.referencing.wkt.Parser.parseCoordinateReferenceSystem(Parser.java:232)
at org.geotools.referencing.wkt.Parser.parseCoordinateReferenceSystem(Parser.java:212)
at org.geotools.referencing.factory.ReferencingObjectFactory.createFromWKT(ReferencingObjectFactory.java:1068)
at org.geotools.referencing.CRS.parseWKT(CRS.java:560)
at org.isric.WGS84toHomolosine.main(WGS84toHomolosine.java:32)
Exception in thread "main" java.lang.NullPointerException
at org.isric.WGS84toHomolosine.main(WGS84toHomolosine.java:41)
What is amiss here? Could there be something wrong with my system set up that would prevent GeoTools from finding PROJ's database?