function [k,l] = setImageCoordinates(X,Y,m,n)

global MapExtent

nr=size(X);

m=MapExtent.NrOfColumns;
n=MapExtent.NrOfRows;

for i=1:nr
    k(i) = (m +1 ) * (X(i) - MapExtent.Xmin)/(MapExtent.XMax-MapExtent.Xmin) - .5
    l(i) = -1 * (m +1 ) * (Y(i) - MapExtent.Ymin)/(MapExtent.YMax-MapExtent.Ymin) + n + .5
end