In this work, a morphological representation of a template matching algorithm for gray-scale images is presented. The algorithm is the composition of the so-called template matching operator with the maximum gray-level location operator, which can be both expressed in terms of the following classes of mathematical morphology elementary operators: dilations, erosions and anti-dilations. Moreover, the algorithm is applied to remote sensing images.