Search in sources :

Example 21 with Kml

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

the class KmlToJtsConverterTest method testConvertGiantKml.

@Test
public void testConvertGiantKml() {
    InputStream stream = KmlToJtsConverterTest.class.getResourceAsStream("/sampleKml.kml");
    Kml kml = Kml.unmarshal(stream);
    assertThat(kml, notNullValue());
    Geometry jtsGeometry = KmlToJtsConverter.from(kml);
    assertThat(jtsGeometry, notNullValue());
    assertThat(jtsGeometry.toString(), not(containsString("EMPTY")));
}
Also used : Geometry(org.locationtech.jts.geom.Geometry) InputStream(java.io.InputStream) Kml(de.micromata.opengis.kml.v_2_2_0.Kml) Test(org.junit.Test)

Example 22 with Kml

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

the class KmlToJtsConverterTest method testConvertKml.

@Test
public void testConvertKml() {
    InputStream stream = KmlToJtsConverterTest.class.getResourceAsStream("/kmlPoint.kml");
    Kml kml = Kml.unmarshal(stream);
    assertThat(kml, notNullValue());
    Geometry jtsGeometry = KmlToJtsConverter.from(kml);
    KmlFeatureToJtsGeometryConverterTest.assertFeature(kml.getFeature(), jtsGeometry);
}
Also used : Geometry(org.locationtech.jts.geom.Geometry) InputStream(java.io.InputStream) Kml(de.micromata.opengis.kml.v_2_2_0.Kml) Test(org.junit.Test)

Example 23 with Kml

use of de.micromata.opengis.kml.v_2_2_0.Kml 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 24 with Kml

use of de.micromata.opengis.kml.v_2_2_0.Kml 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 25 with Kml

use of de.micromata.opengis.kml.v_2_2_0.Kml 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

Kml (de.micromata.opengis.kml.v_2_2_0.Kml)53 InputStream (java.io.InputStream)34 Test (org.junit.Test)31 Placemark (de.micromata.opengis.kml.v_2_2_0.Placemark)15 BeforeClass (org.junit.BeforeClass)13 NetworkLink (de.micromata.opengis.kml.v_2_2_0.NetworkLink)10 Folder (de.micromata.opengis.kml.v_2_2_0.Folder)9 Geometry (org.locationtech.jts.geom.Geometry)8 Document (de.micromata.opengis.kml.v_2_2_0.Document)7 MetacardImpl (ddf.catalog.data.impl.MetacardImpl)6 Metacard (ddf.catalog.data.Metacard)4 CatalogTransformerException (ddf.catalog.transform.CatalogTransformerException)4 LinearRing (de.micromata.opengis.kml.v_2_2_0.LinearRing)4 MultiGeometry (de.micromata.opengis.kml.v_2_2_0.MultiGeometry)4 ByteArrayInputStream (java.io.ByteArrayInputStream)4 IOException (java.io.IOException)4 UriBuilder (javax.ws.rs.core.UriBuilder)4 Handlebars (com.github.jknack.handlebars.Handlebars)3 Template (com.github.jknack.handlebars.Template)3 Feature (de.micromata.opengis.kml.v_2_2_0.Feature)3