Search in sources :

Example 6 with LineString

use of de.micromata.opengis.kml.v_2_2_0.LineString in project ddf by codice.

the class KmlToJtsLineStringConverterTest method testKmlLineStringWithNoCoordinatesReturnsNull.

@Test
public void testKmlLineStringWithNoCoordinatesReturnsNull() {
    org.locationtech.jts.geom.LineString jtsLineString = KmlToJtsLineStringConverter.from(new LineString());
    assertThat(jtsLineString, nullValue());
}
Also used : LineString(de.micromata.opengis.kml.v_2_2_0.LineString) Test(org.junit.Test)

Example 7 with LineString

use of de.micromata.opengis.kml.v_2_2_0.LineString in project ddf by codice.

the class MetacardToKmlTest method getKmlGeoFromJtsGeoLineString.

@Test
public void getKmlGeoFromJtsGeoLineString() throws CatalogTransformerException {
    final org.locationtech.jts.geom.Geometry jtsGeoFromWkt = MetacardToKml.getJtsGeoFromWkt("LINESTRING (-138.957229 48.595168,-121.188711 54.41378,-107.922043 50.230924)");
    final Geometry kmlGeo = MetacardToKml.getKmlGeoFromJtsGeo(jtsGeoFromWkt);
    assertTrue(kmlGeo instanceof LineString);
    final LineString kmlLineString = (LineString) kmlGeo;
    assertThat(kmlLineString.getCoordinates(), hasSize(3));
    assertThat(kmlLineString.getCoordinates().get(0).getLongitude(), is(-138.957229));
    assertThat(kmlLineString.getCoordinates().get(0).getLatitude(), is(48.595168));
}
Also used : Geometry(de.micromata.opengis.kml.v_2_2_0.Geometry) MultiGeometry(de.micromata.opengis.kml.v_2_2_0.MultiGeometry) LineString(de.micromata.opengis.kml.v_2_2_0.LineString) Test(org.junit.Test)

Example 8 with LineString

use of de.micromata.opengis.kml.v_2_2_0.LineString in project ddf by codice.

the class MetacardToKml method createLineStringGeo.

private static Geometry createLineStringGeo(LineString jtsLS) {
    de.micromata.opengis.kml.v_2_2_0.LineString kmlLS = KmlFactory.createLineString();
    List<Coordinate> kmlCoords = kmlLS.createAndSetCoordinates();
    for (org.locationtech.jts.geom.Coordinate coord : jtsLS.getCoordinates()) {
        kmlCoords.add(new Coordinate(coord.x, coord.y));
    }
    return kmlLS;
}
Also used : Coordinate(de.micromata.opengis.kml.v_2_2_0.Coordinate)

Aggregations

LineString (de.micromata.opengis.kml.v_2_2_0.LineString)6 Test (org.junit.Test)4 Coordinate (de.micromata.opengis.kml.v_2_2_0.Coordinate)3 Geometry (de.micromata.opengis.kml.v_2_2_0.Geometry)3 Kml (de.micromata.opengis.kml.v_2_2_0.Kml)2 MultiGeometry (de.micromata.opengis.kml.v_2_2_0.MultiGeometry)2 Placemark (de.micromata.opengis.kml.v_2_2_0.Placemark)2 InputStream (java.io.InputStream)2 ArrayList (java.util.ArrayList)2 GeometryCollection (com.vividsolutions.jts.geom.GeometryCollection)1 LineString (com.vividsolutions.jts.geom.LineString)1 Point (com.vividsolutions.jts.geom.Point)1 Polygon (com.vividsolutions.jts.geom.Polygon)1 CatalogTransformerException (ddf.catalog.transform.CatalogTransformerException)1 BalloonStyle (de.micromata.opengis.kml.v_2_2_0.BalloonStyle)1 IconStyle (de.micromata.opengis.kml.v_2_2_0.IconStyle)1 LineStyle (de.micromata.opengis.kml.v_2_2_0.LineStyle)1 PolyStyle (de.micromata.opengis.kml.v_2_2_0.PolyStyle)1 Style (de.micromata.opengis.kml.v_2_2_0.Style)1 SimpleDateFormat (java.text.SimpleDateFormat)1