We present a two-dimensional analysis of the in-plane misfit stress and its elastic relaxation in rectangular patterned heteroepitaxial layer structures on a rigid substrate. Based on the generally acknowledged model of relaxing film stress we calculate the distribution of the misfit stress versus distance from the free surface of a mesa edge. By superposition of the isolated stress fields of the mesa edges, we obtain the biaxial misfit stress distribution in a finite heteroepitaxial thin film mesa on a thick substrate. The formalism developed permits the determination of the variation of stress values as a function of material and size characteristics of the patterned layer-substrate system. The theoretical analysis will be applied to the III-V compound semiconductor integration with Si or Ge.