Filter löschen
Filter löschen

display of natural earth shapefile as polygon

13 Ansichten (letzte 30 Tage)
Hanna H
Hanna H am 9 Jul. 2020
Kommentiert: Hanna H am 10 Mär. 2021
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');
h = worldmap([-44 -10],[112 154]);
geoimg = geoshow(Lon,Lat,input_plot,'Displaytype','texturemap');
hold on
geoshow(oceanLat, oceanLon,'DisplayType','polygon','FaceColor','white');
Thanks in advance.

Akzeptierte Antwort

Rob Comer
Rob Comer am 3 Mär. 2021
Hi Hanna,
Try clipping the ocean polygon like this before calling geoshow:
[oceanLat,oceanLon] = maptriml(oceanLat,oceanLon,[-44 -10],[112 154]);
-- Rob

Weitere Antworten (0)




Community Treasure Hunt

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

Start Hunting!

Translated by