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

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 * (n +1 ) * (Y(i) - MapExtent.Ymin)/(MapExtent.Ymax-MapExtent.Ymin) + n + .5;
end