Search in sources :

Example 11 with Coordinate

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

the class KmlLatLonBoxToJtsGeometryConverterTest method createKmlBoundingBoxCoordinates.

private static List<Coordinate> createKmlBoundingBoxCoordinates(double minX, double maxX, double minY, double maxY) {
    List<Coordinate> coordinates = new ArrayList<>();
    // This is the order that WKT wants the polygon
    // Starting Upper Right, moving clockwise
    coordinates.add(new Coordinate(maxX, maxY));
    coordinates.add(new Coordinate(maxX, minY));
    coordinates.add(new Coordinate(minX, minY));
    coordinates.add(new Coordinate(minX, maxY));
    coordinates.add(new Coordinate(maxX, maxY));
    return coordinates;
}
Also used : Coordinate(de.micromata.opengis.kml.v_2_2_0.Coordinate) ArrayList(java.util.ArrayList)

Example 12 with Coordinate

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

the class KmlToJtsCoordinateConverterTest method assertJtsCoordinatesFromKmlCoordinates.

static void assertJtsCoordinatesFromKmlCoordinates(List<Coordinate> kmlCoordinates, org.locationtech.jts.geom.Coordinate[] jtsCoordinates) {
    assertThat(jtsCoordinates.length, is(equalTo(kmlCoordinates.size())));
    for (Coordinate kmlCoordinate : kmlCoordinates) {
        org.locationtech.jts.geom.Coordinate jtsCoordinate = new org.locationtech.jts.geom.Coordinate(kmlCoordinate.getLongitude(), kmlCoordinate.getLatitude(), kmlCoordinate.getAltitude());
        assertThat(jtsCoordinates, hasItemInArray((jtsCoordinate)));
    }
}
Also used : Coordinate(de.micromata.opengis.kml.v_2_2_0.Coordinate)

Example 13 with Coordinate

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

the class KmlModelToJtsPointConverter method from.

public static Point from(Model kmlModel) {
    if (kmlModel == null || kmlModel.getLocation() == null) {
        return null;
    }
    Location kmlLocation = kmlModel.getLocation();
    Coordinate jtsCoordinate = new Coordinate(kmlLocation.getLongitude(), kmlLocation.getLatitude(), kmlLocation.getAltitude());
    GeometryFactory geometryFactory = JTSFactoryFinder.getGeometryFactory();
    return geometryFactory.createPoint(jtsCoordinate);
}
Also used : GeometryFactory(org.locationtech.jts.geom.GeometryFactory) Coordinate(org.locationtech.jts.geom.Coordinate) Location(de.micromata.opengis.kml.v_2_2_0.Location)

Example 14 with Coordinate

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

Coordinate (de.micromata.opengis.kml.v_2_2_0.Coordinate)9 ArrayList (java.util.ArrayList)4 Point (de.micromata.opengis.kml.v_2_2_0.Point)3 Test (org.junit.Test)3 Geometry (de.micromata.opengis.kml.v_2_2_0.Geometry)2 LineString (de.micromata.opengis.kml.v_2_2_0.LineString)2 Location (de.micromata.opengis.kml.v_2_2_0.Location)2 Placemark (de.micromata.opengis.kml.v_2_2_0.Placemark)2 List (java.util.List)2 ProfilePlacemark (se.trixon.mapollage.profile.ProfilePlacemark)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 Boundary (de.micromata.opengis.kml.v_2_2_0.Boundary)1 Document (de.micromata.opengis.kml.v_2_2_0.Document)1 Feature (de.micromata.opengis.kml.v_2_2_0.Feature)1 Folder (de.micromata.opengis.kml.v_2_2_0.Folder)1