Java Code Examples for com.esri.core.geometry.ogc.OGCGeometry#createFromEsriGeometry()

The following examples show how to use com.esri.core.geometry.ogc.OGCGeometry#createFromEsriGeometry() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ST_GeomCollection.java    From spatial-framework-for-hadoop with Apache License 2.0 6 votes vote down vote up
public BytesWritable evaluate(Text wkwrap, int wkid) throws UDFArgumentException {

		String wkt = wkwrap.toString();

		try {
			Geometry geomObj = GeometryEngine.geometryFromWkt(wkt,
															  0,
															  Geometry.Type.Unknown);
			SpatialReference spatialReference = null;  // Idea: OGCGeometry.setSpatialReference after .fromText
			if (wkid != GeometryUtils.WKID_UNKNOWN) {
				spatialReference = SpatialReference.create(wkid);
			}
			OGCGeometry ogcObj = OGCGeometry.createFromEsriGeometry(geomObj, spatialReference);
			return GeometryUtils.geometryToEsriShapeBytesWritable(ogcObj);
		} catch (Exception e) {  // IllegalArgumentException, GeometryException
			LogUtils.Log_InvalidText(LOG, wkt);
			return null;
		}
	}
 
Example 2
Source File: ST_Aggr_ConvexHull.java    From spatial-framework-for-hadoop with Apache License 2.0 5 votes vote down vote up
public BytesWritable terminatePartial() throws HiveException {
	maybeAggregateBuffer(true);
	if (geometries.size() == 1) {
		OGCGeometry rslt = OGCGeometry.createFromEsriGeometry(geometries.get(0), spatialRef);
		return GeometryUtils.geometryToEsriShapeBytesWritable(rslt);
	} else {
		return null;
	}
}
 
Example 3
Source File: ST_Aggr_Union.java    From spatial-framework-for-hadoop with Apache License 2.0 5 votes vote down vote up
public BytesWritable terminatePartial() throws HiveException {
	try {
		Geometry rslt = xgc.next();
		lgc = null;  // not reusable
		xgc = null;  // not reusable
		OGCGeometry ogeom = OGCGeometry.createFromEsriGeometry(rslt, spatialRef);
		return GeometryUtils.geometryToEsriShapeBytesWritable(ogeom);
	} catch (Exception e) {
		LogUtils.Log_InternalError(LOG, "ST_Aggr_Union: " + e);
	}
	return null;
}
 
Example 4
Source File: EsriJsonSerDe.java    From spatial-framework-for-hadoop with Apache License 2.0 4 votes vote down vote up
@Override
protected OGCGeometry parseGeom(JsonParser parser) {
	MapGeometry mapGeom = GeometryEngine.jsonToGeometry(parser);
	return OGCGeometry.createFromEsriGeometry(mapGeom.getGeometry(), mapGeom.getSpatialReference());
}