How to plot a shapefile on top of digital elevation model using mapshow (or other)
13 ビュー (過去 30 日間)
古いコメントを表示
Hi,
I have read in a digital elevation model(dem) using;
[dem, Rdem] = arcgridread('pathtodem');
I have read in a polyline type shapefile:
streams = shaperead('pathtoshapefile');
Now I want to plot the shapefile on top of the dem.
mapshow(dem,Rdem,'DisplayType','surface'); hold on;
mapshow(streams)
All I get is the dem. The streams layer does not display.
The stream layer on it's own displays fine
mapshow(streams)
Any help elucidating how to plot shapefiles on top of raster data would be greatly appreciated. I know that it has something to do with plotting a 2d shapefile on top of a 3d matrix but so far I can't figure this out on my own. Thank you very much!
0 件のコメント
採用された回答
Rob Comer
2014 年 9 月 16 日
If you only wish to view your map in 2-D, you can plot the terrain raster in the z == 0 plane, like this:
mapshow(zeros(size(dem)),Rdem,'CData',dem,'DisplayType','surface')
(Type help mapshow and see Example 8 for something similar.) Alternatively, you could increase the ZData of your lines, which is zero by default.
2 件のコメント
Anna Paulson
2019 年 7 月 9 日
Hi Rob,
I'm about to open a support ticket, but thought I'd try this first. What if I want to look at the shapes with their elevation information intact or on a 3D plot? Here's some of the code I'm trying to use...
[Z, R] = arcgridread('/Users/user/Downloads/USGS_NED_13_n41w106_GridFloat/usgs_ned_13_n41w106_gridfloat.flt')
Z = demcmap(Z) %recolors the map to fit DEM coloring standards
%trim it down
[Z_trimmed, R_trimmed] = maptrims(Z,R,[40.07 40.08],[-105.16 -105.15])
demcmap(Z_trimmed)
...
figure
geoshow(Z_trimmed, R_trimmed, 'DisplayType', 'surface')
hold on
geoshow(Xmarker, 'DisplayType', 'Point','Marker','x','MarkerEdgeColor','magenta', 'MarkerSize', 10)
Ideally, I'd like to plot some markers (like the Xmarker), covariance/error ellipses, and KML tracks on a USGS-sourced map or terrain file. I thought the ARCGrid file type would be best for looking at markers in elevation, but that file type isn't a strict requirement, i.e. if you have another type in mind or if I need to convert to a geotiff, let me know.
Like the user above mentioned, if I try to use the code as posted above, I can see the terrain markers under the map/surface. I'd like to see them as they sit on the terrain.
Thanks!
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Map Display についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!