Shape file overlay on basemap
조회 수: 2 (최근 30일)
이전 댓글 표시
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
댓글 수: 0
답변 (1개)
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
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 Exchange에서 Geographic Plots에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!