Shape file overlay on basemap
3 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
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 comentarios
Respuestas (1)
Voss
el 6 de Mzo. de 2025
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 comentarios
Voss
el 9 de Mzo. de 2025
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
Ver también
Categorías
Más información sobre Geographic Plots en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!