I have a dataset of ~15,000 points that are locations along ROV survey tracks where measurements were taken. These points can be less than 5 meters apart and the survey tracks often cross or can be close to each other (<90 meters apart). We would like to run some analyses on these points, but we would like to select points that are at least 150 meters apart to minimize spatial auto-correlation. Is there a good methodology to find the maximum number of points that would fit this requirement?
Answer
Thanks for the suggestions on this. My colleagues have decided to use a MatLab script remove the spatially autocorrelated points.
%script to "thin" a point set so that no points are within threshold distance of other points
%note: final thinned point set is dependent on choice of the first point and on ordering of points in the processing list;
% i.e. it is not unique
clear, clc
spts = xlsread('PresenceOnly_Random30perc_ForAccuracyAssessment.xls'); % Read in file
spts(:,33) = 0; %Placeholder for column 33 (which will be where deleted points tagged)
k = length(spts); %set total rows of data
mindis = 169; %Set minimum distance between points
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
for refp = 1:k %Sets first data point in matrix as reference, iterates through all points
disp(refp);
for compt = 1:k %Starts loop to calculate distance from refp to other points
if (spts(compt,33) ~= 1) & (spts(refp,33) ~= 1) & (refp~=compt) %only looks at points that have not been flagged
distsq = sqrt(((spts(compt,9)-spts(refp,9))^2 +(spts(compt,10)-spts(refp,10))^2)); %Calculates distance between two points.
distref(compt,:)=distsq; %Save distance values in matrix distref
if distsq < mindis %If distance is less than min distance
spts(compt,33)= 1; %tag col 33 with value of 1 to delete later.
end
end
end
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
deletedrows = find(spts(:,33) == 1); %Find rows with the tag (1), output matrix of indicies
remainingpts = spts; %Created matrix that will have exra points deleted
remainingpts(deletedrows,:) = []; %Clear entire row based on previous matrix
save all_data_tagged.dat spts /ASCII -tabs %Saves all data, points to be removed = 1 in col33
save remaining_pts.dat remainingpts /ASCII -tabs
plot(spts(:,9),spts(:,10),'b.',remainingpts(:,9),remainingpts(:,10),'r.');
xlabel('Latitude, meters'), ylabel('Longitude, meters'), grid minor
No comments:
Post a Comment