Just getting into using the GeoTools framework, after having done a lot of things manually.
One of my previously-written functions transforms a given lat/lon/height between CRS.
I found this link: How to Transform a Geometry
I have generating my custom CRSs set up using WKT text and all - that's fine. But I'm not 100% about the Geometry part. Referenced in the
JTS.transform(sourceGeometry, transform) line.
I have what I THOUGHT was what it was expecting:
GeometryBuilder builder = new GeometryBuilder(sourceHCRS); Point sourceGeometry = builder.createPoint(34.5678, -77.45343);
But I'm getting an error on the JTS.transform that reads:
Error: no suitable method found for transform(Point,MathTransform) method JTS.transform(Envelope,MathTransform) is not applicable (argument mismatch; Point cannot be converted to Envelope) method JTS.transform(Geometry,MathTransform) is not applicable (argument mismatch; Point cannot be converted to Geometry)
Now, Point is apparently a superclass of Geometry, so I figured that would work. I've dug down enogh to realize there are TWO classes of 'Geometry' -
org.locationtech.jts.geom.Geometry which is what
JTS.transform() is expecting, and
org.opengis.geometry.Geometry, which is what
Point is superclassing.
Searching around I haven't been able to deduce how to generate a Geometry with my location/point in it to send to the transform().