use of org.apache.pig.backend.executionengine.ExecException in project pigeon by aseldawy.
the class Intersection method exec.
@Override
public DataByteArray exec(Tuple input) throws IOException {
OGCGeometry geom1 = null, geom2 = null;
try {
geom1 = geometryParser.parseGeom(input.get(0));
geom2 = geometryParser.parseGeom(input.get(1));
return new DataByteArray(geom1.intersection(geom2).asBinary().array());
} catch (ExecException ee) {
throw new GeoException(geom1, geom2, ee);
}
}
use of org.apache.pig.backend.executionengine.ExecException in project pigeon by aseldawy.
the class Intersects method exec.
@Override
public Boolean exec(Tuple input) throws IOException {
OGCGeometry geom1 = null, geom2 = null;
try {
geom1 = geometryParser.parseGeom(input.get(0));
geom2 = geometryParser.parseGeom(input.get(1));
return geom1.intersects(geom2);
} catch (ExecException ee) {
throw new GeoException(geom1, geom2, ee);
}
}
use of org.apache.pig.backend.executionengine.ExecException in project pigeon by aseldawy.
the class Buffer method exec.
@Override
public DataByteArray exec(Tuple input) throws IOException {
OGCGeometry geom = null;
try {
Object v = input.get(0);
geom = geometryParser.parseGeom(v);
double dist;
Object distance = input.get(1);
if (distance instanceof Double)
dist = (Double) distance;
else if (distance instanceof Float)
dist = (Float) distance;
else if (distance instanceof Integer)
dist = (Integer) distance;
else if (distance instanceof Long)
dist = (Long) distance;
else if (distance instanceof String)
dist = Double.parseDouble((String) distance);
else if (distance instanceof DataByteArray)
dist = Double.parseDouble(new String(((DataByteArray) distance).get()));
else
throw new GeoException("Invalid second argument in call to Buffer. Expecting Double, Integer or Long");
return new DataByteArray(geom.buffer(dist).asBinary().array());
} catch (ExecException ee) {
throw new GeoException(geom, ee);
}
}
Aggregations