Search in sources :

Example 11 with Placemark

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

the class KmlToJtsPolygonConverterTest method setupClass.

@BeforeClass
public static void setupClass() {
    InputStream stream = KmlToJtsPolygonConverterTest.class.getResourceAsStream("/kmlPolygon.kml");
    Kml kml = Kml.unmarshal(stream);
    testKmlPolygon = ((Polygon) ((Placemark) kml.getFeature()).getGeometry());
}
Also used : InputStream(java.io.InputStream) Kml(de.micromata.opengis.kml.v_2_2_0.Kml) Polygon(de.micromata.opengis.kml.v_2_2_0.Polygon) BeforeClass(org.junit.BeforeClass)

Example 12 with Placemark

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

the class KmlToJtsPolygonConverterTest method getTestKmlPolygonWithHoles.

private Polygon getTestKmlPolygonWithHoles() {
    InputStream stream = KmlToJtsPolygonConverterTest.class.getResourceAsStream("/kmlPolygonWithHoles.kml");
    Kml kml = Kml.unmarshal(stream);
    assertThat(kml, notNullValue());
    Polygon polygon = ((Polygon) ((Placemark) kml.getFeature()).getGeometry());
    assertThat(polygon, notNullValue());
    LinearRing linearRing = polygon.getOuterBoundaryIs().getLinearRing();
    assertThat(linearRing, notNullValue());
    List<LinearRing> holes = polygon.getInnerBoundaryIs().stream().map(Boundary::getLinearRing).collect(Collectors.toList());
    assertThat(holes, not(empty()));
    return polygon;
}
Also used : Placemark(de.micromata.opengis.kml.v_2_2_0.Placemark) InputStream(java.io.InputStream) Kml(de.micromata.opengis.kml.v_2_2_0.Kml) Polygon(de.micromata.opengis.kml.v_2_2_0.Polygon) LinearRing(de.micromata.opengis.kml.v_2_2_0.LinearRing)

Example 13 with Placemark

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

the class KmlToJtsGeometryConverterTest method testConvertModelGeometry.

@Test
public void testConvertModelGeometry() {
    InputStream stream = KmlToJtsGeometryConverterTest.class.getResourceAsStream("/kmlModel.kml");
    Kml kml = Kml.unmarshal(stream);
    assertThat(kml, notNullValue());
    Model model = ((Model) ((Placemark) kml.getFeature()).getGeometry());
    assertThat(model, notNullValue());
    org.locationtech.jts.geom.Geometry jtsGeometryPointFromModel = KmlToJtsGeometryConverter.from(model);
    assertThat(jtsGeometryPointFromModel, instanceOf(org.locationtech.jts.geom.Point.class));
    assertSpecificGeometry(model, jtsGeometryPointFromModel);
}
Also used : Placemark(de.micromata.opengis.kml.v_2_2_0.Placemark) InputStream(java.io.InputStream) Model(de.micromata.opengis.kml.v_2_2_0.Model) Kml(de.micromata.opengis.kml.v_2_2_0.Kml) Point(de.micromata.opengis.kml.v_2_2_0.Point) Test(org.junit.Test)

Example 14 with Placemark

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

the class KmlToJtsGeometryConverterTest method testConvertLineStringGeometry.

@Test
public void testConvertLineStringGeometry() {
    InputStream stream = KmlToJtsGeometryConverterTest.class.getResourceAsStream("/kmlLineString.kml");
    Kml kml = Kml.unmarshal(stream);
    assertThat(kml, notNullValue());
    LineString kmlLineString = ((LineString) ((Placemark) kml.getFeature()).getGeometry());
    assertThat(kmlLineString, notNullValue());
    org.locationtech.jts.geom.Geometry jtsGeometryLineString = KmlToJtsGeometryConverter.from(kmlLineString);
    assertThat(jtsGeometryLineString, instanceOf(org.locationtech.jts.geom.LineString.class));
    assertSpecificGeometry(kmlLineString, jtsGeometryLineString);
}
Also used : Placemark(de.micromata.opengis.kml.v_2_2_0.Placemark) LineString(de.micromata.opengis.kml.v_2_2_0.LineString) InputStream(java.io.InputStream) Kml(de.micromata.opengis.kml.v_2_2_0.Kml) Test(org.junit.Test)

Example 15 with Placemark

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

the class KmlToJtsLinearRingConverterTest method setupClass.

@BeforeClass
public static void setupClass() {
    InputStream stream = KmlToJtsLinearRingConverterTest.class.getResourceAsStream("/kmlLinearRing.kml");
    Kml kml = Kml.unmarshal(stream);
    testKmlLinearRing = ((LinearRing) ((Placemark) kml.getFeature()).getGeometry());
}
Also used : InputStream(java.io.InputStream) Kml(de.micromata.opengis.kml.v_2_2_0.Kml) LinearRing(de.micromata.opengis.kml.v_2_2_0.LinearRing) BeforeClass(org.junit.BeforeClass)

Aggregations

Placemark (de.micromata.opengis.kml.v_2_2_0.Placemark)35 Test (org.junit.Test)29 Kml (de.micromata.opengis.kml.v_2_2_0.Kml)23 InputStream (java.io.InputStream)20 MetacardImpl (ddf.catalog.data.impl.MetacardImpl)19 Point (de.micromata.opengis.kml.v_2_2_0.Point)19 TimeSpan (de.micromata.opengis.kml.v_2_2_0.TimeSpan)16 MultiGeometry (de.micromata.opengis.kml.v_2_2_0.MultiGeometry)15 LineString (de.micromata.opengis.kml.v_2_2_0.LineString)12 Polygon (de.micromata.opengis.kml.v_2_2_0.Polygon)10 BeforeClass (org.junit.BeforeClass)8 LinearRing (de.micromata.opengis.kml.v_2_2_0.LinearRing)5 Document (de.micromata.opengis.kml.v_2_2_0.Document)4 Feature (de.micromata.opengis.kml.v_2_2_0.Feature)4 Style (de.micromata.opengis.kml.v_2_2_0.Style)4 ByteArrayInputStream (java.io.ByteArrayInputStream)4 IOException (java.io.IOException)4 ProfilePlacemark (se.trixon.mapollage.profile.ProfilePlacemark)4 BalloonStyle (de.micromata.opengis.kml.v_2_2_0.BalloonStyle)3 IconStyle (de.micromata.opengis.kml.v_2_2_0.IconStyle)3