private static BytesWritable serialize(OGCGeometry ogcGeometry) {
    int wkid;
    try {
      wkid = ogcGeometry.SRID();
    } catch (NullPointerException npe) {
      wkid = 0;
    }

    OGCType ogcType;
    String typeName;
    try {
      typeName = ogcGeometry.geometryType();

      if (typeName.equals("Point"))
        ogcType = OGCType.ST_POINT;
      else if (typeName.equals("LineString"))
        ogcType = OGCType.ST_LINESTRING;
      else if (typeName.equals("Polygon"))
        ogcType = OGCType.ST_POLYGON;
      else if (typeName.equals("MultiPoint"))
        ogcType = OGCType.ST_MULTIPOINT;
      else if (typeName.equals("MultiLineString"))
        ogcType = OGCType.ST_MULTILINESTRING;
      else if (typeName.equals("MultiPolygon"))
        ogcType = OGCType.ST_MULTIPOLYGON;
      else
        ogcType = OGCType.UNKNOWN;
    } catch (NullPointerException npe) {
      ogcType = OGCType.UNKNOWN;
    }

    return serialize(ogcGeometry.getEsriGeometry(), wkid, ogcType);
  }
Sets the WKID (in place) for the given hive geometry bytes

@param geomref reference to hive geometry bytes
@param wkid
ql/src/java/org/apache/hadoop/hive/ql/udf/esri/GeometryUtils.java