Shape file overlay on basemap

3 ビュー (過去 30 日間)
Abigail Hobbs
Abigail Hobbs 2025 年 3 月 6 日
コメント済み: Voss 2025 年 3 月 9 日
I am working on overlaying a shape file exported from a NOAA HYSPLIT model onto a base map. I can get the map to appear but I am strugging to get the traces from the shape file to appear on the map. Below is some of my code - I have tried different things, including a loop, but nothing has worked so far. I am not the best coder either, so this may be a simple fix. I attached the model output data here as well.
Thank you for your help!
figure
gx=geoaxes;
gx.MapCenterMode = "manual";
gx.MapCenter= [31.962299,-81.014213];
gx.Basemap = "streets-light";
gx.ZoomLevelMode= "manual";
gx.ZoomLevel=7;
hold on
geoplot(gx,ls.X,ls.Y)
hold off
% tried the loop below too but did not work
hold on
for p= 1:5
% geoplot(gx,traj1{1,p}.geopointshape.Latitude,traj1{1,p}.geopointshape.Longitude)
geoplot(gx,ls(p).X,ls(p).Y)
end
hold off

回答 (1 件)

Voss
Voss 2025 年 3 月 6 日
unzip('gis_110139.zip')
figure
gx=geoaxes;
gx.MapCenterMode = "manual";
gx.MapCenter= [31.962299,-81.014213];
gx.Basemap = "streets-light";
gx.ZoomLevelMode= "manual";
gx.ZoomLevel=7;
hold on
S = shaperead('GIS_traj01_110139.shp');
geoplot(gx,[S.Y],[S.X])
  2 件のコメント
Abigail Hobbs
Abigail Hobbs 2025 年 3 月 7 日
This is awesome, thank you! It seemsl like it is connecting the lines in a weird way. I need them to just be single lines and not looping back around into themselves - is there a way to address that? Similar to how the output looks in the NOAA HYSPLIT output (I have attached a picture here). Thank you!
Voss
Voss 2025 年 3 月 9 日
You're welcome!
The problem is that the traces need to be separated from each other and plotted separately. In the code below, I address that by assuming that the 'id' field of the shape file data can be used to identify the separate traces (e.g., points with id 1000-1999 belong to trace 1, points 2000-2999 belong to trace 2, etc.).
unzip('gis_110139.zip')
figure
gx=geoaxes;
gx.MapCenterMode = "manual";
gx.MapCenter= [31.962299,-81.014213];
gx.Basemap = "streets-light";
gx.ZoomLevelMode= "manual";
gx.ZoomLevel=4; % changed to show more complete traces
hold on
S = shaperead('GIS_traj01_110139.shp');
[G,GID] = findgroups(floor([S.id]/1000));
for ii = 1:numel(GID)
idx = G == ii;
geoplot(gx,[S(idx).Y],[S(idx).X])
end

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

カテゴリ

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