Plotting shapefile data on top of surface data using Geoshow - how to create Zdata file?

I am trying to plot county boundaries on top of gridded precipitation data using geoshow with a surface plot. I can plot them independently, but the precipitation data plots on top of the county boundaries hiding the county lines. I can also make the desired plot with a textured map, but I would like to use a surface plot. I think this has to do with the Zdata, but I am not sure how to remedy this. I tried creating Zdata with values of 100 for the county boundaries to try to get them to plot on top of the precipitation data, but I get an error that the Array is the wrong shape and I am not sure how determine the correct shape array. This idea came from the below question. https://www.mathworks.com/matlabcentral/answers/20783-plotting-contours-from-a-shapefile-on-top-of-raster-data-which-were-plotted-using-surf
Is there a way to plot the county boundaries on top of a surface map of the gridded precipitation data using geoshow? If not, please advise on the best solution.
Thank you very much for your time.
Below is example code that I have been playing with.
x=data
R = georasterref('Latlim', [34.968 39.0313], 'Lonlim', [-121.0313 -113.9688], 'RasterSize', [66 114]);
geoshow(x,R, 'DisplayType','surface'); hold on
county = shaperead('tl_2012_us_county.shp',... 'UseGeoCoords', true, 'BoundingBox', [lonlim', latlim']);
%length(county.Lat) is 5793
%length(county.Lon) is 1700
Z(1:5792,1:1700)=100; %I also tried Z'
geoshow([county.Lat],[county.Lon],Z)%,'Color','black')

2 Comments

I came back to it after 6 months and found a solution. I changed the Zdata through this method. Hope this helps someone else one day.
p1=geoshow(x,R, 'DisplayType','surface'); hold on
p2=geoshow([county.Lat],[county.Lon],'Color','black') p2.ZData(1:length(p2.YData)=30; %%set above max value of Zdata in p1

Sign in to comment.

Answers (0)

Categories

Products

Asked:

on 26 Oct 2016

Edited:

on 28 Apr 2020

Community Treasure Hunt

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

Start Hunting!