private static BytesWritable serialize(MapGeometry mapGeometry) {
    int wkid = 0;

    SpatialReference spatialRef = mapGeometry.getSpatialReference();

    if (spatialRef != null) {
      wkid = spatialRef.getID();
    }

    Geometry.Type esriType = mapGeometry.getGeometry().getType();
    OGCType ogcType;

    switch (esriType) {
    case Point:
      ogcType = OGCType.ST_POINT;
      break;
    case Polyline:
      ogcType = OGCType.ST_LINESTRING;
      break;
    case Polygon:
      ogcType = OGCType.ST_POLYGON;
      break;
    default:
      ogcType = OGCType.UNKNOWN;
    }

    return serialize(mapGeometry.getGeometry(), 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