Search in sources :

Example 1 with EnvelopeType

use of net.opengis.gml.EnvelopeType in project arctic-sea by 52North.

the class GmlDecoderv311 method getGeometry4BBOX.

private Geometry getGeometry4BBOX(EnvelopeDocument xbBbox) throws DecodingException {
    EnvelopeType xbEnvelope = xbBbox.getEnvelope();
    // parse srid; if not set, throw exception!
    int srid = CRSHelper.parseSrsName(xbEnvelope.getSrsName());
    String lower = xbEnvelope.getLowerCorner().getStringValue();
    String upper = xbEnvelope.getUpperCorner().getStringValue();
    String geomWKT = String.format("MULTIPOINT(%s, %s)", lower, upper);
    try {
        return JTSHelper.createGeometryFromWKT(geomWKT, srid).getEnvelope();
    } catch (ParseException ex) {
        throw new DecodingException(ex);
    }
}
Also used : EnvelopeType(net.opengis.gml.EnvelopeType) DecodingException(org.n52.svalbard.decode.exception.DecodingException) DateTimeParseException(org.n52.shetland.util.DateTimeParseException) ParseException(org.locationtech.jts.io.ParseException)

Example 2 with EnvelopeType

use of net.opengis.gml.EnvelopeType in project arctic-sea by 52North.

the class GmlEncoderv311 method createEnvelope.

private XmlObject createEnvelope(ReferencedEnvelope sosEnvelope) {
    EnvelopeType envelopeType = EnvelopeType.Factory.newInstance(getXmlOptions());
    MinMax<String> minmax = sosEnvelope.getMinMaxFromEnvelope();
    envelopeType.addNewLowerCorner().setStringValue(minmax.getMinimum());
    envelopeType.addNewUpperCorner().setStringValue(minmax.getMaximum());
    envelopeType.setSrsName(srsNamePrefix + sosEnvelope.getSrid());
    return envelopeType;
}
Also used : EnvelopeType(net.opengis.gml.EnvelopeType) LineString(org.locationtech.jts.geom.LineString)

Aggregations

EnvelopeType (net.opengis.gml.EnvelopeType)2 LineString (org.locationtech.jts.geom.LineString)1 ParseException (org.locationtech.jts.io.ParseException)1 DateTimeParseException (org.n52.shetland.util.DateTimeParseException)1 DecodingException (org.n52.svalbard.decode.exception.DecodingException)1