Plotting shapefile data on top of surface data using Geoshow - how to create Zdata file?
Show older comments
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
Julie Kalansky
on 18 Apr 2017
Edited: darova
on 28 Apr 2020
Ronnie
on 27 Apr 2020
Thank you!
Answers (0)
Categories
Find more on Geographic Plots in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!