function [data] = select_region(displayAxis)
% Select a region from the map image
% Input: axis of displayed data
% Output: data structure indicated latitude/longitude limit

displayAxis;

% Do the rrbox command
set(gcf,'Pointer','Crosshair');
waitforbuttonpress;
Pt1 = get(displayAxis,'currentpoint');
rbbox([get(gcf,'currentpoint') 0 0],get(gcf,'currentpoint'));
Pt2 = get(displayAxis,'currentpoint');
set(gcf,'Pointer','arrow');

% Get selected rectangle on the project map
rect = [min([Pt1(1,1:2);Pt2(1,1:2)]) abs(Pt2(1,1:2)-Pt1(1,1:2))];
data.rect = rect;
data.x_limit = [rect(1) rect(1) + rect(3)];
data.y_limit = [rect(2) rect(2) + rect(4)];

% Get selected rectangle of latitude/longitude
[lat1, lon1] = minvtran(Pt1(1, 1), Pt1(1, 2));
[lat2, lon2] = minvtran(Pt2(1, 1), Pt2(1, 2));
if lat1 > lat2
  tmp = lat1;
  lat1 = lat2;
  lat2 = tmp;
end
if lon1 > lon2
  tmp = lon1;
  lon1 = lon2;
  lon2 = tmp;
end
data.boundary.lat = [lat1 lat1 lat2 lat2 lat1];
data.boundary.lon = [lon1 lon2 lon2 lon1 lon1];
data.lat_limit = [lat1 lat2];
data.lon_limit = [lon1 lon2];
data.latLonLimit = [lat1 lat2 lon1 lon2];
