Search in sources :

Example 6 with CoordinatesType

use of net.opengis.gml.v_3_1_1.CoordinatesType in project ddf by codice.

the class WfsFilterDelegate method createLineString.

private JAXBElement<LineStringType> createLineString(Geometry geometry) {
    LineStringType lineStringType = gmlObjectFactory.createLineStringType();
    String coordinatesValue = coordinateStrategy.toString(geometry.getCoordinates());
    CoordinatesType coordinatesType = gmlObjectFactory.createCoordinatesType();
    coordinatesType.setValue(coordinatesValue);
    coordinatesType.setDecimal(".");
    coordinatesType.setCs(",");
    coordinatesType.setTs(" ");
    lineStringType.setCoordinates(coordinatesType);
    return gmlObjectFactory.createLineString(lineStringType);
}
Also used : LineString(org.locationtech.jts.geom.LineString) LineStringType(net.opengis.gml.v_3_1_1.LineStringType) CoordinatesType(net.opengis.gml.v_3_1_1.CoordinatesType)

Example 7 with CoordinatesType

use of net.opengis.gml.v_3_1_1.CoordinatesType in project ddf by codice.

the class WfsFilterDelegate method createCoordinates.

private CoordinatesType createCoordinates(Geometry geometry) {
    CoordinatesType coords = gml320ObjectFactory.createCoordinatesType();
    Coordinate[] coordinates = geometry.getCoordinates();
    if (coordinates != null && coordinates.length > 0) {
        StringBuffer coordString = new StringBuffer();
        for (Coordinate coordinate : coordinates) {
            coordString.append(coordinate.x).append(",").append(coordinate.y).append(" ");
        }
        coords.setValue(coordString.toString());
        coords.setDecimal(".");
        coords.setCs(",");
        coords.setTs(" ");
        coords.setValue(coordString.toString());
        return coords;
    } else {
        throw new IllegalArgumentException("Unable to parse Geometry coordinates from WKT String");
    }
}
Also used : Coordinate(org.locationtech.jts.geom.Coordinate) CoordinatesType(net.opengis.gml.v_3_2_1.CoordinatesType)

Example 8 with CoordinatesType

use of net.opengis.gml.v_3_1_1.CoordinatesType in project ddf by codice.

the class WfsFilterDelegate method createPoint.

private JAXBElement<PointType> createPoint(Geometry geometry) {
    Coordinate[] coordinates = geometry.getCoordinates();
    if (coordinates != null && coordinates.length > 0) {
        StringBuilder coordString = new StringBuilder();
        coordString.append(coordinates[0].x).append(",").append(coordinates[0].y);
        CoordinatesType coordinatesType = new CoordinatesType();
        coordinatesType.setValue(coordString.toString());
        PointType point = new PointType();
        point.setSrsName(srsName);
        point.setCoordinates(coordinatesType);
        return gml320ObjectFactory.createPoint(point);
    } else {
        throw new IllegalArgumentException("Unable to parse Point coordinates from WKT String");
    }
}
Also used : Coordinate(org.locationtech.jts.geom.Coordinate) PointType(net.opengis.gml.v_3_2_1.PointType) CoordinatesType(net.opengis.gml.v_3_2_1.CoordinatesType)

Example 9 with CoordinatesType

use of net.opengis.gml.v_3_1_1.CoordinatesType in project ddf by codice.

the class WfsFilterDelegate method createPoint.

private JAXBElement<AbstractGeometryType> createPoint(String wkt) {
    Coordinate[] coordinates = getCoordinatesFromWkt(wkt);
    if (coordinates != null && coordinates.length > 0) {
        CoordinatesType coordinatesType = new CoordinatesType();
        String coordinateString = coordinateStrategy.toString(coordinates[0]);
        coordinatesType.setValue(coordinateString);
        PointType point = new PointType();
        point.setCoordinates(coordinatesType);
        return gmlObjectFactory.createGeometry(point);
    } else {
        throw new IllegalArgumentException("Unable to parse Point coordinates from WKT String");
    }
}
Also used : Coordinate(org.locationtech.jts.geom.Coordinate) PointType(net.opengis.gml.v_3_1_1.PointType) LineString(org.locationtech.jts.geom.LineString) CoordinatesType(net.opengis.gml.v_3_1_1.CoordinatesType)

Example 10 with CoordinatesType

use of net.opengis.gml.v_3_1_1.CoordinatesType in project ddf by codice.

the class WfsFilterDelegate method createPolygon.

private PolygonType createPolygon(Coordinate[] coordinates) {
    if (coordinates != null && coordinates.length > 0) {
        PolygonType polygon = new PolygonType();
        LinearRingType linearRing = new LinearRingType();
        String coordinateString = coordinateStrategy.toString(coordinates);
        CoordinatesType coordinatesType = new CoordinatesType();
        coordinatesType.setValue(coordinateString);
        coordinatesType.setDecimal(".");
        coordinatesType.setCs(",");
        coordinatesType.setTs(" ");
        linearRing.setCoordinates(coordinatesType);
        AbstractRingPropertyType abstractRingPropertyType = gmlObjectFactory.createAbstractRingPropertyType();
        abstractRingPropertyType.setRing(gmlObjectFactory.createLinearRing(linearRing));
        polygon.setExterior(gmlObjectFactory.createExterior(abstractRingPropertyType));
        return polygon;
    } else {
        throw new IllegalArgumentException("Unable to parse Polygon coordinates from WKT String");
    }
}
Also used : LinearRingType(net.opengis.gml.v_3_1_1.LinearRingType) AbstractRingPropertyType(net.opengis.gml.v_3_1_1.AbstractRingPropertyType) PolygonType(net.opengis.gml.v_3_1_1.PolygonType) MultiPolygonType(net.opengis.gml.v_3_1_1.MultiPolygonType) LineString(org.locationtech.jts.geom.LineString) CoordinatesType(net.opengis.gml.v_3_1_1.CoordinatesType)

Aggregations

Coordinate (org.locationtech.jts.geom.Coordinate)4 CoordinatesType (net.opengis.gml.v_3_1_1.CoordinatesType)3 CoordinatesType (net.opengis.gml.v_3_2_1.CoordinatesType)3 CoordinatesType (net.opengis.gml.x32.CoordinatesType)3 CoordinatesType (ogc.schema.opengis.gml.v_2_1_2.CoordinatesType)3 LineString (org.locationtech.jts.geom.LineString)3 Coordinate (com.vividsolutions.jts.geom.Coordinate)2 DirectPositionType (net.opengis.gml.x32.DirectPositionType)2 DecodingException (org.n52.svalbard.decode.exception.DecodingException)2 Envelope (com.vividsolutions.jts.geom.Envelope)1 LineString (com.vividsolutions.jts.geom.LineString)1 MultiLineString (com.vividsolutions.jts.geom.MultiLineString)1 AbstractRingPropertyType (net.opengis.gml.v_3_1_1.AbstractRingPropertyType)1 LineStringType (net.opengis.gml.v_3_1_1.LineStringType)1 LinearRingType (net.opengis.gml.v_3_1_1.LinearRingType)1 MultiPolygonType (net.opengis.gml.v_3_1_1.MultiPolygonType)1 PointType (net.opengis.gml.v_3_1_1.PointType)1 PolygonType (net.opengis.gml.v_3_1_1.PolygonType)1 LineStringType (net.opengis.gml.v_3_2_1.LineStringType)1 PointType (net.opengis.gml.v_3_2_1.PointType)1