| Contents | Index |
mapshow(x,y)
mapshow(s)
mapshow(x,y,z)
mapshow(Z,R)
mapshow(x,y,image)
mapshow(x,y,A,cmap)
mapshow(image,R)
mapshow(A,cmap,R)
mapshow(ax,...)
mapshow('Parent',ax,...)
mapshow(filename)
mapshow(...,Name,Value)
h = mapshow(...)
mapshow(x,y) displays the coordinate vectors x and y. The default behavior for mapshow is to display x and y as lines.
mapshow(s) displays the vector geographic features stored in the geographic data structure s as points, multipoints, lines, or polygons according to the Geometry field of s. If s includes X and Y fields, then these fields are used directly to plot features in map coordinates. If s includes Lat and Lon fields instead, the coordinates are projected with the Plate Carrée projection and a warning is issued.
mapshow(x,y,z) displays a geolocated data grid. x and y are M-by-N coordinate arrays, and z is an M-by-N array of class double.
mapshow(Z,R) displays a regular data grid, Z.
mapshow(x,y,image) or mapshow(x,y,A,cmap) displays a geolocated image as a texturemap on a zero-elevation surface. x and y are geolocation arrays in map coordinates. x, y, and the image array must match in size. Examples of geolocated images include a color composite from a satellite swath or an image originally referenced to a different coordinate system.
mapshow(image,R) or mapshow(A,cmap,R) displays an image georeferenced to map coordinates through R. The mapshow function constructs an image object if the display geometry permits. Otherwise, mapshow displays the image as a texturemap on a zero-elevation surface.
mapshow(ax,...) and mapshow('Parent',ax,...) set the axes parent to ax.
mapshow(filename) displays data from the file specified according to the type of file format.
mapshow(...,Name,Value) specifies parameters and corresponding values that modify the type of display or set MATLAB graphics properties. Parameter names can be abbreviated, and case does not matter.
h = mapshow(...) returns a handle to a MATLAB graphics object.
If you do not want geoshow to draw on top of an existing map, create a new figure or subplot before calling it.
You can use mapshow to display vector data in an axesm figure. However, you should not subsequently change the map projection using setm.
If you display a polygon, do not set 'EdgeColor' to either 'flat' or 'interp'. This combination may result in a warning.
You can access mapshow through
the Plot Selector workspace
tool, which is represented by this icon
. In your workspace,
select the data you want to display. The Plot Selector icon changes
to look like this:
. Scroll down to mapshow(s):
Plot a mapstruct array in an ordinary axes.
If s is a geostruct (has Lat and Lon fields), it may be more appropriate to use geoshow to display them. You can project latitude and longitude coordinate values to map coordinates by displaying with geoshow on a map axes.
x |
Coordinate vector, M-by-N coordinate array, or geolocation array in map coordinates, depending on the syntax. x can contain embedded NaNs to delimit individual lines or polygon parts. |
y |
Coordinate vector, M-by-N coordinate array, or geolocation array in map coordinates, depending on the syntax. y can contain embedded NaNs to delimit individual lines or polygon parts. |
z |
M-by-N array. z can contain NaN values. |
s |
Geographic data structure. |
Z |
Regular data grid. |
R |
Referencing matrix or spatialref.MapRasterReference object that relates the subscripts of Z to map coordinates. If R is a spatialref.MapRasterReference object with raster interpretation 'postings', then mapshow does not accept the 'image' and 'texturemap' display types. |
image |
Grayscale, logical, or truecolor image. |
A |
Indexed image. |
cmap |
Colormap. |
ax |
Axes object. |
filename |
Name of file. |
Specify optional comma-separated pairs of Name,Value arguments, where Name is the argument name and Value is the corresponding value. Name must appear inside single quotes (' '). You can specify several name and value pair arguments in any order as Name1,Value1,...,NameN,ValueN.
'SymbolSpec' |
A structure returned by makesymbolspec that specifies the symbolization rules used for vector data. When both SymbolSpec and one or more graphics properties are specified, the graphics properties will override any settings in the symbolspec structure. To change the default symbolization rule for a Name,Value pair in the symbolspec, prefix the word 'Default' to the graphics property name. | ||||||||||||||||||||||||||||||||||||
'DisplayType' |
Type of graphic display for the data. You can set any MATLAB Graphics line, patch, image, surface, and contour properties. See the table for links to the MATLAB documentation on these properties.
If DisplayType is 'texturemap', geoshow constructs a surface with ZData values set to 0. Set the DisplayType to 'image' if you are using the syntax mapshow(image, R, ...). When using the filename argument, the DisplayType parameter is automatically set, according to the following table:
|
| Display Type | Supported Class Types |
|---|---|
| Image | logical, uint8, uint16, and double |
| Surface | single and double |
| Texture map | All numeric types and logical |
Overlay Boston roads on an orthophoto. Convert Boston road vectors to units of survey feet before overlaying them on the image. (Note that mapshow draws a new layer in the axes rather than replacing its contents.)
figure
mapshow boston.tif
axis image off
% The orthophoto is in survey feet and the roads are in meters.
% Convert the road units to feet before overlaying them.
S = shaperead('boston_roads.shp');
surveyFeetPerMeter = unitsratio('sf','meter');
x = surveyFeetPerMeter * [S.X];
y = surveyFeetPerMeter * [S.Y];
mapshow(x,y)

boston.tif image copyright © GeoEye, all rights reserved.
Display Boston roads and change the line style:
roads = shaperead('boston_roads.shp');
figure
mapshow(roads,'LineStyle',':');

Display the Boston roads shapes using a symbolspec:
% Create a SymbolSpec to color local roads:
% (ADMIN_TYPE=0) cyan, state roads (ADMIN_TYPE=3) red.
% Hide very minor roads (CLASS=6).
% Make all roads that are major or larger (CLASS=1-4)
% have a LineWidth of 2.
roadspec = makesymbolspec('Line',...
{'ADMIN_TYPE',0,'Color','cyan'}, ...
{'ADMIN_TYPE',3,'Color','red'},...
{'CLASS',6,'Visible','off'},...
{'CLASS',[1 4],'LineWidth',2});
figure
mapshow('boston_roads.shp','SymbolSpec',roadspec);

Override default properties in combination with a symbolspec:
roadspec = makesymbolspec('Line',...
{'Default', 'Color', 'yellow'}, ...
{'ADMIN_TYPE',0,'Color','c'}, ...
{'ADMIN_TYPE',3,'Color','r'},...
{'CLASS',6,'Visible','off'},...
{'CLASS',[1 4],'LineWidth',2});
figure
mapshow('boston_roads.shp', 'Color', 'black', ...
'SymbolSpec', roadspec);

Override default properties of the line with a symbolspec:
roadspec = makesymbolspec('Line',...
{'Default', 'Color', 'black'}, ...
{'ADMIN_TYPE',0,'Color','c'}, ...
{'ADMIN_TYPE',3,'Color','r'},...
{'CLASS',6,'Visible','off'},...
{'CLASS',[1 4],'LineWidth',2});
figure
mapshow('boston_roads.shp','SymbolSpec',roadspec);

Overlay a pond polygon and roads on an orthophoto:
% Display an orthophoto of Concord, MA, including a pond with
% three large islands:
[ortho, cmap] = imread('concord_ortho_w.tif');
R = worldfileread('concord_ortho_w.tfw', 'planar', size(ortho));
figure
mapshow(ortho, cmap, R)
% Overlay a polygon representing the same pond
% (feature 14 in the concord_hydro_area shapefile).
% Note that the islands are visible in the orthophoto
% through three "holes" in the pond polygon.
pond = shaperead('concord_hydro_area.shp', 'RecordNumbers', 14);
mapshow(pond, 'FaceColor', [0.3 0.5 1], 'EdgeColor', 'black')
% Overlay roads in the same figure.
mapshow('concord_roads.shp', 'Color', 'red', 'LineWidth', 1);

Read and view the Mount Washington SDTS DEM terrain data three different ways:
[Z, R] = sdtsdemread('9129CATD.DDF');
% View the Mount Washington terrain data as a mesh.
figure
mapshow(Z, R, 'DisplayType', 'mesh');
demcmap(Z)

% View the Mount Washington terrain data as a surface. figure mapshow(Z, R, 'DisplayType', 'surface'); demcmap(Z)

% View as a 3-D surface. view(3); axis normal

Display the grid and contour lines of Mount Washington and Mount Dartmouth:
% Read the terrain data files.
[Z_W, R_W] = arcgridread('MtWashington-ft.grd');
[Z_D, R_D] = arcgridread('MountDartmouth-ft.grd');
% Display the terrain data as a surface.
figure('Renderer', 'zbuffer')
hold on
mapshow(Z_W, R_W, 'DisplayType', 'surface');
mapshow(Z_D, R_D, 'DisplayType', 'surface');

% Overlay black contour lines with labels onto the surface.
% Set the Z values of the contours to the maximum value of the
% corresponding surface.
cW = mapshow(Z_W, R_W, 'DisplayType', 'contour', ...
'LineColor','black', 'ShowText', 'on');
cD = mapshow(Z_D, R_D, 'DisplayType', 'contour', ...
'LineColor','black', 'ShowText', 'on');
zdatam(get(cW,'Children'), max(Z_W(:)));
zdatam(get(cD,'Children'), max(Z_D(:)));
% Set the colormap appropriate to terrain elevation.
demcmap(Z_W)

geoshow | makesymbolspec | mapview | shaperead

Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.
| © 1984-2012- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |