display of natural earth shapefile as polygon
8 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Hanna H
el 9 de Jul. de 2020
Comentada: Hanna H
el 10 de Mzo. de 2021
Hi,
I am making a map in Matlab 2020a and only want to display data on land, mask out the data points over the ocean and display all oceans in white. I am using a shapefile from natural earth (ne_10m_ocean.shp). I have used the same code in the past to make maps and it always worked out. Now I have upgraded from 2017b to 2020a and suddenly my code is not working anymore and I am wondering why and how to fix it. Below is relevant piece of code. input_plot are my input data and the shapefile is supposed to be plotted on top.
O = shaperead(ocean_file,'UseGeoCoords',true);
oceanLat = extractfield(O,'Lat');
oceanLon = extractfield(O,'Lon');
figure
h = worldmap([-44 -10],[112 154]);
setm(h,'MapProjection','mercator');
getm(h,'MapProjection');
setm(h,'MlabelParallel','south');
geoimg = geoshow(Lon,Lat,input_plot,'Displaytype','texturemap');
hold on
geoshow(oceanLat, oceanLon,'DisplayType','polygon','FaceColor','white');
Thanks in advance.
0 comentarios
Respuesta aceptada
Rob Comer
el 3 de Mzo. de 2021
Hi Hanna,
Try clipping the ocean polygon like this before calling geoshow:
[oceanLat,oceanLon] = maptriml(oceanLat,oceanLon,[-44 -10],[112 154]);
-- Rob
Más respuestas (0)
Ver también
Categorías
Más información sobre Map Display 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!