use of org.locationtech.jts.geom.Coordinate in project jena by apache.
the class GeometryWrapperTest method testGetGeometryDatatypeURI.
/**
* Test of getGeometryDatatypeURI method, of class GeometryWrapper.
*/
@Test
public void testGetGeometryDatatypeURI() {
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);
String expResult = WKTDatatype.URI;
String result = instance.getGeometryDatatypeURI();
assertEquals(expResult, result);
}
use of org.locationtech.jts.geom.Coordinate in project jena by apache.
the class GeometryWrapperTest method testDistanceSameSRSDifferentUnit.
/**
* Test of distanceEuclidean same SRS_URI method, of class GeometryWrapper.
*
* @throws java.lang.Exception
*/
@Test
public void testDistanceSameSRSDifferentUnit() throws Exception {
// LatLon - 51.31, -2.21
Geometry targetGeo = GEOMETRY_FACTORY.createPoint(new Coordinate(385458, 156785));
String targetSRSURI = SRS_URI.OSGB36_CRS;
GeometryWrapper targetGeometry = new GeometryWrapper(targetGeo, targetSRSURI, WKTDatatype.URI, DimensionInfo.XY_POINT);
// LatLon: 51.31, -0.74
Geometry instanceGeo = GEOMETRY_FACTORY.createPoint(new Coordinate(487920, 157518));
String instanceSRSURI = SRS_URI.OSGB36_CRS;
GeometryWrapper instance = new GeometryWrapper(instanceGeo, instanceSRSURI, WKTDatatype.URI, DimensionInfo.XY_POINT);
// SRS is in metres.
String distanceUnitsURL = Unit_URI.RADIAN_URL;
// Degree: 1.47
double expResult = 0.025656;
double result = instance.distanceEuclidean(targetGeometry, distanceUnitsURL);
assertEquals(expResult, result, 0.001);
}
use of org.locationtech.jts.geom.Coordinate in project jena by apache.
the class GeometryWrapperTest method testGetSrsURI.
/**
* Test of getSrsURI method, of class GeometryWrapper.
*/
@Test
public void testGetSrsURI() {
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);
String expResult = SRS_URI.WGS84_CRS;
String result = instance.getSrsURI();
assertEquals(expResult, result);
}
use of org.locationtech.jts.geom.Coordinate in project jena by apache.
the class GeometryWrapperTest method testGetSRID.
/**
* Test of getSRID method, of class GeometryWrapper.
*/
@Test
public void testGetSRID() {
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);
String expResult = SRS_URI.WGS84_CRS;
String result = instance.getSRID();
assertEquals(expResult, result);
}
use of org.locationtech.jts.geom.Coordinate in project jena by apache.
the class GeometryWrapperTest method testDistanceSameSRSSameUnit.
/**
* Test of distanceEuclidean same SRS_URI method, of class GeometryWrapper.
*
* @throws java.lang.Exception
*/
@Test
public void testDistanceSameSRSSameUnit() throws Exception {
Geometry targetGeo = GEOMETRY_FACTORY.createPoint(new Coordinate(2.0, 1.0));
String targetSRSURI = SRS_URI.OSGB36_CRS;
GeometryWrapper targetGeometry = new GeometryWrapper(targetGeo, targetSRSURI, WKTDatatype.URI, DimensionInfo.XY_POINT);
Geometry instanceGeo = GEOMETRY_FACTORY.createPoint(new Coordinate(12.0, 1.0));
String instanceSRSURI = SRS_URI.OSGB36_CRS;
GeometryWrapper instance = new GeometryWrapper(instanceGeo, instanceSRSURI, WKTDatatype.URI, DimensionInfo.XY_POINT);
// SRS is in metres.
String distanceUnitsURL = Unit_URI.METRE_URL;
double expResult = 10.0;
double result = instance.distanceEuclidean(targetGeometry, distanceUnitsURL);
assertEquals(expResult, result, 0.0);
}
Aggregations