How do I select a region using MAPSHOW in the Mapping Toolbox 2.0.2 (R14SP3)?

2 views (last 30 days)
I display the map of New Zealand, using theMAPSHOW function:
mapshow('new_zealand.jpg');
I want to select and display a part of the map, for example, the city of 'Wellington', from my map of New Zealand.

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 27 Jun 2009
It is possible to view a part of a map in Mapping Toolbox 2.0.2 (R14SP3), using the MAPSHOW function by specifying the limits of the part you are interested in.
Your image file, 'new_zealand.jpg' has an associated WorldFile with it. You can set the 'XLim' and 'YLim' of the axes for the part of the image you are interested in. For example, if you want to view the city' Wellington' in your figure window then execute the following code:
mapshow('new_zealand.jpg');
xLim = [xMinOfWellington, xMaxOfWellington];
yLim = [yMinOfWellington, yMaxOfWellington];
set(gca,'XLim', xLim, 'YLim', yLim);
In the above code, "xMinOfWellington" is the lower limit on the X-axis value for the city of Wellington, and "xMaxOfWellington" is the upper limit on the X-axis value. Similarly for the lower and upper limits of the Y-axis.

More Answers (0)

Products


Release

R14SP1

Community Treasure Hunt

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

Start Hunting!