use of com.vividsolutions.jts.geom.GeometryFactory in project ddf by codice.
the class GeoUtilTest method testTransformEpsg4326LonLatNullSrs.
@Test
public void testTransformEpsg4326LonLatNullSrs() throws GeoFormatException {
GeometryFactory gf = new GeometryFactory();
Coordinate coord = new Coordinate(25.22, 33.45);
Point point = gf.createPoint(coord);
Geometry geom = GeospatialUtil.transformToEPSG4326LonLatFormat(point, (String) null);
assertThat(geom, is(point));
}
use of com.vividsolutions.jts.geom.GeometryFactory in project ddf by codice.
the class GeoUtilTest method testTransformEpsg4326LonLatBadSrs.
@Test(expected = GeoFormatException.class)
public void testTransformEpsg4326LonLatBadSrs() throws GeoFormatException {
GeometryFactory gf = new GeometryFactory();
Coordinate coord = new Coordinate(25.22, 33.45);
Point point = gf.createPoint(coord);
Geometry geom = GeospatialUtil.transformToEPSG4326LonLatFormat(point, "ESPG:Bad");
}
use of com.vividsolutions.jts.geom.GeometryFactory in project ddf by codice.
the class GeoUtilTest method testTransformEpsg4326EpsgNoSourceCRS.
@Test
public void testTransformEpsg4326EpsgNoSourceCRS() throws FactoryException, TransformException, GeoFormatException {
double lon = 33.45;
double lat = 25.22;
CoordinateReferenceSystem sourceCRS = null;
GeometryFactory geometryFactory = new GeometryFactory();
Coordinate coordinate = new Coordinate(lon, lat);
Point utmPoint = geometryFactory.createPoint(coordinate);
Envelope envelope = JTS.toEnvelope(utmPoint);
Geometry utmGeometry = JTS.toGeometry(envelope);
Geometry lonLatGeom = GeospatialUtil.transformToEPSG4326LonLatFormat(utmGeometry, sourceCRS);
assertThat(lonLatGeom.getCoordinates()[0].x, closeTo(lon, .00001));
assertThat(lonLatGeom.getCoordinates()[0].y, closeTo(lat, .00001));
}
Aggregations