필터 지우기
필터 지우기

Find a shipping vessel's ports based on location data

조회 수: 4 (최근 30일)
Siddharth Gopujkar
Siddharth Gopujkar 2023년 4월 3일
댓글: Siddharth Gopujkar 2023년 4월 5일
I have the location data (lattitudes and longitudes) for a shipping vessel for a month. Using the data, I am able to plot the route of the vessel in MATLAB, and even calculate the distace the vessel has travelled in that time. The code for that has been attached below. LAT_final and LON_final are the lattitude and longitude vectors.
What I also want to do using the same data is identify the ports for the vessel. The thought process for that is a place where the lattitude and longitude co-ordinates do not change (or show a very small change) for an extended period can be identified as a port. Once identified, I want to designate a small circle (let's say 250 meters) around it as Port A, then move on to the next part and identify the next as Port B. Would that be possible? What should I look to do?
Thank you!
%plotting the vessel's route based on location data
geo = geoplayer(40.38,-79.847,'basemap','satellite','zoomLevel',5);
plotRoute(geo,LAT_final,LON_final,'LineWidth',2)
%setting units to meters using the World Geodetic System of 1984
wgs84 = wgs84Ellipsoid("m");
%finding the distance in meters
lat=length(LAT_final);
for mm=1:1:lat-1
d(mm)=distance(LAT_final(mm),LON_final(mm),LAT_final(mm+1),LON_final(mm+1), wgs84);
end
  댓글 수: 2
Star Strider
Star Strider 2023년 4월 3일
The code for that has been attached below.
So now all that’s missing are the data.
Siddharth Gopujkar
Siddharth Gopujkar 2023년 4월 4일
Oops.They're uploaded now. The data takes a long time to extract from the publicly available files, so I've only uploaded 9 days worth of data here.

댓글을 달려면 로그인하십시오.

채택된 답변

Chunru
Chunru 2023년 4월 4일
편집: Chunru 2023년 4월 5일
One way is to look at the change of position (using gradient) and set a threshold.
websave("lat.mat", "https://www.mathworks.com/matlabcentral/answers/uploaded_files/1344449/LAT_final.mat")
ans = '/users/mss.system.5CcaYj/lat.mat'
websave("lon.mat", "https://www.mathworks.com/matlabcentral/answers/uploaded_files/1344454/LON_final.mat");
load("lat.mat"); load("lon.mat");
% gradient
glat = gradient(LAT_final);
glon = gradient(LON_final);
idx = (glat.^2 + glon.^2) < 0.000001 ; % adjust this threshold
plot(LON_final, LAT_final)
hold on;
plot(LON_final(idx), LAT_final(idx), 'ro')
lon_p = LON_final(idx); lat_p = LAT_final(idx); % position of potential port
[idx, c] = kmeans([lon_p lat_p], 3);
plot(c(:, 1), c(:, 2), 'g^', 'MarkerFaceColor', 'g')
% The port position: lon lat
c
c = 3×2
-84.3503 46.5029 -92.1050 46.7379 -87.4378 41.6744
  댓글 수: 3
Chunru
Chunru 2023년 4월 5일
See the update above where we use kmeans for getting the centre of the clusters.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Geographic Plots에 대해 자세히 알아보기

제품

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by