Search in sources :

Example 31 with Coordinate

use of org.locationtech.jts.geom.Coordinate in project jena by apache.

the class GMLReaderTest method testGetGeometryPointZ.

/**
 * Test of getGeometry method, of class GMLReader.
 */
@Test
public void testGetGeometryPointZ() {
    GMLReader instance = new GMLReader(GEOMETRY_FACTORY.createPoint(new Coordinate(11.0, 12.0, 13.0)), 2);
    Geometry expResult = GEOMETRY_FACTORY.createPoint(new CustomCoordinateSequence(CoordinateSequenceDimensions.XYZ, "11.0 12.0 8.0"));
    Geometry result = instance.getGeometry();
    // 
    // 
    assertEquals(expResult, result);
}
Also used : Geometry(org.locationtech.jts.geom.Geometry) Coordinate(org.locationtech.jts.geom.Coordinate) CustomCoordinateSequence(org.apache.jena.geosparql.implementation.jts.CustomCoordinateSequence) Test(org.junit.Test)

Example 32 with Coordinate

use of org.locationtech.jts.geom.Coordinate in project jena by apache.

the class GeometryWrapperFactoryTest method testCreatLineString_xy.

/**
 * Test of createLineString method, of class GeometryWrapper.
 */
@Test
public void testCreatLineString_xy() {
    List<Coordinate> coordinates = Arrays.asList(new Coordinate(1, 2), new Coordinate(10, 20));
    String srsURI = SRS_URI.DEFAULT_WKT_CRS84;
    String geometryDatatypeURI = WKTDatatype.URI;
    GeometryWrapper instance = GeometryWrapperFactory.createLineString(coordinates, srsURI, geometryDatatypeURI);
    String expResult = "LINESTRING(1 2, 10 20)";
    String result = instance.asLiteral().getLexicalForm();
    assertEquals(expResult, result);
}
Also used : Coordinate(org.locationtech.jts.geom.Coordinate) Test(org.junit.Test)

Example 33 with Coordinate

use of org.locationtech.jts.geom.Coordinate in project jena by apache.

the class GeometryWrapperFactoryTest method testCreatPoint_xy.

/**
 * Test of createPoint method, of class GeometryWrapper.
 */
@Test
public void testCreatPoint_xy() {
    Coordinate coordinate = new Coordinate(1, 2);
    String srsURI = SRS_URI.DEFAULT_WKT_CRS84;
    String geometryDatatypeURI = WKTDatatype.URI;
    GeometryWrapper instance = GeometryWrapperFactory.createPoint(coordinate, srsURI, geometryDatatypeURI);
    String expResult = "POINT(1 2)";
    String result = instance.asLiteral().getLexicalForm();
    assertEquals(expResult, result);
}
Also used : Coordinate(org.locationtech.jts.geom.Coordinate) Test(org.junit.Test)

Example 34 with Coordinate

use of org.locationtech.jts.geom.Coordinate in project jena by apache.

the class GeometryWrapperFactoryTest method testCreatPolygon.

/**
 * Test of createPolygon method, of class GeometryWrapper.
 */
@Test
public void testCreatPolygon() {
    List<Coordinate> coordinates = Arrays.asList(new Coordinate(1, 2), new Coordinate(10, 2), new Coordinate(10, 20), new Coordinate(1, 20), new Coordinate(1, 2));
    String srsURI = SRS_URI.WGS84_CRS;
    String geometryDatatypeURI = WKTDatatype.URI;
    GeometryWrapper instance = GeometryWrapperFactory.createPolygon(coordinates, srsURI, geometryDatatypeURI);
    String expResult = "<http://www.opengis.net/def/crs/EPSG/0/4326> POLYGON((2 1, 2 10, 20 10, 20 1, 2 1))";
    String result = instance.asLiteral().getLexicalForm();
    assertEquals(expResult, result);
}
Also used : Coordinate(org.locationtech.jts.geom.Coordinate) Test(org.junit.Test)

Example 35 with Coordinate

use of org.locationtech.jts.geom.Coordinate in project jena by apache.

the class GeometryWrapperTest method testGetXYGeometry_polygon.

/**
 * Test of getXYGeometry method, of class GeometryWrapper.
 *
 * @throws org.opengis.util.FactoryException
 * @throws org.opengis.referencing.operation.TransformException
 */
@Test
public void testGetXYGeometry_polygon() throws FactoryException, MismatchedDimensionException, TransformException {
    GeometryWrapper instance = GeometryWrapper.extract("<http://www.opengis.net/def/crs/EPSG/0/4326> POLYGON((10.0 -180.0, 20.0 -180.0, 20.0 -170.0, 10.0 -170.0, 10.0 -180.0))", WKTDatatype.URI);
    Coordinate[] coordinates = { new Coordinate(-180.0, 10.0), new Coordinate(-180.0, 20.0), new Coordinate(-170.0, 20.0), new Coordinate(-170.0, 10.0), new Coordinate(-180.0, 10.0) };
    Geometry expResult = GEOMETRY_FACTORY.createPolygon(coordinates);
    Geometry result = instance.getXYGeometry();
    assertEquals(expResult, result);
}
Also used : Geometry(org.locationtech.jts.geom.Geometry) Coordinate(org.locationtech.jts.geom.Coordinate) Test(org.junit.Test)

Aggregations

Coordinate (org.locationtech.jts.geom.Coordinate)330 Test (org.junit.Test)135 Geometry (org.locationtech.jts.geom.Geometry)64 GeometryFactory (org.locationtech.jts.geom.GeometryFactory)62 LineString (org.locationtech.jts.geom.LineString)54 Point (org.locationtech.jts.geom.Point)51 Polygon (org.locationtech.jts.geom.Polygon)44 LinearRing (org.locationtech.jts.geom.LinearRing)42 AbstractArcTest (eu.esdihumboldt.util.geometry.interpolation.AbstractArcTest)37 ArcByCenterPoint (eu.esdihumboldt.util.geometry.interpolation.model.ArcByCenterPoint)32 ArrayList (java.util.ArrayList)31 Test (org.junit.jupiter.api.Test)26 MultiPolygon (org.locationtech.jts.geom.MultiPolygon)25 Arc (eu.esdihumboldt.util.geometry.interpolation.model.Arc)20 ArcByPointsImpl (eu.esdihumboldt.util.geometry.interpolation.model.impl.ArcByPointsImpl)17 ArcByCenterPointImpl (eu.esdihumboldt.util.geometry.interpolation.model.impl.ArcByCenterPointImpl)16 GeometryWrapper (org.apache.jena.geosparql.implementation.GeometryWrapper)15 MultiPoint (org.locationtech.jts.geom.MultiPoint)15 ArcByPoints (eu.esdihumboldt.util.geometry.interpolation.model.ArcByPoints)14 HashMap (java.util.HashMap)13