Question regarding plotting a map consisting of different layers

5 views (last 30 days)
Hello,
Using Matlab Mapping Toolbox, I want to plot a map (Baltic Sea Region, to be specific) which has three different layers in shapefile format, i.e. coastline, bathymetry, and land. However it doesn't work so far.
Here is the code:
% Load shapefile data
balticSea.coast = shaperead('ne_10m_coastline.shp');
balticSea.land = shaperead('ne_10m_land.shp');
balticSea.bathym = shaperead('ne_10m_bathymetry.shp')
% Create a figure
figure
mapshow(balticSea.coast)
mapshow(balticSea.land)
mapshow(balticSea.bathym)
Is there any ways to solve this?
Thank you.

Answers (1)

Debadipto
Debadipto on 8 Jun 2023
Hi Dipto,
Based on my understanding, you want to plot the three shapefiles on top of each other in a single map. You can utilise the ‘hold on’ syntax to get the desired output. Here is the updated code:
% Load shapefile data
balticSea.coast = shaperead('ne_10m_coastline.shp');
balticSea.land = shaperead('ne_10m_land.shp');
balticSea.bathym = shaperead('ne_10m_bathymetry.shp')
% Create a figure
figure
mapshow(balticSea.coast)
hold on
mapshow(balticSea.land)
mapshow(balticSea.bathym)
Regards,
Debadipto Biswas

Tags

Community Treasure Hunt

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

Start Hunting!