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);
}
}
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;
}
Aggregations