use of org.locationtech.jts.geom.Coordinate in project jena by apache.
the class GeometryWrapperTest method testGetCRS.
/**
* Test of getCRS method, of class GeometryWrapper.
*
* @throws org.opengis.util.FactoryException
*/
@Test
public void testGetCRS() throws FactoryException {
Geometry geometry = GEOMETRY_FACTORY.createPoint(new Coordinate(1.0, 2.0));
String sourceSRSURI = SRS_URI.WGS84_CRS;
GeometryWrapper instance = new GeometryWrapper(geometry, sourceSRSURI, WKTDatatype.URI, DimensionInfo.XY_POINT);
CoordinateReferenceSystem expResult = CRS.forCode(sourceSRSURI);
CoordinateReferenceSystem result = instance.getCRS();
assertEquals(expResult, result);
}
use of org.locationtech.jts.geom.Coordinate in project jena by apache.
the class GeometryWrapperTest method testGetXYGeometry.
/**
* Test of getXYGeometry method, of class GeometryWrapper.
*/
@Test
public void testGetXYGeometry() {
Geometry geometry = GEOMETRY_FACTORY.createPoint(new Coordinate(1.0, 2.0));
String sourceSRSURI = SRS_URI.WGS84_CRS;
GeometryWrapper instance = new GeometryWrapper(geometry, sourceSRSURI, WKTDatatype.URI, DimensionInfo.XY_POINT);
// Expect the coordinates to be reversed as JTS is x,y and WGS84 is y,x
Geometry expResult = GEOMETRY_FACTORY.createPoint(new Coordinate(2.0, 1.0));
Geometry result = instance.getXYGeometry();
assertEquals(expResult, result);
}
use of org.locationtech.jts.geom.Coordinate in project jena by apache.
the class GeometryWrapperTest method testGetParsingGeometry.
/**
* Test of getParsingGeometry method, of class GeometryWrapper.
*/
@Test
public void testGetParsingGeometry() {
Geometry geometry = GEOMETRY_FACTORY.createPoint(new Coordinate(1.0, 2.0));
String sourceSRSURI = SRS_URI.WGS84_CRS;
GeometryWrapper instance = new GeometryWrapper(geometry, sourceSRSURI, WKTDatatype.URI, DimensionInfo.XY_POINT);
// Expect coordinates to be same as supplied.
Geometry expResult = GEOMETRY_FACTORY.createPoint(new Coordinate(1.0, 2.0));
Geometry result = instance.getParsingGeometry();
assertEquals(expResult, result);
}
use of org.locationtech.jts.geom.Coordinate in project jena by apache.
the class WKTDatatypeTest method testParseNoSRSNotEqual.
/**
* Test of parse method, of class WKTDatatype.
*/
@Test
public void testParseNoSRSNotEqual() {
String lexicalForm = "POINT(-83.38 33.95)";
GeometryWrapper result = WKT_DATATYPE.parse(lexicalForm);
Coordinate coord = new Coordinate(-88.38, 33.95);
Point expGeometry = GEOMETRY_FACTORY.createPoint(coord);
String expSRSURI = SRS_URI.DEFAULT_WKT_CRS84;
DimensionInfo dimensionInfo = new DimensionInfo(2, 2, 0);
GeometryWrapper expResult = new GeometryWrapper(expGeometry, expSRSURI, WKTDatatype.URI, dimensionInfo);
//
//
assertThat(expResult, not(result));
}
use of org.locationtech.jts.geom.Coordinate in project jena by apache.
the class WKTDatatypeTest method testParseSRS.
/**
* Test of parse method, of class WKTDatatype.
*/
@Test
public void testParseSRS() {
String lexicalForm = "<http://www.opengis.net/def/crs/EPSG/0/4326> POINT(33.95 -88.38)";
GeometryWrapper result = WKT_DATATYPE.parse(lexicalForm);
Coordinate coord = new Coordinate(33.95, -88.38);
Point expGeometry = GEOMETRY_FACTORY.createPoint(coord);
String expSRSURI = "http://www.opengis.net/def/crs/EPSG/0/4326";
DimensionInfo dimensionInfo = new DimensionInfo(2, 2, 0);
GeometryWrapper expResult = new GeometryWrapper(expGeometry, expSRSURI, WKTDatatype.URI, dimensionInfo);
//
//
assertEquals(expResult, result);
}
Aggregations