Skip to Main Content Skip to Search
Product Documentation

geoshow - Display map latitude and longitude data

Syntax

geoshow(lat,lon)
geoshow(s)
geoshow(lat,lon,Z)
geoshow(Z,R)
geoshow(lat,lon,image)
geoshow(lat,lon,A,cmap)
geoshow(image,R)
geoshow(A,cmap,R)
geoshow(ax,...)
geoshow('Parent',ax,...)
geoshow(filename)
geoshow(...,Name,Value)
h = geoshow(...)

Description

geoshow(lat,lon) projects and displays the latitude and longitude vectors lat and lon using the projection stored in the axes. If there is no projection, lat and lon are projected using a default Plate Carrée projection. The default behavior for geoshow is to display lat and lon as lines.

geoshow(s) displays the vector geographic features stored in s as points, multipoints, lines, or polygons according to the Geometry field of s. If s includes lat and lon fields, then the coordinate values are projected to map coordinates. If s includes X and Y fields, then the coordinate values are plotted as preprojected map coordinates, and a warning is issued.

geoshow(lat,lon,Z) projects and displays a geolocated data grid.

geoshow(Z,R) projects and displays a regular data grid, Z.

geoshow(lat,lon,image) or geoshow(lat,lon,A,cmap) projects and displays a geolocated image as a texturemap on a zero-elevation surface. lat, lon, 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.

geoshow(image,R) or geoshow(A,cmap,R) projects and displays an image georeferenced to latitude-longitude through the referencing matrix R. The image is shown as a texturemap on a zero-elevation surface.

geoshow(ax,...) and geoshow('Parent',ax,...) set the parent axes to ax.

geoshow(filename) projects and displays data from the file specified according to the type of file format.

geoshow(...,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 = geoshow(...) returns a handle to a MATLAB graphics object.

Tips

Input Arguments

lat,lon

Latitude and longitude vectors. lat and lon must be of equal length. The vectors may contain embedded NaNs to delimit individual lines or polygon parts.

Z

M-by-N array. May contain NaN values.

s

Geographic data structure.

image

Grayscale, logical, or truecolor image.

A

Indexed image.

cmap

Colormap.

R

spatialref.GeoRasterReference object, referencing vector, or referencing matrix. If R is a spatialref.GeoRasterReference object, its RasterSize property must be consistent with size(Z).

If R is a referencing vector, it must be a 1-by-3 with elements:

[cells/degree northern_latitude_limit western_longitude_limit]

If R is a referencing matrix, it must be 3-by-2 and transform raster row and column indices to or from geographic coordinates according to:

[lon lat] = [row col 1] * R

If R is a referencing matrix, it must define a (non-rotational, non-skewed) relationship in which each column of the data grid falls along a meridian and each row falls along a parallel. Nearest-neighbor interpolation is used by default. NaN is returned for points outside the grid limits or for which lat or lon contain NaN. All angles are in units of degrees.

If R is a spatialref.GeoRasterReference object with raster interpretation 'postings', then the 'image' and 'texturemap' display types are not accepted.

ax

Axes object.

filename

Name of file.

Name-Value Pair Arguments

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 to be used for displaying vector data. It is used only for vector data stored in geographic data structures. In cases where both SymbolSpec and one or more graphics properties are specified, the graphics properties 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, and surface properties. You can also set any Mapping Toolbox contour properties. See the table for links to the documentation on these properties.

Data TypeDisplayTypeType of Property

Vector

'point'

line marker

On the MATLAB Line Properties reference page, under Line Property Descriptions, see Marker.

'multipoint'

line marker

On the MATLAB Line Properties reference page, under Line Property Descriptions, see Marker.

'line' (default)

line

See the MATLAB Line Properties reference page.

'polygon'

patch

See the MATLAB Patch Properties reference page.

Image

'image'

surface

See the MATLAB Surface Properties reference page.

Grid

'surface'

surface

See the MATLAB Surface Properties reference page.

'mesh'

surface

See the MATLAB Surface Properties reference page.

'texturemap'

surface

See the MATLAB Surface Properties reference page.

'contour'

contour

See the Mapping Toolbox contourm reference page.

If DisplayType is 'texturemap', geoshow constructs a surface with ZData values set to 0.

When using the filename argument, the DisplayType parameter is automatically set, according to the following table:

Format

DisplayType

Shape file

'point', 'line', or 'polygon'

GeoTIFF

'image'

TIFF/JPEG/PNG with a world file

'image'

ARC ASCII GRID

'surface' (can be overridden)

SDTS raster

'surface' (can be overridden)

Output Arguments

h

Handle to a MATLAB graphics object or, in the case of polygons, a modified patch object. If a geostruct or shapefile name is input, geoshow returns the handle to an hggroup object with one child per feature in the geostruct or shapefile, excluding any features that are completely trimmed away. In the case of a polygon geostruct or shapefile, each child is a modified patch object; otherwise it is a line object.

Class Support

Display TypeSupported Class Types
Imagelogical, uint8, uint16, and double
Surfacesingle and double
Texture mapAll numeric types and logical

Examples

Display world land areas using a default Plate Carree projection:

figure
geoshow('landareas.shp', 'FaceColor', [0.5 1.0 0.5]);

 

Override the symbolspec default rule:

% Create a worldmap of North America.
figure
worldmap('na');

% Read the USA high resolution data.
states = shaperead('usastatehi', 'UseGeoCoords', true);

% Create a symbolspec to make Alaska and Hawaii polygons red.
symspec = makesymbolspec('Polygon', ...
   {'Name', 'Alaska', 'FaceColor', 'red'}, ...
   {'Name', 'Hawaii', 'FaceColor', 'red'});

% Display all the other states in blue.
geoshow(states, 'SymbolSpec', symspec, ...
   'DefaultFaceColor', 'blue', ...
   'DefaultEdgeColor', 'black');

 

Create a worldmap of Korea and display the korea data grid as a texture map:

load korea
figure;
worldmap(map, refvec)

% Display the Korean data grid as a texture map. 
geoshow(gca,map,refvec,'DisplayType','texturemap');
demcmap(map)

% Display the land area boundary as black lines.
S = shaperead('landareas','UseGeoCoords',true);
geoshow([S.Lat], [S.Lon],'Color','black');

 

Display the EGM96 geoid heights, masking out land areas:

load geoid
% Create a figure with an Eckert projection.
figure
axesm eckert4; 
framem; gridm;
axis off

% Display the geoid as a texture map. 
geoshow(geoid, geoidrefvec, 'DisplayType', 'texturemap');

% Create a colorbar and title.
hcb = colorbar('southoutside');
set(get(hcb,'Xlabel'),'String','EGM96 Geoid Heights in Meters.')

% Mask out all the land.
geoshow('landareas.shp', 'FaceColor', 'black');

 

Display the EGM96 geoid heights as a 3-D surface using the Eckert IV projection:

load geoid

% Create the figure with an Eckert projection.
figure
axesm eckert4; 
axis off

% Display the geoid as a surface. 
h = geoshow(geoid, geoidrefvec, 'DisplayType','surface');

% Add light and material.
light; material(0.6*[ 1 1 1]);

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

 

Display the moon albedo image projected using Plate Carree and in an orthographic projection:

load moonalb

% Projection not specified. Uses Plate Carree.
figure
geoshow(moonalb,moonalbrefvec) 

% Orthographic projection
figure
axesm ortho 
geoshow(moonalb, moonalbrefvec, 'DisplayType', 'texturemap')
colormap(gray(256))
axis off

 

Read and display the San Francisco South 24K DEM data:

filenames = gunzip('sanfranciscos.dem.gz', tempdir); 
demFilename = filenames{1}; 

% Read every point of the 1:24,000 DEM file. 
[lat, lon,Z] = usgs24kdem(demFilename,2); 

% Delete the temporary gunzipped file. 
delete(demFilename); 

% Move all points at sea level to -1 to color them blue. 
Z(Z==0) = -1;

% Compute the latitude and longitude limits for the DEM. 
latlim = [min(lat(:)) max(lat(:))];
lonlim = [min(lon(:)) max(lon(:))];

% Display the DEM values as a texture map. 
figure
usamap(latlim, lonlim)
geoshow(lat, lon, Z, 'DisplayType','texturemap')
demcmap(Z)
daspectm('m',1)

% Overlay black contour lines onto the texturemap.
geoshow(lat, lon, Z, 'DisplayType', 'contour', ...
  'LineColor', 'black');

% View the DEM values in 3-D.
figure
usamap(latlim, lonlim)
geoshow(lat, lon, Z, 'DisplayType', 'surface')
demcmap(Z)
daspectm('m',1)
view(3)

See Also

axesm | makesymbolspec | mapshow | mapview | updategeostruct

How To

  


Recommended Products

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