use of com.vividsolutions.jts.io.InputStreamInStream in project teiid by teiid.
the class GeometryUtils method getGeometry.
public static Geometry getGeometry(InputStream is1, Integer srid, boolean allowEwkb) throws FunctionExecutionException {
try {
WKBReader reader = new WKBReader();
Geometry jtsGeom = reader.read(new InputStreamInStream(is1));
if (!allowEwkb && (jtsGeom.getSRID() != GeometryType.UNKNOWN_SRID || (jtsGeom.getCoordinate() != null && !Double.isNaN(jtsGeom.getCoordinate().z)))) {
// $NON-NLS-1$
throw new FunctionExecutionException(QueryPlugin.Util.gs(QueryPlugin.Event.TEIID31160, "EWKB"));
}
if (srid != null) {
jtsGeom.setSRID(srid);
}
return jtsGeom;
} catch (ParseException e) {
throw new FunctionExecutionException(e);
} catch (IOException e) {
throw new FunctionExecutionException(e);
} finally {
if (is1 != null) {
try {
is1.close();
} catch (IOException e) {
}
}
}
}
Aggregations