フィルターのクリア

Find a shipping vessel's ports based on location data

4 ビュー (過去 30 日間)
Siddharth Gopujkar
Siddharth Gopujkar 2023 年 4 月 3 日
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.
Siddharth Gopujkar
Siddharth Gopujkar 2023 年 4 月 5 日
Thank you!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeGeographic Plots についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by