use of com.esri.core.geometry.ogc.OGCGeometry in project pigeon by aseldawy.
the class Within 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.within(geom2);
} catch (ExecException ee) {
throw new GeoException(geom1, geom2, ee);
}
}
use of com.esri.core.geometry.ogc.OGCGeometry in project pigeon by aseldawy.
the class ConvexHull method convexHull.
protected static OGCGeometry convexHull(Tuple input) throws ExecException {
DataBag values = (DataBag) input.get(0);
if (values.size() == 0)
return null;
ArrayList<OGCGeometry> all_geoms = new ArrayList<OGCGeometry>();
for (Tuple one_geom : values) {
OGCGeometry parsedGeom = geometryParser.parseGeom(one_geom.get(0));
all_geoms.add(parsedGeom);
}
// Do a convex null of all_geometries
OGCGeometryCollection geom_collection = new OGCConcreteGeometryCollection(all_geoms, all_geoms.get(0).getEsriSpatialReference());
return geom_collection.convexHull();
}
use of com.esri.core.geometry.ogc.OGCGeometry in project pigeon by aseldawy.
the class Difference 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.difference(geom2).asBinary().array());
} catch (ExecException ee) {
throw new GeoException(geom1, geom2, ee);
}
}
use of com.esri.core.geometry.ogc.OGCGeometry in project pigeon by aseldawy.
the class OGCGeometryToESRIShapeParser method ogcGeomToEsriShape.
public static byte[] ogcGeomToEsriShape(Object o) throws ExecException {
ESRIGeometryParser parser = new ESRIGeometryParser();
OGCGeometry geom = parser.parseGeom(o);
int wkid = geom.SRID();
int geomType = getGeometryType(geom);
byte[] shape = GeometryEngine.geometryToEsriShape(geom.getEsriGeometry());
byte[] shapeWithData = new byte[shape.length + SIZE_TYPE + SIZE_WKID];
System.arraycopy(shape, 0, shapeWithData, SIZE_WKID + SIZE_TYPE, shape.length);
System.arraycopy(intToBytes(wkid), 0, shapeWithData, 0, SIZE_WKID);
shapeWithData[SIZE_WKID] = (byte) geomType;
return shapeWithData;
}
use of com.esri.core.geometry.ogc.OGCGeometry in project pigeon by aseldawy.
the class GeometryFromText method exec.
@Override
public DataByteArray exec(Tuple input) throws IOException {
if (input.size() != 1)
throw new GeoException("GeometryFromText takes one bytearray argument");
ESRIGeometryParser gp = new ESRIGeometryParser();
OGCGeometry geom = gp.parseGeom(input.get(0).toString());
return new DataByteArray(geom.asBinary().array());
}
Aggregations