code: public static String toKml(Geometry geometry) throws SQLException {
          StringBuilder sb = new StringBuilder();
          KMLGeometry.toKMLGeometry(geometry, sb);
          return sb.toString();
      }
docs: Generate a KML geometry
  
  @param geometry
  @return
  @throws SQLException