Search in sources :

Example 56 with DirectPositionType

use of org.geotoolkit.gml.xml.v321.DirectPositionType in project geotoolkit by Geomatys.

the class GeometrytoJTSTest method gmlEnvelopeToJTSTest2D.

@Test
public void gmlEnvelopeToJTSTest2D() throws Exception {
    final EnvelopeType env = new EnvelopeType(new DirectPositionType(2.0, 2.0), new DirectPositionType(4.0, 4.0), "EPSG:4326");
    final Geometry geom = GeometrytoJTS.toJTS(env);
    Coordinate[] expectedPoints = { new Coordinate(2.0, 2.0), new Coordinate(2.0, 4.0), new Coordinate(4.0, 4.0), new Coordinate(4.0, 2.0), new Coordinate(2.0, 2.0) };
    Assert.assertTrue(GF.createPolygon(expectedPoints).equalsTopo(geom));
}
Also used : Geometry(org.locationtech.jts.geom.Geometry) EnvelopeType(org.geotoolkit.gml.xml.v321.EnvelopeType) DirectPositionType(org.geotoolkit.gml.xml.v321.DirectPositionType) Coordinate(org.locationtech.jts.geom.Coordinate) Test(org.junit.Test)

Example 57 with DirectPositionType

use of org.geotoolkit.gml.xml.v321.DirectPositionType in project tiamat by entur.

the class SimplePointVersionStructureConverterTest method importUtmGML.

@Test
public void importUtmGML() {
    SimplePoint_VersionStructure simplePointversionStructure = new SimplePoint_VersionStructure().withLocation(new LocationStructure().withPos(new DirectPositionType().withValue(6583758.0, 514477.0).withSrsName("EPSG:32632")));
    Point point = simplePointVersionStructureConverter.convertFrom(simplePointversionStructure, pointType, mappingContext);
    assertNotNull(point);
    assertThat(point.getX()).isCloseTo(9.25, Percentage.withPercentage(2));
    assertThat(point.getY()).isCloseTo(59.39, Percentage.withPercentage(2));
}
Also used : DirectPositionType(net.opengis.gml._3.DirectPositionType) SimplePoint_VersionStructure(org.rutebanken.netex.model.SimplePoint_VersionStructure) Point(org.locationtech.jts.geom.Point) LocationStructure(org.rutebanken.netex.model.LocationStructure) Test(org.junit.Test)

Aggregations

DirectPositionType (org.geotoolkit.gml.xml.v311.DirectPositionType)24 ArrayList (java.util.ArrayList)14 PointType (org.geotoolkit.gml.xml.v311.PointType)14 Test (org.junit.Test)11 StringWriter (java.io.StringWriter)10 DirectPositionType (net.opengis.gml.v_3_1_1.DirectPositionType)10 DirectPositionType (org.geotoolkit.gml.xml.v321.DirectPositionType)10 EnvelopeType (org.geotoolkit.gml.xml.v311.EnvelopeType)9 StringReader (java.io.StringReader)8 JAXBElement (javax.xml.bind.JAXBElement)8 EnvelopeType (net.opengis.gml.v_3_1_1.EnvelopeType)7 Geometry (org.locationtech.jts.geom.Geometry)7 Coordinate (org.locationtech.jts.geom.Coordinate)6 BBOXType (net.opengis.filter.v_1_1_0.BBOXType)5 CoordinateReferenceSystem (org.opengis.referencing.crs.CoordinateReferenceSystem)5 DirectPositionType (net.opengis.gml.x32.DirectPositionType)4 FeaturePropertyType (org.geotoolkit.gml.xml.v311.FeaturePropertyType)4 SamplingPointType (org.geotoolkit.sampling.xml.v100.SamplingPointType)4 FilterType (net.opengis.filter.v_1_1_0.FilterType)3 DirectPositionType (net.opengis.gml.v_3_2_1.DirectPositionType)3