Mapping Toolbox Guide
Mapping Toolbox Guide
Mapping Toolbox Guide
Users Guide
Web
Newsgroup
www.mathworks.com/contact_TS.html Technical Support
www.mathworks.com
comp.soft-sys.matlab
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
508-647-7000 (Phone)
508-647-7001 (Fax)
The MathWorks, Inc.
3 Apple Hill Drive
Natick, MA 01760-2098
For contact information about worldwide offices, see the MathWorks Web site.
Mapping Toolbox Users Guide
COPYRIGHT 19972009 by The MathWorks, Inc.
The software described in this document is furnished under a license agreement. The software may be used
or copied only under the terms of the license agreement. No part of this manual may be photocopied or
reproduced in any form without prior written consent from The MathWorks, Inc.
FEDERAL ACQUISITION: This provision applies to all acquisitions of the Program and Documentation
by, for, or through the federal government of the United States. By accepting delivery of the Program
or Documentation, the government hereby agrees that this software or documentation qualifies as
commercial computer software or commercial computer software documentation as such terms are used
or defined in FAR 12.212, DFARS Part 227.72, and DFARS 252.227-7014. Accordingly, the terms and
conditions of this Agreement and only those rights specified in this Agreement, shall pertain to and govern
the use, modification, reproduction, release, performance, display, and disclosure of the Program and
Documentation by the federal government (or other entity acquiring for or through the federal government)
and shall supersede any conflicting contractual terms or conditions. If this License fails to meet the
governments needs or is inconsistent in any respect with federal procurement law, the government agrees
to return the Program and Documentation, unused, to The MathWorks, Inc.
Trademarks
MATLAB and Simulink are registered trademarks of The MathWorks, Inc. See
www.mathworks.com/trademarks for a list of additional trademarks. Other product or brand
names may be trademarks or registered trademarks of their respective holders.
Patents
The MathWorks products are protected by one or more U.S. patents. Please see
www.mathworks.com/patents for more information.
Revision History
May 1997
October 1998
November 2000
July 2002
September 2003
January 2004
April 2004
June 2004
October 2004
March 2005
August 2005
September 2005
March 2006
September 2006
March 2007
September 2007
March 2008
October 2008
March 2009
September 2009
First printing
Second printing
Third printing
Online only
Online only
Online only
Online only
Fourth printing
Online only
Fifth printing
Sixth printing
Online only
Online only
Seventh printing
Online only
Eighth printing
Online only
Online only
Online only
Online only
Contents
Getting Started
1
Product Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
1-2
1-3
1-4
1-4
1-9
1-26
1-26
1-26
1-28
1-28
1-29
2
Maps and Map Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
What Is a Map? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
What Is Geospatial Data? . . . . . . . . . . . . . . . . . . . . . . . . . . .
2-2
2-2
2-2
2-4
2-4
2-7
2-10
2-13
2-13
2-15
2-16
2-27
2-33
2-33
2-35
2-44
2-52
2-52
2-57
2-67
3
Understanding Spherical Coordinates . . . . . . . . . . . . . . .
Spheres, Spheroids, and Geoids . . . . . . . . . . . . . . . . . . . . . .
Geoid and Ellipsoid . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
The Ellipsoid Vector . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
3-2
3-2
3-2
3-4
.............
3-11
3-14
3-29
3-29
3-30
3-30
vi
Contents
3-14
3-15
3-18
3-23
3-27
3-32
3-32
3-32
3-33
3-38
3-38
3-38
3-46
3-41
3-44
4
Introduction to Mapping Graphics . . . . . . . . . . . . . . . . . .
4-2
4-4
4-4
4-5
4-7
4-12
4-12
4-13
4-14
4-19
4-34
4-37
4-46
4-46
4-53
4-58
vii
4-58
4-58
4-61
4-68
4-68
4-69
4-72
4-76
4-76
4-78
4-81
viii
Contents
5-2
5-2
5-3
5-3
5-13
5-13
5-19
5-19
5-22
5-22
5-40
5-25
5-29
5-33
5-36
5-40
5-43
5-49
5-49
5-50
5-52
5-55
5-57
6
Inset Maps . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
6-2
Graphic Scales . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
6-8
.....................................
6-14
Thematic Maps . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
What Is a Thematic Map? . . . . . . . . . . . . . . . . . . . . . . . . . . .
Choropleth Maps . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Special Thematic Mapping Functions . . . . . . . . . . . . . . . . .
6-17
6-17
6-18
6-23
6-28
6-28
6-28
6-30
6-34
6-34
6-37
6-39
6-43
6-44
North Arrows
ix
6-45
7
Manipulating Vector Geodata . . . . . . . . . . . . . . . . . . . . . . .
Repackaging Vector Objects . . . . . . . . . . . . . . . . . . . . . . . . .
Matching Line Segments . . . . . . . . . . . . . . . . . . . . . . . . . . .
Geographic Interpolation of Vectors . . . . . . . . . . . . . . . . . .
Vector Intersections . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Polygon Area . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Overlaying Polygons with Set Logic . . . . . . . . . . . . . . . . . . .
Cutting Polygons at the Date Line . . . . . . . . . . . . . . . . . . . .
Building Buffer Zones . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Trimming Vector Data to a Rectangular Region . . . . . . . . .
Trimming Vector Data to an Arbitrary Region . . . . . . . . . .
Simplifying Vector Coordinate Data . . . . . . . . . . . . . . . . . .
7-2
7-2
7-4
7-5
7-8
7-11
7-12
7-17
7-19
7-22
7-25
7-25
7-32
7-32
7-40
7-42
7-44
Contents
8-2
8-3
8-5
8-5
8-5
8-7
Azimuthal Projections . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
8-8
Projection Aspect . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
The Orientation Vector . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
8-10
8-10
Projection Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Projection Characteristics Maps Can Have . . . . . . . . . . . . .
8-18
8-18
8-27
8-27
8-31
8-37
8-37
8-39
8-41
8-45
8-51
8-51
8-52
8-54
8-59
8-60
.................
8-63
9
Introduction to Web Map Service . . . . . . . . . . . . . . . . . . .
What Web Map Service Servers Provide . . . . . . . . . . . . . . .
Basic WMS Terminology . . . . . . . . . . . . . . . . . . . . . . . . . . . .
9-2
9-2
9-4
9-5
9-5
xi
9-5
9-8
9-8
9-9
9-11
9-11
9-12
..............................
9-13
9-15
9-15
9-15
9-16
9-17
9-19
9-22
9-22
9-30
9-40
9-40
9-42
9-44
xii
Contents
9-24
9-27
9-30
9-33
9-34
9-47
9-50
9-52
9-55
9-56
9-57
9-58
9-58
9-60
9-60
9-61
9-62
9-62
9-63
9-63
Mapping Applications
10
Geographic Statistics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Statistics for Point Locations on a Sphere . . . . . . . . . . . . . .
Geographic Means . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Geographic Standard Deviation . . . . . . . . . . . . . . . . . . . . . .
Equal-Areas in Geographic Statistics . . . . . . . . . . . . . . . . .
10-2
10-2
10-2
10-4
10-7
Navigation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
What Is Navigation? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Conventions for Navigational Functions . . . . . . . . . . . . . . .
Fixing Position . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Planning . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Track Laydown Displaying Navigational Tracks . . . . . . .
Dead Reckoning . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Drift Correction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Time Zones . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
10-11
10-11
10-12
10-13
10-25
10-29
10-31
10-36
10-38
xiii
Function Reference
11
Geospatial Data Import and Access . . . . . . . . . . . . . . . . .
Standard File Formats . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Gridded Terrain and Bathymetry Products . . . . . . . . . . . .
Vector Map Products . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Miscellaneous Data Sets . . . . . . . . . . . . . . . . . . . . . . . . . . . .
GUIs for Data Import . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
File Reading Utilities . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Ellipsoids, Radii, Areas, and Volumes . . . . . . . . . . . . . . . . .
11-2
11-2
11-3
11-4
11-5
11-5
11-5
11-5
11-6
11-6
11-6
11-7
11-7
11-7
11-8
11-8
11-9
11-9
11-10
11-11
11-11
11-12
11-12
11-13
11-13
11-13
11-14
11-14
11-14
11-14
11-15
xiv
Contents
Vector Symbolization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Lines and Contours . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Patch Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Data Grids . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Light Objects and Lighted Surfaces . . . . . . . . . . . . . . . . . . .
Thematic Maps . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Map Annotation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Colormaps for Map Displays . . . . . . . . . . . . . . . . . . . . . . . .
Interactive Map Positions . . . . . . . . . . . . . . . . . . . . . . . . . . .
Interactive Track and Circle Definition . . . . . . . . . . . . . . . .
GUIs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Map Object and Projection Properties . . . . . . . . . . . . . . . . .
Map Appearance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Display Clearing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
11-17
11-17
11-17
11-18
11-18
11-18
11-19
11-20
11-20
11-20
11-20
11-21
11-22
11-23
Geographic Calculations . . . . . . . . . . . . . . . . . . . . . . . . . . .
Geometry of Sphere and Ellipsoid . . . . . . . . . . . . . . . . . . . .
3-D Coordinates . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Ellipsoids and Latitudes . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Geometric Object Overlay . . . . . . . . . . . . . . . . . . . . . . . . . . .
Geographic Statistics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Navigation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
11-23
11-24
11-25
11-25
11-26
11-27
11-27
Utilities . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Angle Conversions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Conversion Factors for Angles and Distances . . . . . . . . . . .
Data Precision . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Distance Conversions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Image Conversion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
String Formatters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Longitude or Azimuth Wrapping . . . . . . . . . . . . . . . . . . . . .
11-28
11-29
11-29
11-29
11-30
11-30
11-30
11-30
GUIs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Map Definition Tools . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Mapping Tools . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Display Manipulation Tools . . . . . . . . . . . . . . . . . . . . . . . . .
Object Property Tools . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Track Tools . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Map Data Construction Tools . . . . . . . . . . . . . . . . . . . . . . . .
11-31
11-31
11-32
11-32
11-33
11-33
11-34
xv
12
Class Reference
13
Web Map Service . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
WebMapServer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
WMSCapabilities . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
WMSLayer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
WMSMapRequest . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
13-2
13-2
13-2
13-2
13-3
14
............................
14-2
Pseudocylindrical Projections . . . . . . . . . . . . . . . . . . . . . .
14-2
Conic Projections . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
14-4
.............
14-4
14-4
14-5
14-5
Cylindrical Projections
xvi
Contents
15
Glossary
Bibliography
A
Examples
B
Your First Maps . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
B-2
B-2
Raster Geodata . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
B-2
B-2
........................
B-2
B-3
B-3
B-3
B-3
xvii
B-4
B-4
B-4
B-5
....................
B-5
B-5
B-5
B-6
B-6
Index
xviii
Contents
1
Getting Started
Product Overview on page 1-2
Dedication and Acknowledgment on page 1-3
Your First Maps on page 1-4
Getting More Help on page 1-26
Mapping Toolbox Demos and Data on page 1-28
Note Some cross-references in this document refer to reference
material included only in the electronic version of this users guide. The
complete users guide is available in the MATLAB Help browser,
and in HTML and PDF formats on the MathWorks Web site, at
http://www.mathworks.com/access/helpdesk/help/toolbox/map/map.html.
Getting Started
Product Overview
The Mapping Toolbox product comprises an extensive set of functions and
graphical user interfaces (GUIs) for creating map displays and analyzing
and manipulating geospatial data in the MATLAB environment. You can
create maps that combine different types of data from multiple sources and
display them in their correct spatial relationships. The toolbox supports
spatial analysis methods such as line-of-sight calculations on terrain data
and geographic computations that account for the curvature of the Earths
surface. Its library of map projections and georeferencing utilities give you
precise control over projected and unprojected coordinate systems.
Most Mapping Toolbox functions are written in the open MATLAB language.
This means that you can inspect the algorithms, adapt them to create your
own custom functions, and automate frequently performed tasks. The toolbox
also includes sample data sets, examples, and demos that illustrate key
concepts, which provide starting points for geospatial data analysis projects
of your own.
Briefly summarized, the toolbox provides functionality in the following areas:
Import and export of file-based geospatial data
Vector map data and geographic data structures
Georeferenced images and data grids
Web Map Service layer selection and map retrieval
Map projections and coordinates
Map display and interaction
Geographic calculations for vector and raster data
A map viewer and other graphical user interfaces
The sections that follow get you started using Mapping Toolbox capabilities,
and describe what its documentation and demos contain and where to look for
categories of information. For a complete classified list of Mapping Toolbox
functions and features, see Chapter 11, Function Reference.
1-2
1-3
Getting Started
worldmap world
This creates an empty map axes, ready to hold the data of your choice.
Function worldmap automatically selected a reasonable choice for your
map projection and coordinate limits. In this case, it chooses a Robinson
projection centered on the prime meridian and the equator (0 latitude,
0 longitude).
1-4
Note that if you type worldmap without an argument a list box appears from
which you can select a country, continent, or region. The worldmap function
then generates a map axes with appropriate projection and map limits.
9865x1
9865x1
Bytes
Class
78920
78920
double
double
Attributes
load coast
plotm(lat, long)
1-5
Getting Started
Notice how the world coastlines form distinct polygons, even though only
a single vector of latitudes and a corresponding vector of longitudes are
provided. The reason is because of NaN separators, which implicitly divide
each vector into multiple parts.
[latcells, loncells] = polysplit(lat, long);
numel(latcells)
ans =
241
lat and long include NaN terminators as well as separators, showing that
the coast data set is organized into precisely 241 polygons.
4 Now create a new map axes for plotting data over Europe, and this time
1-6
the handle with the getm command (which is similar to the MATLAB get
command, but returns map-specific data):
mstruct = getm(h);
6 Now you can inspect the 1-by-1 structure mstruct by listing it, using the
property editor, or by accessing any field directly. For instance, to see the
map projection selected for the map of Europe, type
mstruct.mapprojection
ans =
1-7
Getting Started
eqdconic
7 Add data to the map of Europe using the geoshow function and importing
Note how geoshow can plot data directly from files onto a map axes without
first loading it into the MATLAB workspace.
8 Finally, place a label on the map to identify the Mediterranean Sea.
labelLat = 35;
labelLon = 14;
textm(labelLat, labelLon, 'Mediterranean Sea')
1-8
Look at the reference documentation for worldmap and experiment with its
options. To learn more about display properties for map axes and how to
control them, see Accessing and Manipulating Map Axes Properties on
page 4-14. See the reference page for geoshow to find out more about its
capabilities.
mapview
at the MATLAB prompt. The Map Viewer opens with a blank canvas (no
data is present). The viewer and its tools are shown below.
1-9
Getting Started
Print
figure
Select
area
Zoom
out
Insert
text
Zoom
in
Select
annotations
X and Y coordinate
readouts
Insert
line
Info
Insert
arrow
Pan
Fit to
window
Prior
view
Datatips
Map scale
Coordinate unit
drop-down
Currently active
layer drop-down
Most of the tool buttons can also be activated from the Tools menu.
2 For ease in importing Mapping Toolbox demo data, set your working
directory as follows:
cd(fullfile(matlabroot,'toolbox','map','mapdemos'))
However, you can also navigate to this directory with the Map Viewer
Import Data dialog if you prefer.
3 Select Import From File from the File menu and open the GeoTIFF file
1-10
The file opens in the Map Viewer. The image is a visible red, green, and blue
composite from a georeferenced IKONOS-2 panchromatic/multispectral
product created by GeoEye. Copyright GeoEye, all rights reserved. For
further information about the image, refer to the text files boston.txt
and boston_metdata.txt.
4 To see the map scale, set the map distance units. Use the drop-down Map
above the Map units drop-down. The viewer now looks like this.
1-11
Getting Started
Map scale
Note that the cursor is pointing at the front of the Massachusetts State
House (capitol building). The map coordinates for this location are shown
in the readout at the lower left as 774,114.36 feet easting (X), 2,955,685.56
feet northing (Y), in Massachusetts State Plane coordinates.
6 Next, import a vector data layer, the streets and highways in the central
1-12
convert its X and Y coordinate fields from U.S. survey feet to meters using
the following code:
boston_roads = shaperead('boston_roads.shp');
surveyFeetPerMeter = unitsratio('survey feet','meter');
for k = 1:numel(boston_roads)
boston_roads(k).X = surveyFeetPerMeter * boston_roads(k).X;
boston_roads(k).Y = surveyFeetPerMeter * boston_roads(k).Y;
end
use Import From Workspace > Vector Data > Geographic Data
Structure from the File menu; specify boston_roads as the data to import
from the workspace, and click OK.
1-13
Getting Started
You could clear the workspace now if you wanted, because all the data that
mapview needs is now loaded into it.
8 After the Map Viewer finishes importing the roads layer, it selects a
random color and renders all the shapes with that color as solid lines. The
view looks like this.
1-14
Active layer
Being random, the color you see for the road layer can differ. How you can
specify road colors is discussed below.
9 You can designate any layer to be the active layer (the one that you can
button near the right end of the toolbar. Select the Info tool and click
somewhere along the bridge across the Charles River near the lower left of
the map. This opens a text window displaying the attribute/values for the
selected object.
1-15
Getting Started
Info
The selected road is Massachusetts Avenue (Route 2A). As the above figure
shows, the boston_roads vectors have six attributes.
11 Get information about some other roads. Dismiss open Info windows by
menu, select boston_roads > Set Label Attribute. From the list in the
list box of the Attribute Names dialog, select CLASS and click OK to dismiss
it. The dialog looks like this.
1-16
13 Select the Datatip tool. The cursor assumes a crosshairs (+) shape.
14 Use the Datatip tool to identify the administrative class of any road
displayed. When you click on a road segment, a data tip is left in that place
to indicate the CLASS attribute of the active layer, as illustrated below.
1-17
Getting Started
Data tip
15 You can change how the roads are rendered by identifying an attribute to
which to key line symbology. Color roads according to their CLASS attribute,
which takes on the values 1:6. Do this by creating a symbolspec in the
workspace. A symbolspec is a cell array that associates attribute names
and values to graphic properties for a specified geometric class ('Point',
'MultiPoint', 'Line', 'Polygon', or 'Patch'). To create a symbolspec for
line objects (in this case roads) that have a CLASS attribute, type
roadcolors = makesymbolspec('Line', ...
{'CLASS',1,'Color',[1 1 1]}, {'CLASS',2,'Color',[1 1 0]}, ...
{'CLASS',3,'Color',[0 1 0]}, {'CLASS',4,'Color',[0 1 1]}, ...
{'CLASS',5,'Color',[1 0 1]}, {'CLASS',6,'Color',[0 0 1]})
roadcolors =
ShapeType: 'Line'
Color: {6x3 cell}
1-18
16 The Map Viewer recognizes and imports symbolspecs from the workspace.
To apply the one you just created, select boston_roads > Set Symbol
Spec from the Layers menu. From the Set Symbol Spec dialog, select the
roadcolors symbolspec you just created and click OK. After mapview has
read and applied the symbolspec, the map looks like this.
17 Remove the datatips before going on. To dismiss data tips, right-click each
of them and select Delete datatip or Delete all datatips from the pop-up
context menu that appears.
18 Add another layer, a set of points that identify 13 Boston landmarks. As
you did with the boston_roads layer, you import it from a shapefile. The
locations for these landmarks are also given in meters, so you must convert
their coordinates to units of survey feet before importing them into Map
Viewer, as before.
1-19
Getting Started
Read the shapefile and convert from meters to survey feet using this code:
boston_placenames = shaperead('boston_placenames.shp');
surveyFeetPerMeter = unitsratio('survey feet','meter');
for k = 1:numel(boston_placenames)
boston_placenames(k).X = ...
surveyFeetPerMeter * boston_placenames(k).X;
boston_placenames(k).Y = ...
surveyFeetPerMeter * boston_placenames(k).Y;
end
From the File menu choose Import From Workspace > Vector Data
> Geographic Data Structure; choose boston_placenames as the data
to import from the workspace by selecting it, and click OK:
The points of interest are symbolized as small x markers.
19 As the boston_placenames markers are difficult to see over the orthophoto,
hide the other map layers temporarily. To do this, go to the Layers menu,
select boston_roads, and then slide right and deselect Visible. Do the
same to hide the boston image layer.
You can now see the 13 markers showing points of interest.
20 To make the markers more visually prominent, create a symbolspec for
The Default keyword causes the specified symbol to be applied to all point
objects in a given layer unless specifically overridden by an attribute-coded
symbol in the same or a different symbolspec.
21 To activate this symbolspec, pull down the Layers menu, select
1-20
The Map Viewer reads the workspace variable places; the cross marks
turn into red circles. Note that a layer need not be active in order for you
to apply a symbolspec to it.
22 Now restore the other layers visibility. In the Layers menu, select
boston_roads, and then slide right and select Visible. Do the same to
show the boston image layer. The boston_placenames marker layer,
because it was read in most recently, is on top.
23 Use the Active layer drop-down menu to make boston_placenames the
currently active layer, and then select the Datatip tool. Click any red
circle to see the name of the feature it marks. The map looks like this
(depending on which data tips you show).
24 Zoom in on Beacon Hill for a closer view of the Massachusetts State House
and Boston Common. Select the Zoom in tool, move the (magnifier) cursor
1-21
Getting Started
Zoom in
25 Right-click any of the data tips and select Delete all datatips from the
pop-up context menu. This clears the place names you added to the maps.
26 Select an area of interest to save as an image file. Click the Select
area tool, and then hold the mouse button down as you draw a selection
rectangle. If you do not like the selection, repeat the operation until you
are satisfied. If you know what ground coordinates you want, you can use
the coordinate readouts to make a precise selection. The selected area
appears as a red rectangle.
1-22
27 In order to be able to save a file in the next step, change your working
Raster Map > Selected Area to open a Save As dialog, as shown below.
1-23
Getting Started
annotate the map with lines, arrows, and text, fit the map to the window,
1-24
draw a bounding box for any layer, and print the current view. You can
also spawn a new Map Viewer using New View from the File menu. A
new view can duplicate the current view, cover the active layers extent,
cover all layer extents, or include only the selected area, if any. When
you are through with a viewing session, close the Map Viewer using the
windows close box or select Close from the File menu.
1-25
Getting Started
You can find a classified list of functions in the Geospatial Data Import and
Access on page 11-2 (online only). Help is available for individual commands
and classes of Mapping Toolbox commands:
help map for computational functions
mapdemos for a list of Mapping Toolbox demos
maps lists all Mapping Toolbox map projections by class, name, and ID
string.
maplist returns a structure describing all Mapping Toolbox map
projections.
projlist to list map projections supported by projfwd and projinv
help functionname for help on a specific function, often including examples
helpwin functioname to see the output of help displayed in the Help
browser window instead of the Command Window
doc functionname to read a functions reference page in the Help browser,
including examples and illustrations
1-26
1-27
Getting Started
Available Demos
You can run demonstrations of Mapping Toolbox functions to further acquaint
you with their use. Most of the demos highlight and explain features added
in the current version. To see the full list of demos, click the Demos icon
in the Contents pane in the Help Navigator. Another way to obtain this
list is to type
mapdemos
at the MATLAB prompt. This will bring the Help browser to the fore.
When you view any of the following demos, you can then execute and view
its code by clicking links in the banner for that page that say Run in the
Command Window and Open <demo>.m in the Editor:
mapexkmlexport Exporting Vector Point Data to KML
mapexfindcity Interactive Global City Finder
mapexgeo Creating Maps Using geoshow (for latitude, longitude data)
mapexmap Creating Maps Using mapshow (for x, y data)
mapexrefmat Creating a Half-Resolution Georeferenced Image
mapexreg Georeferencing an Image to an Orthotile Base Layer
mapex3ddome Plotting a 3-D Dome as a Mesh Over a Globe
mapexunprojectdem Un-Projecting a Digital Elevation Model (DEM)
mapexgshhs Converting Coastline Data (GSHHS) to Shapefile Format
mapexwmsanimate Compositing and Animating Web Map Service
(WMS) Meteorological Layers
1-28
to see this list of links as well as descriptions of the sample data provided
in Mapping Toolbox.
1-29
1-30
Getting Started
2
Understanding Map Data
Maps and Map Data on page 2-2
Types of Map Data Handled by the Toolbox on page 2-4
Understanding Vector Geodata on page 2-13
Understanding Raster Geodata on page 2-33
Reading and Writing Geospatial Data on page 2-52
What Is a Map?
Mapping Toolbox software manipulates electronic representations of
geographic data. It lets you import, create, use, and present geographic data
in a variety of forms and to a variety of ends. In the digital network era, it is
easy to think of geospatial data as maps and maps as data, but you should
take care to note the differences between these concepts.
The simplest (although perhaps not the most general) definition of a map is a
representation of geographic data. Most people today generally think of maps
as two-dimensional; to the ancient Egyptians, however, maps first took the
form of lists of place names in the order they would be encountered when
following a given road. Today such a list would be considered as map data
rather than as a map. When most people hear the word map they tend
to visualize two-dimensional renditions such as printed road, political, and
topographic maps, but even classroom globes and computer graphic flight
simulation scenes are maps under this definition.
In this toolbox, map data is any variable or set of variables representing a
set of geographic locations, properties of a region, or features on a planets
surface, regardless of how large or complex the data is, or how it is formatted.
Such data can be rendered as maps in a variety of ways using the functions
and user interfaces provided.
2-2
2-3
Vector Geodata
Vector data (in the computer graphics sense rather than the physics
sense) can represent a map. Such vectors take the form of sequences of
latitude-longitude or projected coordinate pairs representing a point set, a
linear map feature, or an areal map feature. For example, points delineating
the boundary of the United States, the interstate highway system, the centers
of major U.S. cities, or even all three sets taken together, can be used to make
a map. In such representations, the geographic data is in vector format and
displays of it are referred to as vector maps. Such data consists of lists of
specific coordinate locations (which, if describing linear or areal features, are
normally points of inflection where line direction changes), along with some
indication of whether each is connected to the points adjacent to it in the list.
In the Mapping Toolbox environment, vector data consists of sequentially
ordered pairs of geographic (latitude, longitude) or projected (x,y) coordinate
pairs (also called tuples). Successive pairs are assumed to be connected
in sequence; breaks in connectivity must be delineated by the creation of
separate vector variables or by inserting separators (usually NaNs) into the
sets at each breakpoint. For vector map data, the connectivity (topological
structure) of the data is often only a concern during display, but it also affects
the computation of statistics such as length and area.
load coast
whos
Name
2-4
Size
Bytes
Class
Attributes
ans
lat
long
1x45
9589x1
9589x1
90
76712
76712
char
double
double
The variables lat and long are vectors in the coast MAT-file, which
together form a vector map of the coastlines of the world.
2 To view a map of this data, enter these commands:
axesm mercator
framem
plotm(lat,long)
2-5
ans =
-83.83 -180
-84.33 -178
-84.5 -174
-84.67 -170
-84.92 -166
-85.42 -163
-85.42 -158
-85.58 -152
-85.33 -146
-84.83 -147
-84.5 -151
-84 -153.5
-83.5 -153
-83 -154
-82.5 -154
-82 -154
-81.5 -154.5
-81.17 -153
-81 -150
-80.92 -146.5
Does this give you any clue as to which continents coastline these locations
represent?
3 To see the coastline these vector points represent, type this command to
As you may have deduced by looking at the first column of the data, there
is only one continent that lies below -80 latitude, Antarctica.
The above example presents the map in a Mercator projection. A map
projection displays the surface of a sphere (or a spheroid) in a two-dimensional
plane. As the word plane indicates, points on the sphere are geometrically
projected to a plane surface. There are many possible ways to project a map,
all of which introduce various types of distortions.
For further information on how Mapping Toolbox software manages map
projections, see Chapter 8, Using Map Projections and Coordinate Systems.
2-6
For details on data structures that the toolbox uses to represent vector
geodata, see Mapping Toolbox Geographic Data Structures on page 2-16.
Raster Geodata
You can also map data represented as a matrix (a 2-D MATLAB array) in
which each row-and-column element corresponds to a rectangular patch of
a specific geographic area, with implied topological connectivity to adjacent
patches. This is commonly referred to as raster data. Raster is actually a
hardware term meaning a systematic scan of an image that encodes it into a
regular grid of pixel values arrayed in rows and columns.
When data in raster format represents the surface of a planet, it is called a
data grid, and the data is stored as an array or matrix. The toolbox leverages
the power of MATLAB matrix manipulation in handling this type of map data.
This documentation uses the terms raster data and data grid interchangeably
to talk about geodata stored in two-dimensional array form.
A raster can encode either an average value across a cell or a value sampled
(posted) at the center of that cell. While geolocated data grids explicitly
indicate which type of values are present (see Geolocated Data Grids on
page 2-44), external metadata/user knowledge is required to be able to specify
whether a regular data grid encodes averages or samples of values.
2-7
georeference topo.
topoR = makerefmat('RasterSize', size(topo), ...
'Latlim', [-90 90], 'Lonlim', [-180 180]);
3 Create an equal-area map projection to view the topographic data:
axesm sinusoid
2-8
5 Now create a new figure using a Hammer projection (which, like the
A colored relief map of the topo data set, illuminated from the east, is
rendered in the second figure window.
2-9
clma
2-10
load coast
3 If the topo data is not already in the workspace, load it as well:
load topo
4 Set up a Robinson projection:
axesm robinson
5 Plot the raster topographic data with an appropriate colormap:
geoshow(topo,topolegend,'DisplayType','texturemap')
demcmap(topo)
6 Plot the coastline data in white on top of the terrain map:
geoshow(lat,long,'Color','r')
Note that you can use geoshow to display both raster and vector data. Here
is the resulting map.
2-11
2-12
Note that either row or column vectors can be used, but both variables should
have the same shape. For example, lat and long could be defined as columns:
lat = [45.6 -23.47 78]';
long = [13 -97.45 165]';
2-13
These values could mean anything. They could represent three locations over
which geosynchronous satellites are stationed, and can be communicated by
plotting a symbol for each point on a map of the Earth. Alternatively, they
might represent a starting point, a midcourse marker, and a finish point
of a sailboat race, in which case they can be rendered by plotting two line
segments. Or perhaps the values represent the vertices of a triangle bounding
a region of interest, and thus constitute a simple polygon.
Note When polygons become graphic objects, they are called patches. In this
documentation, the words patch and polygon are often used interchangeably.
Mapping Toolbox functions provide for each of these interpretations. For
many purposes, the distinction is irrelevant; for others, the choice of a
function implies one interpretation over the others. For example, the function
plotm displays the data as a line, while fillm displays it as a filled polygon.
While you can draw an unfilled polygon with fillm that looks like the output
from plotm, the resulting object has a different graphic data type (patch
versus line), hence different properties you can set.
A line must contain at least two coordinate elements for each coordinate
dimension, and a polygon at least three (note that it is not necessary to
duplicate the first point as the last point to define or render a polygon).
The toolbox places no limit (beyond available memory) on how large or how
complex the shape of a line and polygon can be, other than the restriction
that it should not cross itself.
Objects in the real world that vector geodata represents can have many parts,
for example, the islands that make up the state of Hawaii. When encoding
as vector variables the shapes of such compound entities, you must separate
successive entities. To indicate that such a discontinuity exists, the toolbox
uses the convention of placing NaNs in identical positions in both vector
variables. For example, if a second segment is to be added to the preceding
map, the two objects can reside in the same pair of variables:
lat = [45.6 -23.47 78 NaN 43.9 -67.14 90 -89];
lon = [13 -97.45 165 NaN 0 -114.2 -18 0];
2-14
Notice that the NaNs must appear in the same locations in both variables.
Here is a segment of three points separated from a segment of four points. The
NaNs perform two functions: they provide a means of identifying breakpoints
in the data, and they serve as pen-up commands when plotting vector maps.
The NaNs are used to separate both distinct (but possibly connecting) lines
and disconnected patch faces.
Note This convention departs from regular MATLAB graphics, in which
NaN-separated polygons cannot be interpreted or displayed as separate
patches.
2-15
Border line
The distinction between line and polygon data might not appear to be
important, but it can make a difference when you are performing geographic
analysis and thematic mapping. For example, polygon data can be treated as
line data and displayed with functions such as linem, but line data cannot
be handled as polygons unless it is restructured to make all objects close on
themselves, as described in Matching Line Segments on page 7-4.
2-16
Note The data structures discussed in this section are different from the map
projection structure (also called an mstruct), which defines a map projection
and related display properties for map axes. See the defaultm function
reference page for information about mstructs.
The following subsections describe what the geographic data structures
contain and how to create and display them. Version 1 of the toolbox used a
different kind of geographic data structure (called a display structure), which
had a more rigid definition.
Note Version 1 display structures are being phased out of the toolbox
and are currently generated only by a few functions. You can use the
updategeostruct to convert a display structure containing vector features
to a geographic data structure. You must do this in order to export data
imported from VMAP level 0 or DCW data sets with shapewrite, for example.
For more information, see the displaym reference page, which describes the
format and contents of display structures.
2-17
2-18
This indicates that the shapefile contains 609 features. In addition to the
Geometry, BoundingBox, and coordinate fields (X and Y), there are five
attribute fields: STREETNAME, RT_NUMBER, CLASS, ADMIN_TYPE, and LENGTH.
Looking at the 10th element,
S(10)
ans =
Geometry:
BoundingBox:
X:
Y:
STREETNAME:
RT_NUMBER:
'Line'
[2x2 double]
[1x9 double]
[1x9 double]
'WRIGHT FARM'
''
2-19
CLASS: 5
ADMIN_TYPE: 0
LENGTH: 79.0347
you can see that this mapstruct contains line features, and that the tenth
line has nine vertices. The first two attributes are string-valued (the second
happens to be empty), and the final three attributes are numeric. Across
the elements of S, X and Y can have various lengths, but STREETNAME and
RT_NUMBER must always contain strings, and CLASS, ADMIN_TYPE, and LENGTH
must always contain scalar doubles.
Note In mapstructs and geostructs having Line or Polygon geometries,
individual features can have multiple partsseparated, disconnected line
segments and polygon rings. The parts can include inner rings that run
counterclockwise and outline voids. Each disconnected part is separated from
the next by a NaN within the X and Y (or Lat and Lon) vectors. You can use
the isShapeMultipart function to determine if a feature has NaN-separated
parts.
Each NaN-separated multipart line, polygon, or multipoint entity constitutes
a single feature and thus has one string or scalar double value per attribute
field. It is not possible to assign distinct attributes to the different parts of
such a feature; any string or numeric attribute imported with (or subsequently
added to) the geostruct or mapstruct applies to all the features parts.
2-20
% Paris coords
% Santiago
% New York City
2-21
Cities(2).Lat = latsant;
Cities(3).Lat = latnyc;
Cities(2).Lon = lonsant;
Cities(3).Lon = lonnyc;
% Add city names as City fields. You can name optional fields
% anything you like other than Geometry, Lat, Lon, X, or Y.
Cities(1).Name = 'Paris';
Cities(2).Name = 'Santiago';
Cities(3).Name = 'New York';
% Inspect your completed geostruct and its first member
Cities
Cities =
1x3 struct array with fields:
Geometry
Lat
Lon
Name
Cities(1)
ans =
Geometry:
Lat:
Lon:
Name:
'Point'
48.8708
2.4131
'Paris'
2-22
textm([Cities(:).Lat],[Cities(:).Lon],...
{Cities(:).Name},'FontWeight','bold');
2-23
'Line'
'gc'
'Paris-Santiago'
[100x1 double]
[100x1 double]
104.8274
235.8143
2-24
colorRange = makesymbolspec('Line',...
{'Length',[min([Tracks.Length]) ...
max([Tracks.Length])],...
'Color',winter(3)});
geoshow(Tracks,'SymbolSpec',colorRange);
You can save the geostructs you just created as shapefiles by calling
shapewrite with a filename of your choice, for example:
shapewrite(Cities,'citylocs');
shapewrite(Tracks,'citytracks');
2-25
2-26
2-27
was the only option available.) Create a file named roadfilter.m, with
the following contents:
function result = roadfilter(roadclass,roadlength)
mininumClass = 4;
minimumLength = 200;
result = (roadclass >= mininumClass) && ...
(roadlength >= minimumLength);
end
2 You can then call shaperead like this:
'CLASS'
'LENGTH'
2-28
Geometry
BoundingBox
X
Y
STREETNAME
RT_NUMBER
CLASS
ADMIN_TYPE
LENGTH
2-29
2-30
'CLASS', 'LENGTH'})
s =
115x1 struct array with fields:
Geometry
BoundingBox
X
Y
STREETNAME
RT_NUMBER
CLASS
ADMIN_TYPE
LENGTH
2-31
roadselector = constructroadselector(...
minimumClass, minimumLength);
s = shaperead('concord_roads', 'Selector', roadselector)
s =
115x1 struct array with fields:
Geometry
BoundingBox
X
Y
STREETNAME
RT_NUMBER
CLASS
ADMIN_TYPE
LENGTH
2-32
For additional details about and examples of using referencing matrices, see
the reference page for makerefmat.
Referencing Vectors
In many instances (when the data grid or image is based on latitude and
longitude and is aligned with the geographic graticule), a referencing matrix
has more degrees of freedom than the data requires. In such cases, you can
use a more compact representation, a three-element referencing vector. A
referencing vector defines the pixel size and northwest origin for a regular,
rectangular data grid:
2-33
2-34
All regular data grids require a referencing matrix or vector, even if they
cover the entire planet. Geolocated data grids do not, as they explicitly
identify the geographic coordinates of all rows and columns. For details on
geolocated grids, see Geolocated Data Grids on page 2-44. For additional
information on referencing matrices and vectors, see the reference pages
for makerefmat, limitm, and sizem.
60
0
-120
axesm('MapProjection', 'eqdcylin')
setm(gca,'GLineStyle','-', 'Grid','on','Frame','on')
4 Draw a graticule with parallel and meridian labels at 60 intervals:
2-35
5 Map the data using meshm and display with a color ramp and legend:
Note that the first row of the matrix is displayed as the bottom of the map,
while the last row is displayed as the top.
vector, refvec:
load korea
refvec
refvec =
2-36
12
45
115
The refvec referencing vector indicates that there are 12 cells per angular
degree. This horizontal resolution is 5 times finer than that of the topo
data grid, which is one cell per degree.
2 Use limitm to determine that the korea region extends from 30N to 45N
elevation array and computing the eastern and southern map limits from
the reference vector:
[rows cols] = size(map)
rows =
180
cols =
240
southlat = refvec(2) - rows/refvec(1)
southlat =
30
eastlon = refvec(3) + cols/refvec(1)
eastlon =
135
2-37
The data grid in the russia MAT-file extends over the international date
line (180 longitude). You could use the function wrapTo180 to rename the
eastern limit to be -170, or 170W.
2-38
30.7
setpostn does the reverse of this, determining the row and column of the data
2-39
Although each data grid element represents an area, not a point, it is often
useful to assign singular coordinates to provide a point of reference. The
setltln function does this. It geolocates an element by the point in the center
of the area represented by the element. The following code references the
center cell coordinate for the row 3, column 17 of the Russia map:
clear; load russia
row = 3; col = 17;
[lat,long] = setltln(map,refvec,row,col)
lat =
35.5
long =
18.3
Because the cells in the russia matrix represent 0.2 squares (5 cells per
degree), the cell in question extends from north of 35.4S to exactly 35.6S,
and from east of 18.2E to exactly 18.4E.
2-40
value =
2
3 The latitude-longitude coordinates associated with particular values in a
data grid can be found with findm, analogous to the MATLAB function
find. Here the coordinates of elements in the topo matrix have values
greater than 5,500 meters:
load topo
[lats,longs] = findm(topo>5500,topolegend);
[lats longs]
ans =
34.5000
34.5000
30.5000
28.5000
79.5000
80.5000
84.5000
86.5000
4 To get the row and column indices instead, simply use the Mapping Toolbox
function find:
[i,j]=find(topo>5500)
i =
125
125
121
119
j =
80
81
85
87
5 To recode a specific matrix value to some other value, use changem. Load or
reload the russia MAT-file, and then change all instances of a given value
in a data grid to a new value in one step:
oldcode = ltln2val(map,maplegend,37,79)
oldcode =
2-41
4
newmap = changem(map,5,oldcode);
newcode = ltln2val(newmap,maplegend,37,79)
newcode =
5
whos
Name
clrmap
description
map
maplegend
nonrussia
refvec
source
Size
4x3
5x69
225x875
1x3
225x875
1x3
1x68
Bytes
96
690
1575000
24
1575000
24
136
newcode = ltln2val(nonrussia,refvec,37,79)
newcode =
0
2-42
Class
double
char
double
double
double
double
char
-130
msize = r * c * 8
msize =
1400000
-130
msize = r * c * 8
2-43
msize =
350000
called mapmtx:
load mapmtx
whos
Name
description
lg1
lg2
2-44
Size
Bytes
Class
1x54
50x50
50x50
108
20000
20000
char
double
double
Attributes
lt1
lt2
map1
map2
source
50x50
50x50
50x50
50x50
1x43
20000
20000
20000
20000
86
double
double
double
double
char
Two geolocated data grids are in this data set, each requiring three
variables. The values contained in map1 correspond to the latitude and
longitude coordinates, respectively, in lt1 and lg1. Notice that all three
matrices are the same size. Similarly, map2, lt2, and lg2 together form a
second geolocated data grid. These data sets were extracted from the topo
data grid shown in previous examples. Neither of these maps is regular,
because their columns do not run north to south.
2 To see their geography, display the grids one after another:
close all
axesm mercator
gridm on
framem on
h1=surfm(lt1,lg1,map1);
h2=surfm(lt2,lg2,map2);
3 Showing coastlines will help to orient you to these skewed grids:
load coast
plotm(lat,long,'r')
2-45
Notice that neither topo matrix is a regular rectangle. One looks like
a diamond geographically, the other like a trapezoid. The trapezoid is
displayed in two pieces because it crosses the edge of the map. These
shapes can be thought of as the geographic organization of the data, just as
rectangles are for regular data grids. But, just as for regular data grids,
this organizational logic does not mean that displays of these maps are
necessarily a specific shape.
4 Now change the view to a polyconic projection with an origin at 0N, 90E:
2-46
2-47
4;...
lat = [ 30 30 30 30;...
0
0
0
0;...
-30 -30 -30 -30;...
-60 -60 -60 -60];
long = [0 30 60 90;...
0 30 60 90;...
0 30 60 90;...
0 30 60 90];
This geolocated data grid is displayed with the values of map shown at the
associated latitudes and longitudes.
2-48
Notice that only 9 of the 16 total cells are displayed. The value displayed for
each cell is the value at the upper left corner of that cell, whose coordinates
are given by the corresponding lat and long elements. By convention, the
last row and column of the map matrix are not displayed, although they exist
in the CData property of the surface object.
Type 2: Values centered within four adjacent coordinates. For the
second interpretation, consider a 3-by-3 map matrix with the same lat and
long variables:
map = [1 2 3;...
4 5 6;...
7 8 9];
Here is a surface plot of the map matrix, with the values of map shown at the
center of the associated cells:
2-49
All the map data is displayed for this geolocated data grid. The value of each
cell is the value at the center of the cell, and the latitudes and longitudes in
the coordinate matrices are the boundaries for the cells.
Ordering of Cells. You may have noticed that the first row of the matrix is
displayed as the top of the map, whereas for a regular data grid, the opposite
was true: the first row corresponded to the bottom of the map. This difference
is entirely due to how the lat and long matrices are ordered. In a geolocated
data grid, the order of values in the two coordinate matrices determines the
arrangement of the displayed values.
Transforming Regular to Geolocated Grids. When required, a regular
data grid can be transformed into a geolocated data grid. This simply requires
that a pair of coordinates matrices be computed at the desired spatial
resolution from the regular grid. Do this with the meshgrat function, as
follows:
load topo
[lat,lon] = meshgrat(topo,topolegend);
Name
Size
Bytes
lat
lon
topo
topolegend
topomap1
topomap2
2-50
180x360
180x360
180x360
1x3
64x3
128x3
518400
518400
518400
24
1536
3072
Class
double
double
double
double
double
double
Attributes
2-51
The following table lists Mapping Toolbox functions that read geospatial
data products and file formats and write geospatial data files. Note that the
2-52
geoshow and mapshow functions and the mapview GUI can read and display
both vector and raster geodata files in several formats. Click function names
to see their details in the Mapping Toolbox reference documentation. The
Type of Coordinates column describes whether the function returns or
writes data in geographic (geo) or projected (map) coordinates, or as
geolocated data grids (which, for the functions listed, all contain geographic
coordinates). Some functions can return either geographic or map coordinates,
depending on what the file being read contains; these functions do not signify
what type of coordinates they return (in the case of shaperead, however,
you can specify whether the structure it returns should have X and Y or Lon
and Lat fields).
Function
Description
Type of Data
Type of
Coordinates
arcgridread
raster
map
avhrrgoode
raster
geolocated
avhrrlambert
raster
geolocated
dcwdata
vector
geo
dcwgaz
vector
geo
dcwread
vector
geo
dcwrhead
properties
geo
demdataui
raster
geo
2-53
Function
Description
Type of Data
Type of
Coordinates
dted
raster
geo
dteds
filenames
geo
egm96geoid
raster
geo
etopo
raster
geo
fipsname
FIPS
names and
identifiers
geo
geotiffinfo
properties
map
geo
2-54
geotiffread
image
map
getworldfilename
filename
geo
globedem
raster
geo
globedems
filenames
geo
gshhs
vector
geo
map
Function
Description
Type of Data
Type of
Coordinates
gtopo30
raster
geo
gtopo30s
filenames
geo
kmlwrite
vector
points and
attributes
geo
readfk5
vector
astro
satbath
raster
geolocated
sdtsdemread
raster
geo
sdtsinfo
properties
geo
shapeinfo
properties
geo
vector
vector
shaperead
shapewrite
map
map
geo
map
geo
map
2-55
Function
Description
Type of Data
Type of
Coordinates
tbase
raster
geo
usgs24kdem
raster
geolocated
usgsdem
raster
map
usgsdems
filenames
map
vmap0data
vector
geo
vmap0read
vector
geo
vmap0rhead
properties
geo
vmap0ui
vector
geo
worldfileread
georeferencing geo
information
worldfilewrite
georeferencing geo
information
The MATLAB environment provides many general file reading and writing
functions (for example, imread, imwrite, urlread, and urlwrite) which you
can use to access geospatial data you want to use with Mapping Toolbox
software. For example, you can read a TIFF image with imread and its
accompanying worldfile with worldfileread to import the image and
construct a referencing matrix to georeference it. See the Mapping Toolbox
demos Creating a Half-Resolution Georeferenced Image and Georeferencing
an Image to an Orthotile Base Layer for examples of how you can do this.
2-56
2-57
The location, text, and icon for the placemark were specified to kmlwrite as
follows:
lat =
42.299827;
lon = -71.350273;
description = sprintf('%s<br>%s</b><br>%s</b>', ...
'3 Apple Hill Drive', 'Natick, MA. 01760', ...
'http://www.mathworks.com');
name = 'The MathWorks, Inc.';
iconFilename = ...
'http://www.mathworks.com/products/product_listing/images/ml_icon.gif';
iconScale = 1.0;
2-58
filename = 'The_MathWorks.kml';
kmlwrite(filename, lat, lon, ...
'Description', description, 'Name', name, ...
'Icon', iconFilename, 'IconScale', iconScale);
If you view this in an Earth Browser, notice that the text inside the
placemark, http://www.mathworks.com, was automatically rendered as a
hyperlink. The Google Earth service also adds a link called Directions.
kmlwrite does not include location coordinates in placemarks. This is because
it is easy for users to read out where a placemark is by mousing over it or
by viewing its Properties dialog box.
2-59
The generated KML file has the following structure and content:
<?xml version="1.0" encoding="utf-8"?>
<kml xmlns="http://earth.google.com/kml/2.1">
<Document>
<name>Australian_Cities</name>
<Placemark>
<Snippet maxLines="0"> </Snippet>
<description> </description>
<name>Perth, Australia</name>
<address>Perth, Australia</address>
</Placemark>
<Placemark>
<Snippet maxLines="0"> </Snippet>
<description> </description>
<name>Melbourne, Australia</name>
<address>Melbourne, Australia</address>
</Placemark>
<Placemark>
<Snippet maxLines="0"> </Snippet>
<description> </description>
<name>Sydney, Australia</name>
<address>Sydney, Australia</address>
2-60
</Placemark>
</Document>
</kml>
The placemarks display in a Google Earth map like this, with default
placemark icons.
2-61
The steps below select some of these from the shapefiles and display them as
tables in exported KML placemarks.
1 Read the tsunami shapefiles, selecting certain attributes.
There are several ways to select attributes from shapefiles. One is to pass
shaperead a cell array of attribute names in the Attributes parameter.
For example, you might just want to map the maximum wave height, the
suspected cause, and also show the year, location and country for each
event. Set up a cell array with the corresponding attribute field names as
follows, remembering that field names are case-sensitive.
attrs = {'Max_Height','Cause','Year','Location','Country'};
Since the data file uses latitude and longitude coordinates, you need
to specify 'UseGeoCoords',true to ensure that shaperead returns a
geostruct (having Lat and Lon fields).
tsunamis = shaperead('tsunamis.shp','useGeoCoords',true,...
'Attributes',attrs);
2-62
kmlwrite(kmlfilename,tsunamis);
3 View the placemarks in an earth browser
Rotate to the Western Pacific ocean and zoom to inspect the placemarks.
Click on the pushpin icons to see the attribute table for any event.
kmlwrite formats tables by default to display all the attributes in the
geostruct passed to it.
2-63
2-64
[1x1
[1x1
[1x1
[1x1
[1x1
struct]
struct]
struct]
struct]
struct]
Format the label for Max_Height as bold text, give units information about
Max_Height, and also set the other attribute labels in bold.
attribspec.Max_Height.AttributeLabel = '<b>Maximum Height</b>';
attribspec.Max_Height.Format = '%.1f Meters';
attribspec.Cause.AttributeLabel = '<b>Cause</b>';
attribspec.Year.AttributeLabel = '<b>Year</b>';
attribspec.Year.Format = '%.0f';
attribspec.Location.AttributeLabel = '<b>Location</b>';
attribspec.Country.AttributeLabel = '<b>Country</b>';
When you use the attribute spec, all the attributes it lists are included in
the placemarks generated by kmlwrite unless you remove them from the
spec manually (e.g., with rmfield).
5 Customize the placemark icon
You can specify your own icon using kmlwrite to use instead of the default
pushpin symbol. The black-and-white bullseye icon used here is specified
as URL for an icon in the Google KML library.
iconname = ...
'http://maps.google.com/mapfiles/kml/shapes/placemark_circle.png';
kmlwrite(kmlfilename,tsunamis,'Description',attribspec,...
'Name',{tsunamis.Location},'Icon',iconname,'IconScale',2);
Refresh the earth browser to display the new version of the KML file.
2-65
To vary the size of placemark icons, specify an icon file and a scaling factor
for every observation as vectors of names (all the same) and scale factors
(all computed individually) when writing a KML file. Scale the width and
height of the markers to the log of Max_Height. Scaling factors for point
icons are data-dependent and can take some experimenting with to get
right.
% Create vector with log2 exponents of |Max_Height| values
[loghgtx loghgte] = log2([tsunamis.Max_Height]);
% Create a vector replicating the icon URL
iconnames = cellstr(repmat(iconname,numel(tsunamis),1));
2-66
kmlwrite(kmlfilename,tsunamis,'Description',attribspec,...
'Name',{tsunamis.Location},'Icon',iconname,...
'IconScale',loghgte);
Refresh the earth browser to display the new version of the KML file.
Position the viewpoint to compare with the previous view of the Pacific
region. Diameters of placemarks now correspond to log(Max_Height).
2-67
functions read or write such files. All create files in a directory for which you
must have write permission. Input files can exist on your host computer,
reside on a local area network, or be located on the Internet (in which case
they are identified using URLs).
The following table identifies MATLAB functions that you can use to read,
uncompress, compress, and write archived data files, geospatial or otherwise.
Click any link to read the functions documentation.
Function
Purpose
gunzip
untar
unzip
gzip
tar
zip
Use the functions gunzip, untar, and unzip to read data files specified with a
URL or with path syntax. Use the functions gzip, tar, and zip to create your
own compressed files and archives. This capability is useful, for example,
for packaging a set of shapefiles, or a worldfile along with the data grid or
image it describes, for distribution.
2-68
3
Understanding Geospatial
Geometry
Understanding Spherical Coordinates on page 3-2
Understanding Latitude and Longitude on page 3-11
Understanding Angles, Directions, and Distances on page 3-14
Understanding Map Projections on page 3-29
Great Circles, Rhumb Lines, and Small Circles on page 3-32
Directions and Areas on the Sphere and Spheroid on page 3-38
Planetary Almanac Data on page 3-46
See Chapter 2, Understanding Map Data for information on how geographic
phenomena are encoded and represented numerically, and how geodata
is structured.
3-2
The shape of the geoid is important for some purposes, such as calculating
satellite orbits, but need not be taken into account for every mapping
application. However, knowledge of the geoid is sometimes necessary, for
example, when you compare elevations given as height above mean sea level
to elevations derived from GPS measurements. Geoid representations are
also inherent in datum definitions.
3-3
You can define ellipsoids in several ways. They are usually specified by
a semimajor and a semiminor axis, but are often expressed in terms of
a semimajor axis and either inverse flattening (which for the Earth, as
mentioned above, is one part in 300) or eccentricity. Whichever parameters are
used, as long as an axis length is included, the ellipsoid is fully constrained
and the other parameters are derivable. The components of an ellipsoid are
shown in the following diagram.
Semiminor
(polar)
axis
Semimajor
(equatorial)
axis
Axis of rotation
The toolbox includes ellipsoid models that represent the figures of the Sun,
Moon, and planets, as well as a set of the most common ellipsoid models of
the Earth.
3-4
0.0818191910428158
You should set format to long g, as above, if you want to display eccentricity
values at full precision.
For example, examine the parameters of the wgs72 (the 1972 World Geodetic
System) ellipsoid, using the almanac function:
wgs72 = almanac('earth','wgs72','kilometers')
wgs72 =
3-5
6378.135
0.0818188106627487
0.0816968312225275
The ellipsoid vectors values are the semimajor axis, in kilometers, and
eccentricity. Both eccentricity and flattening are dimensionless ratios.
The toolbox has functions to convert elliptical definitions from these forms
to ellipsoid vector form. For example, the function axes2ecc returns an
eccentricity when given semimajor and semiminor axes as arguments.
The ellipse in the previous diagram is highly exaggerated. For the Earth, the
semimajor axis is about 21 kilometers longer than the semiminor axis. Use
the almanac function to verify this:
grs80 = almanac('earth','ellipsoid','kilometers')
grs80 =
6378.137
0.0818191910428158
semiminor = minaxis(grs80)
semiminor =
6356.75231414036
semidiff = grs80(1) - semiminor
semidiff =
21.3846858596444
3-6
kmtomm =
1000000
scalelim = semidiff * kmtomm / 0.5
scalelim =
4.2769e+007
The unitsratio function was used to convert the distance semidiff from
kilometers into millimeters. This indicates that the Earths eccentricity is not
geometrically meaningful at scales of less than 1:43,000,000, which is roughly
the scale of a world map shown on a page of this document. Consequently,
most Mapping Toolbox functions default to a spherical model of the Earth.
Another reason for defaulting to a sphere is that angular distances are not
meaningful on ellipsoids, and some Mapping Toolbox functions compute or
use angular distances. See Working with Distances on the Sphere on page
3-23 for more information. Regardless, you are free to specify any ellipsoid
when you define map axes or otherwise operate on geodata.
3-7
worldmap australia
ellipsoid = getm(gca,'geoid')
ans =
1
This value for x turns out to equal /2, which might tempt you to think that
the Mercator projection has simply converted degrees to radians. But what
has actually changed is that the point at (0, 90) now maps to a point 1 earth
3-8
3-9
1984 (WGS84); their semimajor axis lengths are equal and their semiminor
axes (i.e., center to pole) differ in length by just over 1/10 mm, as the following
code demonstrates:
grs80 = almanac('earth','grs80','meters');
wgs84 = almanac('earth','wgs84','meters');
minaxis(wgs84) - minaxis(grs80)
ans =
1.0482e-004
The toolbox supports several other ellipsoid vectors, for models ranging from
Everests 1830 ellipsoid (used for India) to the International Astronomical
Union ellipsoid of 1965 (used for Australia). These can be referenced by the
following statements:
ellipsoid1 = almanac('earth','ellipsoid','kilometers','everest');
ellipsoid2 = almanac('earth','ellipsoid','kilometers','iau65');
See the reference page for the almanac function for more information on the
ellipsoids that are built into the toolbox. If you cannot find the ellipsoid vector
you need, you can create it in the following form:
ellipsoidvec = [semimajor_axis eccentricity]
3-10
3-11
Longitude is the angle at the center of the planet between two planes that
align with and intersect along the axis of rotation, perpendicular to the plane
of the equator. One plane passes through the surface point in question, and
the other plane is the prime meridian (0 longitude), which is defined by the
location of the Royal Observatory in Greenwich, England. Lines of constant
longitude are called meridians. All meridians converge at the north and south
poles (90N and -90S), and consequently longitude is under-specified in
those two places.
Longitudes typically range from -180 to +180, but other ranges can be used,
such as 0 to +360. Longitudes can also be specified as east of Greenwich
(positive) and west of Greenwich (negative). Adding or subtracting 360 from
its longitude does not alter the position of a point. The toolbox includes a set
of functions (wrapTo180, wrapTo360, wrapToPi, and wrapTo2Pi) that convert
longitudes from one range to another. It also provides unwrapMultipart,
which unwraps vectors of longitudes in radians by removing the artifical
3-12
discontinuities that result from forcing all values to lie within some 360-wide
interval.
3-13
3-14
The first three are angular quantities, while the last is a length. Mapping
Toolbox functions exist for computing these quantities. For more information,
see Directions and Areas on the Sphere and Spheroid on page 3-38 and also
Navigation on page 10-11 for additional examples.
There is no single default unit of distance measurement in the toolbox.
Navigation functions use nautical miles as a default, the almanac function
uses kilometers, and the distance function uses degrees of arc length. For
many functions, the default unit for distances and positions is degrees, but
you need to verify the default assumptions before using any of these functions.
Note When distances are given in terms of angular units (degrees or radians),
be careful to remember that these are specified in terms of arc length. While a
degree of latitude always subtends one degree of arc length, this is only true
for degrees of longitude along the equator.
3-15
3-16
km2nm, km2sm, nm2km, nm2sm, sm2km, and sm2nm perform simple and
convenient conversions between kilometers, nautical miles, and statute
miles.
These utility functions accept scalars, vectors, and matrices, or any shape. For
an overview of these functions and angle conversion functions, see Summary:
Available Distance and Angle Conversion Functions on page 3-26.
You can use the output from unitsratio as a multiplicative conversion factor.
1 For example, the following shows that 4 inches span just over 10
centimeters:
cmPerInch = unitsratio('cm','inch')
cm = cmPerInch * 4
3-17
cmPerInch =
2.5400
cm =
10.16
2 To convert this number of centimeters back to inches, type
3-18
two places are from one another in terms of the angle subtended along a
great-circle arc. On nonspherical reference bodies, distances are usually given
in linear units such as kilometers (because on them, arc lengths are no longer
proportional to subtended angle).
Likewise, you can perform the opposite conversion by applying the inverse
factor,
thetaInDegrees = thetaInRadians * (180/pi)
or by using radtodeg,
thetaInDegrees = radtodeg(thetaInRadians)
3-19
interval [0 60)
For example, -1 radians is represented by a minus sign (-) and the numbers
[57, 17.7468...]. (The fraction in the minutes part approximates an irrational
3-20
number and is rounded here for display purposes. This subtle point is
revisited in the following section.)
The toolbox includes the function degrees2dm to perform conversions of this
sort. You can use this function to export data in DM form, either for display
purposes or for use by another application. For example,
degrees2dm(radtodeg(-1))
ans =
-57.0000
17.7468
dm2degrees(degrees2dm(pi)) == pi
ans =
1
interval [0 60)
For example, -1 radians is represented by a minus sign (-) and the numbers
[57, 17, 44.8062...], which can be seen using Mapping Toolbox function
degrees2dms,
3-21
degrees2dms(radtodeg(-1))
ans =
-57.0000
17.0000
44.8062
three-column form, applying the sign to the first nonzero element in each row.
A fourth function, dms2degrees, is similar to dm2degrees and supports data
import by producing a real-valued column vector of degrees from an array
with an integer-valued degrees column, an integer-value minutes column, and
a real-valued seconds column. As noted, the four functions, degrees2dm,
degrees2dms, dm2degrees, and dms2degrees, are particular about the shape
of their inputs; in this regard they are distinct from the other angle-conversion
functions in the toolbox.
The toolbox makes no internal use of DM or DMS representation. The
conversion functions dm2degrees and dms2degrees are provided only as
tools for data import. Likewise, degrees2dm and degrees2dms are only
useful for displaying geographic coordinates on maps, publishing coordinate
values, and for formatting data to be exported to other applications. Methods
for accomplishing this are discussed below, in Formatting Latitudes and
Longitudes as Strings on page 3-28.
3-22
For example, you might wish to implement a very simple sinusoidal projection
on the unit sphere, but allow the input latitudes and longitudes to be in either
degrees or radians. You can accomplish this as follows:
function [x, y] = sinusoidal(lat, lon, angleunits)
[lat, lon] = toRadians(angleunits, lat, lon);
x = lon .* cos(lat);
y = lat;
3-23
could also call the same number a distance in earth radii. When you work
with transformations of geodata, keep this in mind.
You can easily convert that angle from radians to degrees. For example, you
can call distance to compute the distance in meters from London to Kuala
Lumpur:
latL = 51.5188;
lonL = -0.1300;
latK =
2.9519;
lonK = 101.8200;
earthRadiusInMeters = 6371000;
distInMeters = distance(latL, lonL,...
latK, lonK, earthRadiusInMeters)
distInMeters =
1.0571e+007
This really only makes sense and produces accurate results when we
approximate the Earth (or planet) as a sphere. On an ellipsoid, one can only
describe the distance along a geodesic curve using a unit of length.
Mapping Toolbox software includes a set of six functions to conveniently
convert distances along the surface of the Earth (or another planet) from
units of kilometers (km), nautical miles (nm), or statue miles (sm) to spherical
distances in degrees (deg) or radians (rad):
3-24
Because these conversion can be reversed, the toolbox includes another six
convenience functions that convert an angle subtended at the center of a
sphere, in degrees or radians, to a great-circle distance along the surface of
that sphere:
deg2km, deg2nm, and deg2sm go from angle in degrees to length
rad2km, rad2nm, and rad2sm go from angle in radians to length
When given a single input argument, all 12 functions assume a radius
of 6,371,000 meters (6371 km, 3440.065 nm, or 3958.748 sm), which is
widely-used as an estimate of the average radius of the Earth. An optional
second parameter can be used to specify a planetary radius (in output length
units) or the name of an object in the Solar System.
The Earth is the default assumption for these conversion functions. You can
use other radii, however:
nauticalmiles = deg2nm(1,almanac('moon','radius'))
3-25
nauticalmiles =
30.3338
The function deg2sm returns distances in statute, rather than nautical, miles:
deg2sm(1)
ans =
69.0932
By adding the optional units argument, you can use radians instead:
[rng, az] = distance(lat1, lon1, lat2, lon2, 'radians')
[latout, lonout] = reckon(lat, lon, rng, az, 'radians')
3-26
To Degrees
To Radians
To
Kilometers
To Nautical
Miles
To Statute
Miles
Degrees
toDegrees
fromDegrees
degtorad
toRadians
fromDegrees
deg2km
deg2nm
deg2sm
Radians
radtodeg
toDegrees
fromRadians
toRadians
fromRadians
rad2km
rad2nm
rad2sm
Kilometers
km2deg
km2rad
km2nm
km2sm
Nautical
Miles
nm2deg
nm2rad
nm2km
Statute
Miles
sm2deg
sm2rad
sm2km
nm2sm
sm2nm
3-27
in base 10. That is, a binary floating-point number is not a decimal number,
whether it represents an angle in degrees or not. If it does represent an angle
and that number is then formatted and displayed as having a fractional part,
only then is it appropriate to speak of decimal degrees. Likewise, the term
decimal minutes applies when you convert a degrees-minutes representation
to a string, as in
num2str(degrees2dm(radtodeg(1)))
ans =
57
17.7468
3-28
3-29
Projections on page 8-63 lists all the available map projections and their
intrinsic properties.
Projection Distortions
All map projections introduce distortions compared to maps on globes.
Distortions are inherent in flattening the sphere, and can take several forms:
Areas Relative size of objects (such as continents)
Distances Relative separations of points (such as a set of cities)
Directions Azimuths (angles between points and the poles)
Shapes Relative lengths and angles of intersection
Some classes of map projections maintain areas, and others preserve local
shapes, distances, and/or directions. No projection, however, can preserve
all these characteristics. Choosing a projection thus always requires
compromising accuracy in some way, and that is one reason why so many
different map projections have been developed. For any given projection,
3-30
however, the smaller the area being mapped, the less distortion it introduces
if properly centered. Mapping Toolbox tools help you to quantify and visualize
projection distortions.
3-31
Great Circles
In plane geometry, lines have two important characteristics. A line represents
the shortest path between two points, and the slope of such a line is constant.
When describing lines on the surface of a spheroid, however, only one of these
characteristics can be guaranteed at a time.
A great circle is the shortest path between two points along the surface of
a sphere. The precise definition of a great circle is the intersection of the
surface with a plane passing through the center of the planet. Thus, great
circles always bisect the sphere. The equator and all meridians are great
circles. All great circles other than these do not have a constant azimuth, the
spherical analog of slope; they cross successive meridians at different angles.
That great circles are the shortest path between points is not always apparent
from maps, because very few map projections (the Gnomonic is one of them)
represent arbitrary great circles as straight lines.
Because they define paths that minimize distance between two (or three)
points, great circles are examples of geodesics. In general, a geodesic is the
straightest possible path constrained to lie on a curved surface, independent
of the choice of a coordinate system. The term comes from the Greek geo-,
earth, plus daiesthai, to divide, which is also the root word of geodesy, the
science of describing the size and shape of the Earth mathematically.
Rhumb Lines
A rhumb line is a curve that crosses each meridian at the same angle. This
curve is also referred to as a loxodrome (from the Greek loxos, slanted, and
drome, path). Although a great circle is a shortest path, it is difficult to
navigate because your bearing (or azimuth) continuously changes as you
3-32
Great Circle
(shortest distance)
Rhumb Line
(constant azimuth)
Small Circles
In addition to rhumb lines and great circles, one other smooth curve is
significant in geography, the small circle. Parallels of latitude are all small
circles (which also happen to be rhumb lines). The general definition of
a small circle is the intersection of a plane with the surface of a sphere.
On ellipsoids, this only yields true small circles when the defining plane is
parallel to the equator. Mapping Toolbox software extends this definition to
3-33
include planes passing through the center of the planet, so the set of all small
circles includes all great circles as limiting cases. This usage is not universal.
Small circles are most easily defined by distance from a point. All points 45
nm (nautical miles) distant from (45N,60E) would be the description of one
small circle. If degrees of arc length are used as a distance measurement,
then (on a sphere) a great circle is the set of all points 90 distant from a
particular center point.
For true small circles, the distance must be defined in a great circle sense, the
shortest distance between two points on the surface of a sphere. However,
Mapping Toolbox functions also can calculate loxodromic small circles, for
which distances are measured in a rhumb line sense (along lines of constant
azimuth). Do not confuse such figures with true small circles.
To get the small circle centered at the same point that passes through the
point (55N,135W), use scircle2:
[latc,lonc] = scircle2(67,-135,55,-135);
3-34
scircle1
scircle2
Perimeter
point
Radius
Center point
Center point
Output points
The scircle1 function also allows you to calculate points along a specific
arc of the small circle. For example, if you want to know the points 10 in
distance and between 30 and 120 in azimuth from (67N,135W), simply
provide arc limits:
[latc,lonc] = scircle1(67,-154,10,[30 120]);
scircle1 with arc limits
Points outside
arc limits are
not returned.
Center
point
Azimuth1 = 30o
Points within
arc limits
are returned.
Radius
Azimuth2 = 120o
When an entire small circle is calculated, the data is in polygon format. For
all calculated small circles, 100 points are returned unless otherwise specified.
You can calculate several small circles at once by providing vector inputs. For
more information, see the scircle1 and scircle2 function reference pages.
3-35
3-36
3-37
About Azimuths
Azimuth is the angle a line makes with a meridian, measured clockwise from
north. Thus the azimuth of due north is 0, due east is 90, due south is 180,
and due west is 270. You can instruct several Mapping Toolbox functions to
compute azimuths for any pair of point locations, either along rhumb lines
or along great circles. These will have different results except along cardinal
directions. For great circles, the result is the azimuth at the initial point of
the pair defining a great circle path. This is because great circle azimuths
other than 0, 90, 180, and 270 do not remain constant. Azimuths for rhumb
lines are constant along their entire path (by definition).
For rhumb lines, computing an azimuth backward (from the second point to
the first) yields the complement of the forward azimuth ((Az + 180) mod
360). For great circles, the back azimuth is generally not the complement,
and the difference depends on the distance between the two points.
In addition to forward and back azimuths, Mapping Toolbox functions can
compute locations of points a given distance and azimuth from a reference
point, and can calculate tracks to connect waypoints, along either great circles
or rhumb lines on a sphere or ellipsoid.
3-38
Notice that the distance, 200 nautical miles, must be converted to degrees of
arc length with the nm2deg conversion function to match the latitude and
longitude inputs. If the airplane had a flight computer that allowed it to
follow an exact great circle path, what would the aircrafts new location be?
[gclat,gclong] = reckon('gc',40.75,-73.9,nm2deg(200),315)
gclat =
43.0615
gclong =
-77.1238
Notice also that for short distances at these latitudes, the result hardly differs
between great circle and rhumb line. The two destination points are less than
4 nautical miles apart. Incidentally, after 1 hour, the airplane would be just
north of New Yorks Finger Lakes.
For the great circle from (31S, 90E) to (23S, 110E), use track2:
[latgc,longc] = track2('gc',-31,90,-23,110);
3-39
track1
track2
Output points
Final point
Initial point
Azimuth and range
Initial point
Output points
The track1 function also allows you to specify range endpoints. For example,
if you want points along a rhumb line starting 5 away from the initial point
and ending 13 away, at an azimuth of 55, simply specify the range limits:
[latrh,lonrh] = track1('rh',-31,90,55,[5 13]);
s
oint
tp
utpu
Azimuth
Initial
point
Range1
Range2
3-40
information, see the track1 and track2 reference pages. More vector path
calculations are described later in Navigation on page 10-11.
To determine how much longer the rhumb line path is in, say, kilometers, you
can use a distance conversion function on the difference:
kmdifference = deg2km(distrh-distgc)
kmdifference =
1.6744e+03
3-41
One feature of rhumb lines is that the inverse azimuth, from the second point
to the first, is the complement of the forward azimuth and can be calculated
by simply adding 180 to the forward value:
inverserh = azimuth('rh',60,150,-15,0)
inverserh =
238.8595
difference = inverserh-azrh
difference =
180
3-42
inversegc = azimuth('gc',60,150,-15,0)
inversegc =
320.9353
difference = inversegc-azgc
difference =
301.8962
0 or 360
Northeast
45
East
90
Southeast
135
South
180
Southwest
225
West
270
Northwest
315
Elevation is the angle above the local horizontal of one point relative to the
other. To compute the elevation angle of a second point as viewed from the
first, provide the position and altitude of the points. The default units are
degrees for latitudes and longitudes and meters for altitudes, but you can
specify other units for each. What are the elevation, slant range, and azimuth
of a point 10 kilometers east and 10 kilometers above a surface point?
[elevang,slantrange,azim] = elevation(0,0,0,0,km2deg(10),10000)
elevang =
44.901
slantrange =
14156
azim =
3-43
90
Quadrangle
Zone
Lune
3-44
That is, less than 2% of the planets surface area is in this quadrangle. To
get an absolute figure in, for example, square miles, you must provide the
appropriate spherical radius. The radius of the Earth is about 3958.9 miles:
area = areaquad(15,0,45,30,3958.9)
area =
3.6788e+06
The surface area within this quadrangle is over 3.6 million square miles for a
spherical Earth.
3-45
0.08
almanac('mars','ellipsoid','kilometers')
ans =
3396.90
0.11
almanac('moon','ellipsoid','statutemiles')
ans =
1079.97
3-46
For a complete description of available data, see the almanac reference page.
3-47
3-48
4
Creating and Viewing Maps
Introduction to Mapping Graphics on page 4-2
Using worldmap and usamap on page 4-4
Axes for Drawing Maps on page 4-12
Controlling Map Frames and Grids on page 4-46
Displaying Vector Data with Mapping Toolbox Functions on page 4-58
Displaying Data Grids on page 4-68
Interacting with Displayed Maps on page 4-76
4-2
Note In its current implementation, the toolbox maintains the map projection
and display properties by storing special data in the UserData property of
the map axes. The toolbox also takes over the UserData property of mapped
objects. Therefore, never attempt to set the UserData property of a map axes
or a projected map object. Do not apply the MATLAB get function to axes
UserData, depend on the contents of UserData in any way, or apply functions
that set or get UserData to the handles of map axes or mapped objects. Only
use the Mapping Toolbox functions getm and setm to obtain and modify map
axes properties.
4-3
4-4
If you want all figures in a session to have white backgrounds, set this as a
default with the command
set(0, 'DefaultFigureColor', 'white');
To avoid having to do this every time you start MATLAB, place this command
in your startup.m file.
You can also use the Property Editor, part of the MATLAB plotting tools,
to modify background colors for figures and axes. See Plotting Tools
Interactive Plotting in the MATLAB Graphics documentation for more
information.
Using worldmap
Here are two examples that create simple maps using sample data sets from
matlabroot/toolbox/map/mapdemos. The first one creates a map of South
America with land areas, major lakes and rivers, and populated places.
1 First, set up the map frame, allowing worldmap to pick a projection:
figure
worldmap 'south america'
axis off
4-5
80 W
60 W
40 W
20 S
40 S
60 S
2 You can find out what map projection worldmap selected this way:
getm(gca,'MapProjection')
ans =
eqdconic
4-6
Using usamap
The usamap function allows you to make maps of the United States as a whole,
just the conterminous portion (the lower 48 states), groups of states or a
single state. The easiest way to use it is to type
usamap
4-7
at the MATLAB prompt. This opens a GUI with a list box from which you can
select the entire U.S., the conterminous states, or an individual state to map.
The map axes you create with usamap has a labelled grid fitted around the
area you specify, but contains no data, allowing you to generate the kind of
map you want using display functions such as geoshow.
This example creates a map of the Chesapeake Bay region by specifying
geographic limits.
1 First, specify limits and set up a map axes object:
latlim = [ 37 40];
lonlim = [-78 -74];
figure
ax = usamap(latlim,lonlim);
axis off
4-8
40 N
39 N
38 N
37 N
78 W
77 W
76 W
75 W
74 W
The Lambert Conformal Conic Projection is often used for maps of the
conterminous United States.
2 Here is the map projection usamap selected:
getm(gca,'MapProjection')
ans =
lambert
3 Next, use shaperead to read U.S. state polygon boundaries from the
4-9
faceColors = makesymbolspec('Polygon',...
{'INDEX', [1 numel(states)], ...
'FaceColor', polcmap(numel(states))});
5 Display the filled polygons with geoshow:
4-10
40 N
39 N
Maryland
District of Columbia
Chesapeake Bay
38 N
37 N
78 W
Delaware
77 W
76 W
75 W
74 W
Note that as polcmap assigns random pastel colors to patches, your map
might display different colors than this example. For further information on
options for these functions, see the reference pages for geoshow, shaperead,
worldmap, and usamap.
4-11
The axesm function without arguments brings up a UI that lists all supported
projections and assists in defining their parameters. You can also summon
this UI with the axesmui function once you have created a map axes.
You can also list all the names, classes, and ID strings of Mapping Toolbox
map projections with the maps function.
4-12
Axes created with axesm share all properties associated with regular axes,
and have additional properties related to projections, scale, and positioning
in geographic coordinates. See the axes and axesm reference pages for lists
of properties.
You can place many types of objects in a map axes, such as lines, patches,
markers, scale rulers, north arrows, grids, and text. You can use the handlem
function and its associated UI to list these objects and obtain handles to them.
See the handlem reference page for a list of the objects that can occupy a
map axes and how to query for them.
Map axes objects created by axesm contain projection information in a
structure. For an example of what these properties are, type
h = axesm('MapProjection','mercator')
and then use the getm function to retrieve all the map axes properties:
p = getm(h)
For complete descriptions of all map axes properties, see the axesm reference
page. For more information on the use of axesmui, refer to the axesm,
axesmui reference page.
Using axesm
The figure window created using axesm contains the same set of tools and
menus as any MATLAB figure, and is by default blank, even if there is map
data in your workspace. You can toggle certain properties, such as grids,
frames, and axis labels, by right-clicking in the figure window to obtain
a pop-up menu.
You can define multiple independent figures containing map axes, but only
one can be active at any one time. Return handles for them when you create
them to allow them to be referenced when they are no longer current. Use
axes(handle) to activate an existing map axes object.
4-13
axesm('MapProjection','miller','Frame','on')
getm(gca,'FLineWidth')
ans =
2
3 Now reset the line width to four points. The default fontunits value for
4-14
getm(gca,'MapProjection')
ans =
eqdcylin
5 To inspect the entire set of map axes properties at their current settings,
'eqdcylin'
[]
'degrees'
'normal'
[]
[]
[]
[1 0]
[-90 90]
[-180 180]
30
1
[0 0 0]
[]
[-90 90]
[-180 180]
'on'
100
[0 0 0]
'none'
[-90 90]
3
[-180 180]
'off'
Inf
[0 0 0]
':'
0.5000
[]
100
[]
4-15
mlinelocation:
mlinevisible:
plineexception:
plinefill:
plinelimit:
plinelocation:
plinevisible:
fontangle:
fontcolor:
fontname:
fontsize:
fontunits:
fontweight:
labelformat:
labelunits:
meridianlabel:
mlabellocation:
mlabelparallel:
mlabelround:
parallellabel:
plabellocation:
plabelmeridian:
plabelround:
30
'on'
[]
100
[]
15
'on'
'normal'
[0 0 0]
'helvetica'
9
'points'
'normal'
'compass'
'degrees'
'off'
30
90
0
'off'
15
-180
0
Note that the list of properties includes both those particular to map axes
and general ones that apply to all MATLAB axes.
6 Similarly, use the setm function alone to display the set of properties, their
4-16
[ {degrees} | radians ]
[ {normal} | transverse ]
MapProjection
NParallels
Origin
ScaleFactor
TrimLat
TrimLon
Zone
Frame
FEdgeColor
FFaceColor
FFill
FLatLimit
FLineWidth
FLonLimit
Grid
GAltitude
GColor
GLineStyle
GLineWidth
MLineException
MLineFill
MLineLimit
MLineLocation
MLineVisible
PLineException
PLineFill
PLineLimit
PLineLocation
PLineVisible
FontAngle
FontColor
FontName
FontSize
FontUnits
{points} | pixels ]
FontWeight
LabelFormat
LabelRotation
LabelUnits
MeridianLabel
[ on | {off} ]
[ - | -- | -. | {:} ]
[ {on} | off ]
[ {on} | off ]
[ {normal} | italic | oblique ]
{normal} | bold ]
{compass} | signed | none ]
on | {off} ]
{degrees} | radians ]
on | {off} ]
4-17
MLabelLocation
MLabelParallel
MLabelRound
ParallelLabel
PLabelLocation
PLabelMeridian
PLabelRound
[ on | {off} ]
Many, but not all, property choices and defaults can also be displayed
individually:
setm(gca,'AngleUnits')
AngleUnits
[ {degrees} | radians ]
setm(gca,'MapProjection')
An axes's "MapProjection" property does not have a fixed set
of property values.
setm(gca,'Frame')
Frame
[ on | {off} ]
setm(gca,'FixedOrient')
FixedOrient
FixedOrient is a read-only property
7 In the same way, getm displays the current value of any axes property:
getm(gca,'AngleUnits')
ans =
degrees
getm(gca,'MapProjection')
ans =
eqdconic
getm(gca,'Frame')
ans =
on
getm(gca,'FixedOrient')
ans =
[]
4-18
For a complete listing and descriptions of map axes properties, see the
reference page for axesm. To identify what properties apply to a given map
projection, see the reference page for that projection.
4-19
plotm(coast.lat,coast.long)
Note The western limit (100 degrees E, in this case) must always precede the
eastern limit (-120 degrees E, or 120 degrees W), even if the second number in
the longitude-limit vector is smaller than the first.
Note that the map spans 140 degrees from west to east:
wrapTo360(diff(lonlim))
ans =
140
axesm automatically sets the Origin and frame limits based on the values
you selected for MapLatLim and MapLonLim. You can check the Origin and
frame limits by using getm.
origin = getm(gca,'Origin');
flatlim = getm(gca,'FLatLimit');
flonlim = getm(gca,'FLonLimit');
4-20
The origin longitude should be located halfway between the longitude limits of
100 E and 120 W. Adding half of 140 to the western limit gives 100 + 70 = 170
degrees E. This should, and does, equal the second element of the origin vector:
origin(2)
ans =
170
70
The story with latitudes is somewhat simpler; the origin latitude is on the
Equator:
origin(1)
ans =
0
and therefore the latitude limits of the frame equal the value supplied for
MapLatLimit:
flatlim
flatlim =
-80
80
Of course, after youve called axesm, you may look at your map and decide that
youre not completely satisfied with your initial choice of map limits. Suppose
that you decide it would be better to shift the western longitude limit to 40
degrees E in order to include a little more of Asia. You can do this by calling
setm with a new MapLonLimit value:
setm(gca,'MapLonLimit',[40 -120])
but the asymmetric appearance of the resulting map may surprise you.
4-21
You might have expected to see a symmetric map just like the one you would
get if you replaced lonlim in the earlier call to axesm with [40 -120], but
thats not what happened. This apparent inconsistency turns out to be an
important consequence of the fact that MapLatLimit and MapLonLimit are
redundant properties.
Before you call axesm, none of the map axes properties have been set yet
because the map axes doesnt exist. Therefore, theres no value yet for the
Origin property, and theres no problem in setting the longitude origin
halfway between the longitudes specified in the MapLonLimit vector. But once
axesm has been called, your map axes does have a projection origin. Since the
projection origin is such a fundamental property, it takes precedence over
the MapLonLimit property.
Therefore, if you try to reset your longitude limits without also resetting the
origin, setm will maintain your current origin. So, the center of the map
limits moved west, but the origin stayed fixed. This combination caused the
asymmetry.
4-22
To avoid this asymmetry, you can repeat the operations shown above to figure
out that the new central longitude must be at 140 degrees E and add this
in the call to setm like this:
setm(gca,'MapLonLimit',[40 -120],'Origin',[0 140])
Notice the symmetry of the resulting map frame. Usually this is the easiest
thing to do.
4-23
4-24
120.00
-86.00
86.00
-180.00
180.00
ans =
Note that the map and frame limits are clamped to the range of [-86 86]
imposed by the read-only TrimLat property.
getm(gca,'MapLatLimit')
getm(gca,'FLatLimit')
getm(gca,'TrimLat')
ans =
-86.00
86.00
-86.00
86.00
-86.00
86.00
ans =
ans =
4-25
4-26
4-27
4-28
4-29
4-30
4-31
figure('Color','w')
axesm('mercator','Origin',[midLat midLon 90-midAz], ...
'FLatLimit',buf,'FLonLimit',[-dist/2 dist/2] + buf)
axis off; framem on; gridm on; tightmap
geoshow(coast.lat,coast.long,'DisplayType','polygon')
plotm([latTokyo latNewYork],[lonTokyo lonNewYork],'r-')
4-32
You want to change your projections default aspect (normal vs. transverse).
You want to to use a nonzero origin latitude, except in one of the special
cases noted above.
You are using one of the following projections:
4-33
setm(gca,'Origin',[],'MapLatLimit',newMapLatlim,'MapLonLimit',newMapLonli
On the other hand, a call like this will automatically update the values of
FLatLimit and FLonLimit. Similarly, a call like:
setm(gca,'FLatLimit',newFrameLatlim,'FLonLimit',newFrameLonlim)
because the value of FLonLimit (unlike MapLonLimit) will not affect Origin,
which will merely change to a projection-dependent default value (typically
[0 0 0]).
4-34
When you switch from one projection to another, setm clears out settings that
were specific to the earlier projection, updates the map frame and graticule,
and generally keeps the map covering the same part of the worldeven when
switching between azimuthal and non-azimuthal projections. But in some
cases, you might need to further adjust the map axes properties to achieve
proper appearance. Settings that are suitable for one projection might not be
appropriate for another. Most often, youll need to update the positioning of
your meridian and parallel labels.
1 Create a Mercator projection with meridian and parallel labels.
axesm mercator
framem on; gridm on; mlabel on; plabel on
setm(gca,'LabelFormat','signed')
axis off
180
150
120 90 60 30 0+ 30+ 60+ 90+120
+150
+180
+75
+60
+45
+30
+15
0
15
30
45
60
75
2 Get the default map and frame latitude limits for the Mercator projection.
4-35
[getm(gca,'MapLatLimit'); getm(gca,'FLatLimit')]
ans =
-86
86
-86
86
Both the frame and map latitude limits are set to 86 north and south for
the Mercator projection to maintain a safe distance from the singularity
at the poles.
3 Now switch the projection to an orthographic azimuthal.
setm(gca,'MapProjection','ortho')
4 Manually specify new locations for the meridian and parallel labels. (See
4-36
+75
+90
+60
+45
+30
+15
0 60
90
30
+ 30
+ 60+ 90
15
30
45
60
75
90
4-37
when you use setm to modify the MapProjection property, or any other map
axes property from the following list:
AngleUnits
Aspect
FalseEasting
FalseNorthing
FLatLimit
FLonLimit
Geoid
MapLatLimit
MapLonLimit
MapParallels
Origin
ScaleFactor
TrimLat
TrimLon
Zone
Auto-reprojection takes place for objects created with any of the following
Mapping Toolbox functions:
contourm
contour3m
fillm
fill3m
gridm
linem
meshm
4-38
patchm
plotm
plot3m
surfm
surfacem
textm
In general, objects created with geoshow or with a combination of calls to
mfwdtran followed by ordinary MATLAB graphics functions, such as line,
patch, or surface, are not automatically reprojected. You should delete such
objects whenever you change one or more of the map axes properties listed
above, and then redisplay them.
The above Mapping Toolbox functions are analogous to standard MATLAB
graphics functions having the same name, less the trailing m. You can use
both types of functions to plot data on a map axes, as long as you are aware
that the standard MATLAB graphics functions do not apply map projection
transformations, and therefore require you to specify positions in map x-y
space.
If you have preprojected vector or raster map data or read such data from files,
you can display it with mapshow, mapview, or standard MATLAB graphics
functions, such as plot or mesh. If its projection is known and is included
in the Mapping Toolbox projection libraries, you can use its parameters to
project geodata in geographic coordinates to display it in the same axes. For
additional information, see Using Cartesian MATLAB Display Functions
on page 6-28.
There are four common use cases for changing a map projection in a map axes
with setm or for reprojecting map data plotted on a regular MATLAB axes:
4-39
Type of
Axes
Reprojection Behavior
Plot geographic
(latitude-longitude) vector
coordinate data or data grid
using a Mapping Toolbox
function from releases prior
to Version 2 (e.g., plotm)
Map axes
Automatic reprojection
Map axes
No automatic reprojection;
delete graphics objects prior
to changing the projection and
redraw them afterwards.
Map axes
Regular
axes
Manual reprojection
(reproject coordinates with
minvtran /mfwdtran or
projinv/projfwd); delete
graphics objects prior to
changing the projection and
redraw them afterwards.
You can use handlem to help identify which objects to delete when manual
deletion is necessary. See Determining and Manipulating Object Names
on page 4-82 for an example of its use. The following section describes
reprojection behavior in more detail and illustrates some of these cases.
4-40
setm(gca,'mapprojection','mollweid')
4-41
Vector Data. Obtain handles to the line or patch graphic objects, delete
the objects from the axes, change the projection using setm, and replot the
vector data using geoshow:
figure; axesm miller
h = geoshow('landareas.shp')
delete(h)
setm(gca,'mapprojection','ortho')
geoshow('landareas.shp')
4-42
axesm miller; framem on; gridm on; mlabel on; plabel on;
showaxes; grid off;
4-43
These function calls create a map axes object, a map frame enclosing
the region of interest, and geographic grid lines. The x-y axes, which
are normally hidden, are displayed, and the axes x-y grid is turned off.
The Mapping Toolbox function gridm constructs lines to illustrate the
latitude-longitude grid, unlike the MATLAB function grid, which draws
an x-y grid for the underlying projected map coordinates. Depending on
the type of projection, a latitiude-longitude grid (or graticule) can contain
curves while a MATLAB grid never does. For more information about
graticules, see The Map Grid on page 4-53.
2 Now place a standard MATLAB text object and a mapped text object, using
In the figure, shown below, a standard text object is placed at x=-2 and
y=-1, while a mapped text object is placed at (70N,150W) in the Miller
projection.
3 Now change the projection to sinusoidal. The standard text object remains
4-44
The mapped text object remains at the same geographic location, so its
x-y position is altered. Also, the frame and grid lines reflect the new map
projection:
setm(gca,'MapProjection','sinusoid')
showaxes; grid off; mlabel off
Similarly, vector and matrix data can be displayed using either mapping or
standard functions (e.g., plot/plotm, surf/surfm). See Displaying Vector
Data with Mapping Toolbox Functions on page 4-58 for information on
plotting vector geodata, and Displaying Data Grids on page 4-68 for
information on plotting raster geodata.
4-45
Equidistant cylindrical
projection
Robinson
projection
Sinusoidal
projection
Orthographic
projection
4-46
FLonLimit is [-180 180] for each case. The frame quadrangle can encompass
smaller regions, as well, in which case the shape is a section of a full-world
outline or simply a quadrilateral with straight or curving sides. Execute this
code to produce the figure that follows:
4-47
% Plot four regions of Robinson frame and grid using map limits
%
figure('color','white')
% Default map frame
subplot(2,2,1);
axesm('MapProjection','robinson',...
'Frame','on','Grid','on')
title('Latitude [-90 90], Map lons [-180 180]','FontSize',10)
%
subplot(2,2,2);
axesm('MapProjection','robinson',...
'MapLatLimit',[30 70],'MapLonLimit',[-90 90],...
'Frame','on','Grid','on')
title('Latitude [30 70], Longitude [-90 90]','FontSize',10)
%
subplot(2,2,3);
axesm('MapProjection','robinson',...
'MapLatLimit',[-90 0],'MapLonLimit',[-180 -30],....
'Frame','on','Grid','on')
title('Latitude [-90 0], Longitude [-180 -30]','FontSize',10)
%
subplot(2,2,4);
axesm('MapProjection','robinson',...
'MapLatLimit',[-70 -30],'MapLonLimit',[60 150],...
'Frame','on','Grid','on')
title('Latitude [-70 -30], Longitude [60 150]','FontSize',10)
4-48
For the frames shown above, the projection is centered on the prime meridian,
or 0 longitude. Such a frame would be the result of creating a map axes with
the defaults for the Robinson projection and then resetting the frame limits to
cover just part of the world.
When you want your frame to be symmetric about the region of interest, let
axesm determine the proper settings for you. If you specify the map limits
without specifying the map origin and frame limits, axesm will automatically
set the appropriate values for a proper symmetric frame.
4-49
In the following example, the axes limits are set using setm after the Robinson
map axes is created. Note that map axes properties that concern frames begin
with F:
% Same regions as above, but with frame limits
%
altered after projecting
%
figure('color','white')
% Default frame limits
h11 = subplot(2,2,1);
axesm('MapProjection','robinson',...
'Frame','on','Grid','on')
title('Latitude [-90 90], Longitude [-180 180]')
%
h12 = subplot(2,2,2);
axesm('MapProjection','robinson',...
'Frame','on','Grid','on')
setm(h12,'FLatLimit',[30 70],'FLonLimit',[-90 90])
title('Latitude [30 70], Longitude [-90 90]')
%
h21 = subplot(2,2,3);
axesm('MapProjection','robinson',...
'Frame','on','Grid','on')
setm(h21,'FLatLimit',[-90 0],'FLonLimit',[-180 -30])
title('Latitude [-90 0], Longitude [-180 -30]')
%
h22 = subplot(2,2,4);
axesm('MapProjection','robinson',...
'Frame','on','Grid','on')
setm(h22,'FLatLimit',[-70 -30],'FLonLimit',[60 150])
title('Latitude [-70 -30], Longitude [60 150]')
4-50
The differences between the two examples are obvious when projections are
not centered on the prime meridian. If you wanted to create a symmetric
frame in the lower right subplot of the above figure, reset the map limits
instead of the frame limits, but be sure to reset the 'Origin' property in
the same call:
setm(h22,'MapLonLimit',[60 150],'Origin',[])
You can manipulate properties beyond the latitude and longitude limits of
the frame. Frame properties are established upon map axes object creation;
you can modify them subsequently with the setm and the framem functions.
The command framem alone is a toggle for the Frame property, which controls
4-51
the visibility of the frame. You can also call framem with property names and
values to alter the appearance of the frame:
framem('FlineWidth',4,'FEdgeColor','red')
The frame is actually a patch with a default face color set to 'none' and
a default edge color of black. You can alter these map axes properties by
manipulating the FFaceColor and FEdgeColor properties. For example, the
command
setm(gca,'FFaceColor','cyan')
makes the background region of your display resemble water. Since the frame
patch is always the lowest layer of a map display, other patches, perhaps
representing land, will appear above the water. If an object is subsequently
plotted below the frame patch, the frame altitude can be recalculated to lie
below this object with the command framem reset. The frame is replaced
and not reprojected.
Set the line width of the edge, which is 2 points by default, using the
FLineWidth property.
The primary advantage of displaying the map frame is that it can provide
positional context for other displayed map objects. For example, when vector
data of the coasts is displayed, the frame provides the edge of the world.
See the framem reference page for more details.
4-52
Grid Spacing
To control display of meridians and parallels, set a scalar meridian spacing or
a vector of desired meridians in the MLineLocation property. The property
PLineLocation serves a corresponding purpose for parallels. The default
values place grid lines every 30 for meridians and every 15 for parallels.
4-53
Grid Layering
By default, the grid is placed as the top layer of any display. You can alter
this by changing the GAltitude property, so that other map objects can be
placed above the grid. The new grid is drawn at its new altitude. The units
used for GAltitude are specified with the daspectm function.
To reposition the grid back to the top of the display, use the command gridm
reset. You can also control the appearance of grid lines with the GLineStyle
and GLineWidth properties, which are ':' and 0.5, respectively, by default.
4-54
4-55
Labeling Grids
You can label displayed parallels and meridians. MeridianLabel and
ParallelLabel are on-off properties for displaying labels on the meridians
and parallels, respectively. They are both 'off' by default. Initially, the label
locations coincide with the default displayed grid lines, but you can alter this
by using the PlabelLocation and MlabelLocation properties. These grid
lines are labeled across the north edge of the map for meridians and along the
west edge of the map for parallels. However, the property MlabelParallel
allows you to specify 'north', 'south', 'equator', or a specific latitude at
which to display the meridian labels, and PlabelMeridian allows the choice
of 'west', 'east', 'prime', or a specific longitude for the parallel labels.
By default, parallel labels are displayed in the range of 0 to 90 north and
south of the equator while meridian labels are displayed in the range of 0 to
4-56
180 east and west of the prime meridian. You can use the mlabelzero22pi
function to redisplay the meridian labels in the range of 0 to 360 east of
the prime meridian.
Properties affecting grid labeling are listed below.
Property
Effect
MeridianLabel
ParallelLabel
MlabelLocation
PlabelLocation
MlabelParallel
PlabelMeridian
mlabelzero22pi(function)
For complete descriptions of all map axes properties, refer to the axesm
reference page.
4-57
4-58
Function
Used For
contourm
contour3m
geoshow
Function
Used For
linem
mapshow
plotm
plot3m
load coast
axesm mollweid
framem('FEdgeColor','blue','FLineWidth',0.5)
2 Plot the coast vector data using plotm. Just as with plot, you can specify
4-59
display calculated vector data. Calculate and plot a great circle track from
Cairo to Rio de Janeiro, and a rhumb line track from Cairo to Perth:
[gclat,gclong] = track2('gc',citylats(1),citylongs(1),...
citylats(2),citylongs(2));
[rhlat,rhlong] = track2('rh',citylats(1),citylongs(1),...
citylats(3),citylongs(3));
plotm(gclat,gclong,'m-'); plotm(rhlat,rhlong,'m-')
4-60
Note You can also use geoshow (for data in geographic coordinates) or
mapshow (for data in projected coordinates) to create such maps, either in
a map axes or in a regular axes. Both functions accept either vectors of
coordinates or geographic data structures as input data.
For more information, see Mapping Toolbox Geographic Data Structures
on page 2-16, which includes examples of creating geostructs and displaying
their contents in How to Construct Geostructs and Mapstructs on page 2-20.
statelat
statelon
uslat
uslon
load conus
4-61
The variables uslat and uslon together describe three polygons (separated
by NaNs), the largest of which represents the outline of the conterminous
United States. The two smaller polygons represent Long Island, NY, and
Marthas Vineyard, an island off Massachusetts. The variables gtlakelat
and gtlakelon describe three polygons (separated by NaNs) for the Great
Lakes. The variables statelat and statelon contain line-segment data
(separated by NaNs) for the borders between states, which is not formatted
for patch display.
2 Verify that line and polygon data contains NaNs (hence multiple objects) by
The find command returns three values indicating that the gtlakelon
(or gtlakelat) geographic coordinate arrays contain three polygons
representing one or a group of Great Lakes.
3 Read the worldrivers shapefile for the region that covers the conterminous
49.3800
-66.9700
4-62
that the Geometry field specifies whether the data is stored as a 'Point',
'MultiPoint', 'Line', or a 'Polygon:
rivers(1).Geometry
ans =
Line
projections are appropriate for mapping the entire United States, create a
map axes object using an Albers equal-area conic projection ('eqaconic').
Specifying map limits that contain the region of interest automatically
centers the projection on an appropriate longitude; the frame encloses just
the mapping area, not the entire globe. As a general rule, you should
specify map limits that extend slightly outside your area of interest
(worldmap and usamap do this for you).
Note Conic projections need two standard parallels (latitudes at which
scale distortion is zero). A good rule is to set the standard parallels at
one-sixth of the way from both latitude extremes. Or, to use default
latitudes for the standard parallels, simply provide an empty matrix in
the call to axesm.
The three options that follow demonstrate how you can set map latitude
and longitude limits to axesm:
4-63
parallels:
figure
axesm('MapProjection','eqaconic', 'MapParallels',[],...
'MapLatLimit',[23 52], 'MapLonLimit',[-130 -62])
b If you do not know what latitude and longitude limits are appropriate
for your map, as a starting point you could use the exact ones that the
geostruct contains. Using them eliminates white space around the map:
axesm('MapProjection','eqaconic', 'MapParallels',[],...
'MapLatLimit',uslatlim, 'MapLonLimit',uslonlim)
c If you want to add white space around the map, you can do so as follows
7 When geographic data is displayed, some layers can hide others. You can
control the visibility of your map layers by varying the order in which you
4-64
display them. For example, some U.S. state boundaries follow major rivers,
so display the rivers last to avoid obscuring the rivers with the boundaries.
The coordinate array pairs (uslat, uslon), (gtlakelat, gtlakelon), and
(statelat, statelon) simply contain sequences of NaN-separated map
segments, and their geometric interpretation is ambiguous. In order to
display them appropriately as either patches or lines with geoshow, you
need to use the DisplayType parameter. In contrast, DisplayType is not
needed when you map data from a geostruct like rivers.
a Plot a patch to display the area occupied by the conterminous United
geoshow(uslat,uslon, 'DisplayType','polygon','FaceColor',...
[1 .5 .3], 'EdgeColor','none')
b Plot the Great Lakes on top of the land area, using geoshow again:
geoshow(gtlakelat,gtlakelon, 'DisplayType','polygon',...
'FaceColor','cyan', 'EdgeColor','none')
c Plot the line segment data showing state boundaries, using geoshow
geoshow(statelat,statelon,'DisplayType','line','Color','k')
d Finally, use geoshow to plot the river network. Note that you can omit
DisplayType:
4-65
Used For
fillm
fill3m
geoshow
mapshow
patchm
patchesm
The fillm function makes use of the low-level function patchm. The toolbox
provides another patch drawing function called patchesm. The optimal use of
either depends on the application and user preferences. The patchm function
creates one displayed object and returns one handle for a patch, which can
contain multiple faces that do not necessarily connect. Mapping Toolbox data
arrays contain NaNs to separate unconnected patch faces, unlike MATLAB
patch display functions, which cannot handle NaN-delimited data for patches.
The patchesm function, on the other hand, treats each face as a separate
object and returns an array containing a handle for each patch. In general,
patchm requires more memory but is faster than patchesm. The patchesm
4-66
4-67
4-68
The following table lists the available Mapping Toolbox surface map display
functions.
Function
Used For
geoshow
mapshow
meshm
surfm
pcolorm
surfacem
surflm
meshlsrm
surflsrm
4-69
4-70
Notice that for this coarse graticule, the edges of the map do not appear as
smooth curves. Previous displays used the default [50 100] graticule, for
which this effect is negligible.
Regardless of the graticule resolution, the grid data is unchanged. In this
case, the data grid is the 180-by-360 topo matrix, and regardless of where it
is positioned, the data values are unchanged.
Map objects displayed as surfaces have all the properties of any MATLAB
surface, which can be set at object creation or by using the MATLAB set
function. The toolbox setm function allows the MeshGrat graticule property
to be changed after a regular data grid has been displayed. Since you saved
the handle of the last displayed map, reset its graticule to a very fine grid.
Because making the mesh more precise is a trade-off of resolution versus
time and memory, doing this takes longer, and requires more memory, to
display the map:
setm(h,'MeshGrat',[200 400])
Another way you can reset a graticule is with the meshgrat function:
[latgrat,longrat] = meshgrat(topo,topoR,[200 400]);
setm(h,'Graticule',latgrat,longrat);
4-71
Notice that the result does not appear to be any better than the original
display with the default [50 100] graticule, but it took much longer to produce.
There is no point to specifying a mesh finer than the data resolution (in this
case, 180-by-360 grid cells). In practice, it makes sense to use coarse graticules
for development tasks and fine graticules for final graphics production.
4-72
whos
Name
description
Size
2x64
Bytes
256
Class
char
lat
180x240
345600
double
lon
180x240
345600
double
map
180x240
345600
double
double
maplegend
1x3
24
refvec
1x3
24
source
2x76
304
Attributes
double
char
The lat and lon coordinate matrices form a mesh the same size as the map
matrix. This is a requirement for constructing 3-D surfaces, unlike the
example given above using the topo raster data set, which was displayed in
2-D using the meshm function. If you inspect lat and lon in the MATLAB
Variable Editor, you find that in lon, all columns contain the same number
for a given row, and in lat, all rows contain the same number for a given
column. This is because the mesh produced by meshgrat in this case is
regular, but such data grids need not have equal spacing.
4 Now set up a map axes object with the equal area conic projection:
axesm('MapProjection','eqaconic','MapParallels',[],...
'MapLatLimit',[30 45],'MapLonLimit',[115 135])
5 Instead of using the meshm function to make this map, display the korea
geolocated data grid using the surfm function, and set an appropriate
colormap:
surfm(lat,lon,map,map); demcmap(map)
tightmap
Here is the result, which is the same as what meshm would produce.
4-73
Be aware, however, that this map is really a 3-D view seen from directly
overhead (the default perspective). To appreciate that, all you need to do is
to change your viewpoint.
6 Use the view function to specify a viewing azimuth of 60 degrees (from the
4-74
4-75
4-76
Note If you click outside the map frame, inputm returns a valid but incorrect
latitude and longitude, even though the point you indicated is off the map.
One reason you might want to manually identify points on a map is to
interactively explore how much distortion a map projection has at given
locations. For example, you can feed the data acquired with inputm to the
distortcalc function, which computes area and angular distortions at any
location on a displayed map axes. If you do so using the points variable, the
results of the previous three mouse clicks are as follows:
[areascale,angledef] = distortcalc(points(1,1),points(1,2))
areascale =
1.0000
angledef =
85.9284
>> [areascale,angledef] = distortcalc(points(2,1),points(2,2))
areascale =
1.0000
angledef =
3.1143
[areascale,angledef] = distortcalc(points(3,1),points(3,2))
areascale =
1.0000
angledef =
76.0623
4-77
This indicates that the current projection (sinusoidal) has the equal-area
property, but exhibits variable angular distortion across the map, less near
the equator and more near the poles.
To see a working application that uses the inputm function, view and run the
mapexfindcity Interactive Global City Finder demo.
coast MAT-file:
axesm('ortho','origin',[30 180])
framem;gridm
load coast
plotm(lat,long,'k')
2 Create a track with the trackg function, which prompts for two endpoints.
4-78
Click near Los Angeles and Tokyo, and the track is drawn.
3 Now create a small circle around Hawaii with the scircleg function, which
prompts for a center point and a point on the perimeter. Make the circles
radius about 2000 km, but dont worry about getting the size exact:
scircleg
Circle 1:
brings up the Track dialog, with which you specify a position and initial
azimuth for either endpoint, as well as the length and type of the track.
4-79
8 Change the track type from Great Circle to Rhumb Line with the Track
move the endpoints of the track with the mouse by dragging the red circles,
and obtain the arcs length in various units of distance.
The following figure shows the Small Circles and Track dialog boxes.
4-80
Try these gtextm commands to label the locations you have just annotated:
gtextm('Hawaii','color','r')
gtextm('Tokyo')
gtextm('Los Angeles')
The following figure displays the results of these gtextm commands. After
you place text, you can move it interactively using the selection tool in the
map figure window.
4-81
Some mapping display functions like framem, gridm, and contourm assign
object tags by default. You can also set the name upon display by assigning
a string to the Tag property in mapping display functions that use property
name/property value pairs. If the Tag does not contain a string, the name
defaults to an objects Type property, such as 'line' or 'text'.
f = axesm('fournier')
framem on; gridm on;
plabel on; mlabel('MLabelParallel',0)
load coast
plotm(lat,long,'k','Tag','Coastline')
2 List the names of the objects in the current axes using namem:
namem
ans =
Coastline
PLabel
MLabel
Meridian
Parallel
4-82
Frame
3 The handlem function allows you to dereference graphic objects and to get
or set their properties. Change the line width of the coastline with set:
set(handlem('Coastline'),'LineWidth',2)
4 Change the colors of the meridian and parallel labels separately:
set(handlem('Mlabel'),'Color',[.5 .2 0])
set(handlem('Plabel'),'Color',[.2 .5 0])
You can also change these labels to be the same color using setm:
setm(f,'fontcolor', [.4 .5 .6])
5 The handlem command with no arguments summons a UI control with a list
of map axes objects. This is useful for selecting objects interactively. Try
handlem
or
h = handlem
6 Combined with set, this makes it simple to change properties such as color.
Remember, however, to use the right property name. Patches, for example,
have a FaceColor and EdgeColor, while most other objects simply have
Color, as is the case with the Coastline object. Now use handlem to call a
color picker to set the coastline to any color you like:
set(handlem,'Color',uisetcolor)
The reference page for handlem lists the object names that it recognizes.
Note that most of these names can be prefixed with all, which returns an
array of all handles for that class of object.
7 Now try handlem using the all modifier:
t = handlem('alltext')
l = handlem('allline')
Note that you can also use all with the hidem and showm functions:
4-83
hidem('alltext')
showm('alltext')
For more information on the use of functions and tools for manipulating
objects, consult the setm, getm, handlem, hidem, showm, clmo, namem, tagm,
and mobjects reference pages.
4-84
5
Making Three-Dimensional
Maps
Sources of Terrain Data on page 5-2
Reading Elevation Data Interactively on page 5-13
Determining and Visualizing Visibility Across Terrain on page 5-19
Shading and Lighting Terrain Maps on page 5-22
Draping Data on Elevation Maps on page 5-40
Working with the Globe Display on page 5-49
5-2
Note For information on locating map data for download over the
Internet, see the following documentation at the MathWorks Web site:
http://www.mathworks.com/support/tech-notes/2100/2101.html.
5-3
Function to Read
Files
Function to Identify
or Summarize Files
U.S. Department
of Defense Digital
Terrain Elevation
Data
dted
dteds
DEM
USGS 1-degree
(3-arc-second
resolution) digital
elevation models
usgsdem
usgsdems
DEM24K
USGS 1:24K
(30-meter resolution)
digital elevation
models
usgs24kdem
N/A
ETOPO5 ETOPO2
etopo
N/A
GTOPO30
Tiles of 30-arc-second
global elevation
models
gtopo30
gtopo30s
SATBATH
Global 2-minute
(4 km) satellite
topography and
bathymetry data
satbath
N/A
SDTS DEM
Digital elevation
models in U.S. SDTS
format
sdtsdemread
sdtsinfo (reads
metadata from catalog
file)
TBASE
TerrainBase
topography and
bathymetry binary
and ASCII grid files
tbase
N/A
File Type
Description
DTED
Note that the names of functions that identify file names are those of their
respective file-reading functions appended with s. These functions determine
file names for areas of interest, and have calling arguments of the form
(latlim, lonlim), with which you indicate the latitude and longitude limits
5-4
for an area of interest, and all return a list of filenames that provide the
elevations required. The southernmost latitude and the western-most
longitude must be the first numbers in latlim and lonlim, respectively.
5-5
2 To determine the USGS DEM files you need, use the usgsdems function:
Note that, in contrast to the dteds command you executed above, there
are eight rather than nine files listed to cover the 3-by-3-degree region of
interest. The cell that consists entirely of ocean has no name and is thus
omitted from the output cell array.
3 To determine the GTOPO30 files you need, use the gtopo30s function:
5-6
In this example, only one DTED file is needed, so the answer is a single
string. For more information on the dteds function, see Using dteds,
usgsdems, and gtopo30s to Identify DEM Files on page 5-5).
3 Unless you have a CD-ROM containing this file, download it from the
The original data comes as a compressed tar or zip archive that you must
expand before using.
4 Use the dted function to create a terrain grid and a referencing vector
in the workspace at full resolution. If more than one DTED file named
n41.dt0 exists on the path, your working directory must be /dted/w071 in
order to be sure that dted finds the correct file. If the file is not on the path,
you are prompted to navigate to the n41.dt0 file by the dted function:
samplefactor = 1;
[capeterrain, caperef] = dted('n41.dt0', ...
samplefactor, latlim, lonlim);
5 Because DTED files contain no bathymetric depths, decrease elevations of
zero slightly to render them with blue when the colormap is reset:
capeterrain(capeterrain == 0) = -1;
6 Use usamap to construct an empty map of axes for the region defined by
5-7
figure;
ax = usamap(latlim,lonlim);
7 Read data for the region defined by the latitude and longitude limits from
The resulting map, shown below, is a window on Cape Cod, and illustrates
the relative coarseness of DTED level 0 data.
5-8
5-9
n43.dt0
n43.max
n43.min
/w071
n41.avg
n41.dt0
n41.max
n41.min
n42.avg
n42.dt0
n42.max
n42.min
n43.avg
n43.dt0
n43.max
n43.min
/w072
n41.avg
n41.dt0
n41.max
n41.min
n42.avg
n42.dt0
n42.max
n42.min
n43.avg
n43.dt0
n43.max
n43.min
2 Change your working directory to the directory that includes the top-level
5-10
The sample factor value of 5 specifies that only every fifth data cell, in both
latitude and longitude, will be read from the original DTED file. You can
choose a larger value to save memory and speed processing and display, at
the expense of resolution and accuracy. The size of your elevation array
(capetopo) will be inversely proportional to the square of the sample factor.
Note You can specify a DTED filename rather than a directory name if
you are accessing only one DTED file. If the file cannot be found, a file
dialog is presented for you to navigate to the file you want. See the example
Mapping a Single DTED File with the DTED Function on page 5-6.
4 As DTEDs contain no bathymetric depths, recode all zero elevations to -1,
5-11
6 Render the elevation grid with meshm, and then recolor the map with
Here is the map; note the missing tile to the right where no DTED data exists.
5-12
demdataui
5-13
The Source list in the left pane shows the data sets that were found. The
coverage of each data set is indicated by a yellow tint on the map with gray
borders around each tile of data. Here, the source is selected to present
all DTED files available to a user.
2 Clicking a different source in the left column updates the coverage display.
5-14
3 Use the map in the UI to specify the location and density of data to extract.
5-15
4 To see the terrain you have windowed at the sample factor you specified,
click the Get button. This causes the GUI map pane to repaint to display
the terrain grid with the demcmap colormap. In this example, the data grid
contains 580-by-568 data values, as shown below.
5-16
5 If you are not satisfied with the result, click the Clear button to remove all
data previously read in via Get and make new selections. You might need
to close and reopen demdatui in order to select a new region of interest.
6 When you are ready to import DEM data to the workspace or save it as a
MAT-file, click the Save button. Select a destination and name the output
variable or file. You can save to a MAT-file or to a workspace variable.
The demdataui function returns one or more matrices as an array of
display structures, having one element for each separate get you requested
(assuming you did not subsequently Clear). You then use geoshow or
mlayers to add the data grids to a map axes.
The data returned by demdataui contains display structures. You
cannot update these to geographic data structures (geostructs) using the
updategeostruct function, because they are of type surface, which the
updating function does not recognize. However, you can still display them
with geoshow, as shown in the next step.
5-17
7 To access the contents of the display structure, use its field names. Here
map and maplegend are copied from the structure and used to create a
lighted three-dimensional elevation map display using worldmap. (demdata
is the default name for the structure, which you can override when you
save it.)
Z = demdata.map;
refvec = demdata.maplegend;
figure
ax = worldmap(Z, refvec);
geoshow(ax, Z, refvec, 'DisplayType', 'texturemap');
axis off
demcmap(Z);
5-18
and set its origin at (0N, 0W), with a spacing of 1000 cells per degree):
map = 500*peaks(100);
maplegend = [ 1000 0 0];
2 Define two locations on this grid to test intervisibility:
meters) above the surface of the first location (lat1, lon1) where the
observer is located (the viewpoint):
los2(map,maplegend,lat1,lon1,lat2,lon2,100)
5-19
ans =
1
The los2 function also produces a profile diagram in a figure window showing
visibility at each grid cell along the line of sight that can be used to interpret
the Boolean result. In this example, the diagram shows that the line between
the two locations just barely clears an intervening peak.
You can also compute the viewshed, a name derived from watershed, which
is all of the areas that are visible from a particular location. The viewshed
function can be thought of as performing the los2 line-of-sight calculation
from one point on a digital elevation map to every other entry in the matrix.
The viewshed function supports the same options as los2.
The following shows which parts of the peaks elevation map in the previous
example are visible from the first point:
[vismap,vismapleg] = viewshed(map,maplegend,lat1,lon1,100);
5-20
5-21
Mapping a Single DTED File with the DTED Function on page 5-6, or
execute the steps below:
latlim = [ 41.20 41.95];
lonlim = [-70.95 -70.10];
cd dted\w071 %Note: Your absolute path may vary
samplefactor = 1;
[capeterrain, caperef] = dted('n41.dt0', samplefactor,...
latlim, lonlim);
capeterrain(capeterrain == 0) = -1;
capecoast = shaperead('usastatehi',...
'UseGeoCoords', true,...
'BoundingBox', [lonlim' latlim']);
5-22
2 Construct a map of the region within the specified latitude and longitude
limits:
figure
ax = usamap(latlim,lonlim);
geoshow(ax, capecoast, 'FaceColor', 'none');
geoshow(ax, capeterrain, caperef, 'DisplayType', 'mesh');
demcmap(capeterrain)
3 Set the vertical exaggeration. Use daspectm to specify that elevations are
terrain, use zdatam to set it to the highest elevation of the cape1 terrain
data:
zdatam('allline',max(capeterrain(:)))
5 Specify a location for a light source with lightm:
h = lightm(42,-71);
5-23
If you omit arguments, a GUI for setting positional properties for the new
light opens.
6 To see the properties of light objects, inspect the handle returned by lightm:
get(h)
Position = [-0.00616097 0.796039 1]
Color = [1 1 1]
Style = infinite
BeingDeleted = off
ButtonDownFcn =
Children = []
Clipping = on
CreateFcn =
DeleteFcn =
BusyAction = queue
HandleVisibility = on
HitTest = on
Interruptible = on
Parent = [138.001]
Selected = off
SelectionHighlight = on
Tag =
Type = light
UIContextMenu = []
UserData = [ (1 by 1) struct array]
Visible = on
Had you used the MATLAB light function in place of lightm, you would
have needed to specify the position in Cartesian 3-space.
7 The lighting computations caused the map to become quite dark with
5-24
8 If you want to compare the lit map with the unlit version, you can toggle
For additional information, see the reference pages for daspectm, lightm,
light, lighting, and material.
5-25
load topo
axesm ('mapprojection','ortho', 'origin',[10 -20 0])
2 Plot the topography and assign a topographic colormap:
meshm(topo,topolegend);
demcmap(topo)
3 Set up a yellow light source over New York City:
hl = lightm(40.75,-73.9, 500/almanac('earth','radius'),...
'color','yellow', 'style', 'local');
The first two arguments to lightm are the latitude and longitude of the
light source. The third argument is its altitude, in units of Earth radii (in
this case they are in kilometers, the default units of almanac).
4 The surface is quite dark, so give it more reflectivity by specifying
4.0000
5-26
0.9925]);
The second light is magenta, and positioned over the Gulf of Arabia.
6 To modify the lights, use the lightmui GUI, which lets you drag lights
The lights are shown as appropriately colored circles, which you can drag to
new positions. You can also Ctrl+click a circle to bring up a dialog box for
directly specifying that lights position, altitude, and color. The GUI and
the map look like this at this point.
5-27
7 In the lightmui window, drag the yellow light to the eastern tip of Brazil,
second UI, for setting light position and color, opens. Set the altitude
to 0.04 (Earth radii). Set the light color components to 1.0 (red), 0.75
(green), and 1.0 (blue). Press Return after each action. The colorbar on the
UI changes to indicate the color you set. If you prefer to pick a color, click
on the colorbar to bring up a color-choosing UI. The map now looks like this.
5-28
For additional information, see the reference pages for lightm and lightmui.
5-29
with worldmap:
figure;
ax = worldmap('korea');
latlim = getm(ax,'MapLatLimit');
lonlim = getm(ax,'MapLonLimit');
coastline = shaperead('landareas',...
'UseGeoCoords', true,...
'BoundingBox', [lonlim' latlim']);
geoshow(ax, coastline, 'FaceColor', 'none');
worldmap chooses a projection and map bounds to make this map.
load korea
3 Generate the grid of latitudes and longitudes to transform the regular
5-30
[klat,klon] = meshgrat(map,refvec);
4 Use surflm to generate a default shaded relief map, and change the
5 To make the light come from some other direction, specify the light sources
azimuth and elevation as the fourth argument to surflm. Clear the terrain
map and redraw it, specifying an azimuth of 135 (northeast) and an
elevation of 60 above the horizon:
clmo(ht); ht=surflm(klat,klon,map,[135,60]);
The surface lightens and has a new character because it is lit closer to
overhead and from a different direction.
5-31
6 Now shift the light to the northwest (-135 azimuth), and lower it to 40
above the horizon. Because a lower sun decreases the overall reflectance
when viewed from straight above, also specify a more reflective surface
as a fifth argument to surflm. This is a 1-by-4 vector describing relative
contributions of ambient light, diffuse reflection, specular reflection, and a
specular shine coefficient. It defaults to [.55 .6 .4 10].
clmo(ht); ht=surflm(klat,klon,map,[-135, 30],[.65 .4 .3 10]);
This is a good choice for lighting this terrain, because of the predominance
of mountain ridges that run from northeast to southwest, more or less
perpendicular to the direction of illumination. Here is the final map.
5-32
For further information, see the reference pages for surflm and surfl.
Shaded relief representations can highlight the fine structure of the land
and sea floor, but because of the monochromatic coloration, it is difficult to
distinguish land from sea. The next section describes how to color such maps
to set off land from water.
5-33
relief according to how you specify the suns altitude and azimuth:
[cmap,clim] = demcmap(map);
3 Plot the colored shaded relief map, specifying an azimuth of -135 and an
You can also achieve the same effect with meshlsrm, which operates
on regular data grids (it first calls meshgrat, just as you just did), e.g.,
meshlsrm(map,maplegend).
4 The surface has more contrast than if it were not shaded, and it might help
5-34
5 Plot an oblique view of the surface by hiding its bounding box, exaggerating
terrain relief by a factor of 50, and setting the view azimuth to -30
(south-southwest) and view altitude to 30 above the horizon:
set(gca,'Box','off')
daspectm('meters',50)
view(-30,30)
6 You can continue to rotate the perspective with the view function (or
5-35
change the built-in lighting direction without generating a new view using
surflsrm.
For further information, see the reference pages for surflsrm, meshlsrm,
daspectm, and view.
Miller projection:
load korea
figure; axesm('MapProjection','miller',...
'MapLatLimit',[30 45],'MapLonLimit',[115 135])
2 Display the DEM with meshm, and color it with terrain hues:
meshm(map,refvec,size(map),map);
demcmap(map)
5-36
3 Create a light object with lightm (similar to the MATLAB light function,
but specifies position with latitude and longitude rather than x, y, z). The
light is placed at the northwest corner of the grid, one degree high:
h=lightm(45,115,1)
5-37
7 Finally, remove the edges of the bounding box and set a viewpoint of -30
azimuth, 30 altitude:
set(gca,'Box','off')
view(-30,30)
The view from (-30,30) with one light at (45,115,1) and Phong shading
is shown below. Compare it to the final map in the previous exercise,
Coloring Shaded Relief Maps and Viewing Them in 3-D on page 5-34.
To remove a light (when there is only one) from the current figure, type
5-38
clmo(handlem('light'))
For more information, consult the reference pages for lightm, daspectm,
material, lighting, and view, along with the section on Lighting as a
Visualization Tool in the 3D Visualization documentation.
5-39
5-40
load topo
load geoid
2 Create a map axes using a Gall stereographic cylindrical projection (a
perspective projection):
axesm gstereo
3 Use meshm to plot a colored display of the geoids variations, but specify
topo as the final argument, to give each geoid grid cell the height (z-value)
of the corresponding topo grid cell:
meshm(geoid,geoidrefvec,size(geoid),topo)
1000 meters (high enough to clear the surface in their vicinity), and expand
the map to fill the frame:
load coast
plotm(lat,long,'k')
zdatam(handlem('allline'),1000)
tightmap
5-41
5 Due to the vertical view and lack of lighting, the topographic relief
position, offset to the right of the viewpoint), and render again with Phong
shading:
set(gca,'Box','off')
camlight;
lighting phong
7 Finally, set the perspective to converge slightly (the default perspective
is orthographic):
set(gca,'projection','perspective')
The final map is shown below. From it, you can see that the geoid mirrors
the topography of the major mountain chains such as the Andes, the
5-42
Himalayas, and the Mid-Atlantic Ridge. You can also see that large areas
of high or low geoid heights are not simply a result of topography.
5-43
data grid (creating a set of slope values for the diamond-shaped grid) and
color-coded for surface display.
Note When you use ltln2val to resample a regular data grid over an
irregular area, make sure that the regular data grid completely covers the
area of the geolocated data grid.
1 Begin by loading the geolocated data grids from mapmtx, which contains two
regions. You will only use the diamond-shaped portion of mapmtx (lt1, lg1,
and map1) centered on the Middle East, not the lt2, lg2, and map1 data:
load mapmtx lt1
load mapmtx lg1
load mapmtx map1
by lt1, lg1:
slope1 = ltln2val(slope,topolegend,lt1,lg1);
data. Specify the z-values for the surface explicitly as the map1 data, which
is terrain elevation:
figure; axesm miller
surfm(lt1,lg1,slope1,map1)
5-44
The map mainly depicts steep cliffs, which represent mountains (the
Himalayas in the northeast), and continental shelves and trenches.
5 The coloration depicts steepness of slope. Change the colormap to make
the steepest slopes magenta, the gentler slopes dark blue, and the flat
areas light blue:
colormap cool;
6 Use view to get a southeast perspective of the surface from a low viewpoint:
view(20,30); daspectm('m',200)
Render the surface again, this time making it shiny with Phong shading
and lighting from the east (the default of camlight lights surfaces from
over the viewers right shoulder):
material shiny;camlight;lighting phong
8 Finally, remove white space and re-render the figure in perspective mode:
5-45
load
load
load
load
5-46
topo;
mapmtx lt1
mapmtx lg1
mapmtx map1
[topo1,topo1ref] = maptrims(topo,topolegend,latlim,lonlim);
4 Create a regular grid filled with NaNs to receive texture data:
[curve1,curve1ref] = nanm(latlim,lonlim,.5);
The last parameter establishes the grid at 1/.5 cells per degree.
5 Use imbedm to embed values from map1 into the curve1 grid; the values are
So far, both the surface relief and coloring represent topographic elevation.
5-47
9 Apply the curve1 matrix as a texture map directly to the figure using the
set function:
set(h,'Cdata',curve1,'FaceColor','TextureMap')
The area originally covered by the [lt1, lg1, map1] geolocated data grid,
and recoded via the Laplacian transform as curve1, now controls color
symbolism, with the NaN-coded outside cells rendered in black.
5-48
5-49
load topo
axesm ortho; framem
meshm(topo,topolegend);demcmap(topo)
2 View the map obliquely:
view(3); daspectm('m',1)
3 You can view it in 3-D from any perspective, even from underneath. To
visualize this, define a geolocated data grid with meshgrat, populate it with
a constant z-value, and render it as a stem plot with stem3m:
[latgrat,longrat] = meshgrat(topo,topolegend,[20 20]);
stem3m(latgrat,longrat,500000*ones(size(latgrat)),'r')
Use the Rotate 3D tool on the figure window toolbar to change your
viewpoint. No matter how you position the view, you are looking at a disc
with stems protruding perpendicularly.
5-50
4 Create another figure using the Globe transform rather than orthographic
projection:
figure
axesm('globe','Geoid',almanac('earth','radius','m'))
5 Display the topo surface in this figure and view it in 3-D:
meshm(topo,topolegend); demcmap(topo)
view(3)
6 Include the stem plot to visualize the difference in surface normals on a
sphere:
stem3m(latgrat,longrat,500000*ones(size(latgrat)),'r')
7 You can apply lighting to the display, but its location is fixed, and does not
set(gca,'Box','off')
Here is a representative view using the Globe display with the headlight.
5-51
You can use the LabelRotation property when you use the Orthographic or
any other Mapping Toolbox projection to align meridian and parallel labels
with the graticule. Because the Globe display is not a true map projection and
is handled differently internally, LabelRotation does not work with it.
For additional information on functions used in this example, see the
reference pages for view, camlight, meshgrat, and stem3m.
5-52
figure; axesm('globe')
2 Draw a graticule in a light color, slightly raised from the surface:
load coast
plot3m(lat,long,.01,'k')
view(3)
4 Use the Rotate 3D tool on the figures toolbar to rotate the view. Note how
base = zeros(180,360);
baseR = makerefmat('RasterSize', size(base), ...
'ColumnsStartFrom', 'north', 'RowsStartFrom', 'west');
5-53
6 Render the grid onto the globe, color it copper, light it from camera right,
Note Another way to make the surface of the globe one color is to change
the FaceColor property of a displayed surface mesh (e.g., topo).
If you havent rotated it, the display looks like this.
When you manually rotate this map, its movement can be jerky due to the
number of vectors that must be redisplayed. In any position, however, the
copper surface effectively hides all lines on the back side of the globe.
5-54
Note The technique of using a uniform surface to hide rear-facing lines has
limitations for the display of patch symbolism (filled polygons). As patch
polygons are represented as planar, in three-space the interiors of large
patches can intersect the spherical surface mesh, allowing its symbolism
to show through.
figure
axesm globe
load topo
2 Display topo without the vertical component (by omitting the fourth
argument to meshm):
meshm(topo, topolegend, size(topo)); demcmap(topo);
The default view is from above the North Pole with the central meridian
running parallel to the x-axis.
3 Add world coastlines from the global landareas shapefile and plot them
in light gray:
coastlines = shaperead('landareas',...
'UseGeoCoords', true, 'Attributes', {});
plotm([coastlines.Lat], [coastlines.Lon], 'Color', [.7 .7 .7])
5-55
4 Read the coordinate locations for Moscow and Washington from the
worldcities shapefile:
moscow = shaperead('worldcities',...
'UseGeoCoords', true,...
'Selector',{@(name) strcmpi(name,'Moscow'), 'Name'});
washington = shaperead('worldcities',...
'UseGeoCoords', true,...
'Selector',{@(name) strcmpi(name,'Washington D.C.'),...
'Name'});
5 Create a great circle track to connect Washington with Moscow and plot
it in red:
[latc,lonc] = track2('gc',...
moscow.Lat, moscow.Lon, washington.Lat, washington.Lon);
plotm(latc,lonc,'r')
6 Point the camera at Moscow. Wherever the camera is subsequently moved,
in Earth radii:
camposm(washington.Lat, washington.Lon, 3)
8 Establish the camera up vector with the camera targets coordinates. The
camva(20)
10 Add a light, specify a relatively nonreflective surface material, and hide
5-56
For additional information, see the reference pages for extractm, camtargm,
camposm, camupm, globe, and camlight.
code:
% spin.m: Rotates a view around the equator one revolution
% in 5-degree steps. Negative step makes it rotate normally
% (west-to-east).
for i=360:-5:0
view(i,23.5);
% Earth's axis tilts by 23.5 degrees
drawnow
end
5-57
axesm('globe','Grid','on','Gcolor',[.7 .8 .9],'GlineStyle','-')
spin
The globe spins rapidly. The last position looks like this.
5 To make the globe opaque, create a sea-level data grid as you did for the
5-58
The globe now is a uniform dark copper color with the grid overlaid.
6 Pop up the grid so it appears to float 2.5% above the surface. Prevent the
display from stretching to fit the window with the axis vis3d command:
setm(gca, 'Galtitude',0.025);
axis vis3d
7 Spin the globe again:
spin
The motion is slower, due to the need to rerender the 180-by-360 mesh: The
last frame looks like this.
5-59
8 Get ready to replace the uniform sphere with topographic relief by deleting
5-60
10 Show the Earth in space; blacken the figure background, turn off the three
11 You can apply lighting as well, which shifts as the planet rotates. Try the
5-61
camlight right
lighting phong;
material ([.7, .9, .8])
For additional information, see the globe, camlight, and view reference
pages.
5-62
6
Customizing and Printing
Maps
Inset Maps on page 6-2
Graphic Scales on page 6-8
North Arrows on page 6-14
Thematic Maps on page 6-17
Using Cartesian MATLAB Display Functions on page 6-28
Using Colormaps and Colorbars on page 6-34
Printing Maps to Scale on page 6-45
Inset Maps
Inset maps are often used to display widely separated areas, generally at the
same scale, or to place a map in context by including overviews at smaller
scales. You can create inset maps by nesting multiple axes in a figure and
defining appropriate map projections for each. To ensure that the scale of
each of the maps is the same, use axesscale to resize them. As an example,
create an inset map of California at the same scale as the map of South
America, to relate the size of that continent to a more familiar region:
1 Begin by defining a map frame for South America using worldmap:
figure
h1 = worldmap('south america');
2 Use shaperead to read the demo world land areas polygon shapefile:
6-2
Inset Maps
geoshow([land.Lat],[land.Lon])
setm(h1,'FFaceColor','w') % set the frame fill to white
4 Place axes for an inset in the lower middle of the map frame, and project a
6-3
setm(h2,'FFaceColor','w')
mlabel; plabel; gridm % toggle off
6 Make the scale of the inset axes, h2 (California), match the scale of the
6-4
Inset Maps
Note that the toolbox software chose a different projection and appropriate
parameters for each region based on its location and shape. You can
override these choices to make the two projections the same.
7 Find out what map projections are used, and then make South Americas
6-5
Note that the parameters for South America defaulted properly (those
appropriate for California were not used).
8 Finally, experiment with changing properties of the inset, such as its color:
6-6
Inset Maps
6-7
Graphic Scales
Graphic scale elements are used to provide indications of size even more
frequently than insets are. These are ruler-like objects that show distances on
the ground at the nominal scale of the projection. You can use the scaleruler
function to add a graphic scale to the current map. You can check and modify
the scaleruler settings using getm and setm. You can also move the graphic
scale to a new position by dragging its baseline.
Try this by creating a map, adding a graphic scale with the default settings,
and shifting its location. Then add a second scale in nautical miles, and
change the tick mark style and direction:
1 Use usamap to plot a map of Texas and surrounding states as filled polygons:
Because polcmap randomizes patch colors, your display can look different.
6-8
Graphic Scales
scaleruler on
setm(handlem('scaleruler1'),'YLoc',.5)
6-9
3 Obtain a handle to the scalerulers hggroup using handlem and inspect its
6-10
Graphic Scales
MinorTick:
MinorTickLabel:
MinorTickLength:
Radius:
RulerStyle:
TickDir:
TickMode:
Units:
XLoc:
YLoc:
ZLoc:
[0 25 50 75 100]
'100'
12.50000000000000
'earth'
'ruler'
'up'
'auto'
'km'
0.15000000000000
0.50000000000000
[]
setm(s,'fontsize',8)
5 Place a second graphic scale, this one in units of nautical miles:
scaleruler('units','nm')
6 Modify its tick properties:
6-11
6-12
Graphic Scales
6-13
North Arrows
The north arrow element provides the orientation of a map by pointing to
the geographic North Pole. You can use the northarrow function to display
a symbol indicating the direction due north on the current map. The north
arrow symbol can be repositioned by clicking and dragging its icon. The
orientation of the north arrow is computed, and does not need manual
adjustment no matter where you move the symbol. Ctrl+clicking the icon
creates an input dialog box with which you can change the location of the
north arrow:
1 To illustrate the use of north arrows, create a map centered at the South
6-14
North Arrows
2 Click and drag the north arrow symbol to another corner of the map. Note
dialog opens, which lets you specify the line weight, edge and fill colors,
and relative size of the arrow. Set some properties and click OK.
5 Also set some north arrow properties manually, just to get a feel for them:
h = handlem('NorthArrow');
set(h, 'FaceColor', [1.000 0.8431 0.0000],...
'EdgeColor', [0.0100 0.0100 0.9000])
6 Make three more north arrows, to show that from the South Pole, every
direction is north:
northarrow('latitude',-57,'longitude', 45);
northarrow('latitude',-57,'longitude',225);
northarrow('latitude',-57,'longitude',315);
6-15
Note North arrows are created as objects in the MATLAB axes (and thus
have Cartesian coordinates), not as mapping objects. As a result, if you create
more than one north arrow, any Mapping Toolbox function that manipulates
a north arrow will affect only the last one drawn.
6-16
Thematic Maps
Thematic Maps
In this section...
What Is a Thematic Map? on page 6-17
Choropleth Maps on page 6-18
Special Thematic Mapping Functions on page 6-23
6-17
Choropleth Maps
The most familiar form of thematic map is probably the choropleth map
(from the Greek choros, for place, and plethos, for magnitude). Often used to
present data in newspapers, magazines, and reports, choropleth maps fill
geographic zones (such as countries or states, but also matrices) with colors
and/or patterns to represent nominal, ordinal, or cardinal data values. As
there are usually more possible data values than unique symbols or colors
capable of differentiating them, choropleth maps usually classify their data
into value ranges.
Mapping Toolbox choropleth maps are constructed with patch objects . It
assigns a color to each patch face to represent a specified variable, one value
per patch. When the variable is scalar (as opposed to nominal) it generally
represents a density (such as population per unit area), intensity (such as
income per family), or incidence rate (such as fatalities per thousand persons).
It can also convey extensive measurements or counts (such as electoral votes
per state) if used carefully.
To make a choropleth map you need to input or compute a vector of values,
one for each patch in a vector data set. Symbolizing such data values with
the toolbox is straightforward. It involves assigning the data values to the
CData property of a set of patches, and then setting up a colormap with an
appropriate color scheme and range. Colormaps usually map N or fewer
values (for N patches) to M colors. M can be any number between 2 and N,
but typically ranges between 5 and 10.
In the following example, patches representing the 50 states of the U.S.
(and the District of Columbia) are displayed and colored according to the
surface areas calculated by the areaint function. An equal-area projection is
appropriate for this and other choropleth maps. This is because data is often
computed or normalized over the patches being displayed, and thus area
distortion should be minimized, even at the expense of shape distortion.
1 Import low-resolution U.S. state boundary polygons:
This data set includes patch data for individual states, the United States,
and its Great Lakes.
6-18
Thematic Maps
2 Set up map axes with a projection suitable to display all 50 states with
3 Draw the polygon map in the state structure using face colors randomly
selected by polcmap:
faceColors = makesymbolspec('Polygon',...
{'INDEX', [1 numel(states)], 'FaceColor', ...
polcmap(numel(states))});
geoshow(states, 'DisplayType', 'polygon', ...
'SymbolSpec', faceColors)
6-19
in square kilometers for each U.S. state plus D.C. with a for loop:
for k = 1:numel(states)
states(k).SurfaceArea = sum(areaint(states(k).Lat, ...
states(k).Lon, wgs84));
end
maxarea = max([states.SurfaceArea]);
6 Redisplay the states based on the surface area. Use a monotonic colormap
6-20
Thematic Maps
6-21
8 The map is mostly red, as the above figure shows. Experiment with other
steps, and redraw the colorbar to display the new value range:
minarea = 10000;
surfaceColors = makesymbolspec('Polygon',...
{'Default','FaceColor','red'}, ...
{'SurfaceArea', [ minarea maxarea], 'FaceColor', cool(16)});
geoshow(states,'DisplayType', 'polygon', ...
'SymbolSpec', surfaceColors)
6-22
Thematic Maps
caxis([minarea maxarea])
colormap(cool(16))
colorbar
Note how you can specify the size of a colormap with the colormap syntax
used above. Be aware that, because you clamped the value range, the
numeric limits of the colorbar overstate the minimum area and understate
the maximum area. However, the map gives much more information overall
because more states have distinct symbology, as the resulting map depicts.
Used For
cometm
comet3m
6-23
Function
Used For
quiverm
quiver3m
scatterm
stem3m
The cometm and quiverm functions operate like their MATLAB counterparts
comet and quiver. The stem3m function allows you to display geographic bar
graphs. Like the MATLAB scatter function, the scatterm function allows
you to display a thematic map with proportionally sized symbols. The tissot
function calculates and displays Tissot Indicatrices, which graphically portray
the shape distortions of any map projection. For more information on these
capabilities, consult the descriptions of these functions in the reference pages.
Stem Maps
Stem plots are 3-D geographic bar graphs portraying numeric attributes at
point locations, usually on vector base maps. Below is an example of a stem
plot over a map of the continental United States. The bars could represent
anything from selected city populations to the number of units of a product
purchased at each location:
6-24
Thematic Maps
Contour Maps
Contour and quiver plots can be useful in analyzing matrix data. In
the following example, contour elevation lines have been drawn over a
topographical map. The region displayed is the Gulf of Mexico, obtained from
the topo matrix. Quiver plots have been added to visualize the gradient of the
topographical matrix.
Here is the displayed map:
6-25
Scatter Maps
The scatterm function plots symbols at specified point locations, like the
MATLAB scatter function. If the symbols are small and inconspicuous and
do not vary in size, the result is a dot-distribution map. If the symbols vary
in size and/or shape according to a vector of attribute values, the result is
a proportional symbol map.
Below is an example of using scatterm to create a star chart of the northern
sky. The stars are represented by filled circles whose size is negatively
proportional to visual magnitude, because the brighter a star is, the smaller
its magnitude. (The very brightest stars actually have negative magnitude
values.) To execute the following commands, select them all by dragging over
the list in the Help browser, then right-click and choose Evaluate Selection.
% View the sky orthographically
axesm('MapProjection','ortho','MapLatLimit',[0 90])
gridm on
setm(gca,'LabelFormat','compass','LabelRotation','on')
setm(gca,'MLabelParallel',0,'PLabelMeridian',0)
setm(gca,'MeridianLabel','on','ParallelLabel','on')
setm(gca,'GlineStyle','-')
% For each star, use a symbol with area negatively
% proportional to the star's visual magnitude.
load stars
symbolArea = (20 - 2*vmag);
% Plot each star as a blue-filled circle.
h = scatterm(lat,long,symbolArea,'b','filled');
6-26
Thematic Maps
6-27
load seamount
2 Determine the bounds of the coordinates and add a degree of white space:
6-28
tri = delaunay(y,x);
5 Generate a 3-D surface that combines the triangulation and z-values:
h = trisurf(tri,y,x,z);
6 Map the surface onto the axes by projecting to the x-y plane (project is a
Note that even though the triangulated surface appears on the map, it does
not have a geostruct (see Mapping Toolbox Geographic Data Structures
on page 2-16).
7 Add a default graphic scale to the display:
scaleruler on
6-29
If, as in this example, the displayed objects are already in the right place and
do not need to be projected, you can trim them to the map frame and convert
them to mapped objects using trimcart and makemapped. They can then be
manipulated as if they had been created with map display functions.
6-30
simplest to use because north is up, south is down, and east and west are
on an orthogonal axis.
In this example, you will impose a quiver map of the slope of a surface on
a world map. The surface is a Gaussian field generated by the MATLAB
peaks function.
figure; axesm mercator; framem; gridm
load coast
plotm(lat,long,'color',[.75 .75 .75])
[u,v] = gradient(peaks(13)/10);
[mlat,mlon] = meshgrat(-90:15:90,-180:30:180);
[x,y] = mfwdtran(mlat,mlon);
h = quiver(x,y,u,v,.2,'r');
trimcart(h)
tightmap
6-31
6-32
Conformal projections, such as this Lambert conformal conic, are often the
best choice for quiver displays. They preserve angles, ensuring that the
difference between north and east will always be 90 degrees in projected
coordinates.
6-33
6-34
6-35
4 You can also make demcmap assign all altitudes within a particular range
Note that the first argument to demcmap, 'inc', indicates that the third
argument should be interpreted as a value range. If you prefer, you can
specify the desired number of colors with the third argument by setting the
first argument to 'size'.
6-36
Contour Colormaps
You can create colormaps that make surfaces look like contour maps for other
types of data besides terrain. The contourcmap function creates a colormap
that has color changes at a fixed value increment. Its required arguments are
the increment value and the name of a colormap function. Optionally, you can
also use contourcmap to add and label a colorbar similarly to the MATLAB
colorbar function:
1 Explore contourcmap by loading the world geoid data set and rendering
6-37
3 If you want to render a restricted value range, you can enter a vector of
evenly spaced values for the first argument. Here you specify a 5-meter
interval and truncate symbology at 0 meters on the low end and 50 meters
at the high end:
contourcmap([0:5:50],...
'jet','colorbar','on','location','horizontal')
6-38
Should you need to write a custom colormap function, for example, one that
has irregular contour intervals, you can easily do so, but it should have the
N-by-3 structure of MATLAB colormaps.
6-39
Note that the default face color is black, which is not very interesting.
recolor the patches and expand the map to fill the frame:
faceColors = makesymbolspec('Polygon',...
{'INDEX', [1 numel(states)], 'FaceColor',...
polcmap(numel(states))});
geoshow(states,'SymbolSpec',faceColors)
6-40
3 The polcmap function can also control the number and saturation of colors.
6-41
4 For maximum control over the colors, specify the ranges of hues,
saturations, and values. Use the same set of random color indices as before.
figure
worldmap na
rand('state',0)
faceColors = makesymbolspec('Polygon', ...
{'INDEX', [1 numel(states)], ...
'FaceColor', polcmap(256,[.2 .5],[.3 .3],[1 1]) });
geoshow(states, 'SymbolSpec', faceColors)
6-42
Note The famous Four Color theorem states that any political map can be
colored to completely differentiate neighboring patches using only four colors.
Experiment to find how many colors it takes to color neighbors differently
with polcmap.
Labeling Colorbars
Political maps are an example of nominal data display. Many nominal data
sets have names associated with a set of integer values, or consist of codes
that identify values that are ordinal in nature (such as low, medium, and
high). The function lcolorbar creates a colorbar having a text label aligned
with each color. Nominal colorbars are customarily used only with small
colormaps (where 10 categories or fewer are being displayed). lcolorbar has
options for orienting the colorbar and aligning text in addition to the graphic
properties it shares with axes objects.
figure; colormap(jet(5))
labels = {'apples','oranges','grapes','peaches','melons'};
lcolorbar(labels,'fontweight','bold');
6-43
Editing Colorbars
Maps of nominal data often require colormaps with special colors for each
index value. To avoid building such colormaps by hand, use the MATLAB
GUI for colormaps, colormapeditor, described in the MATLAB Function
Reference pages. Also see the MATLAB colormap function documentation.
6-44
The paperscale function also can take a scale denominator as its first and
only argument. If you want the map to be printed at 1:20,000,000, type
paperscale(2e7)
To check the size and extent of text and the relative position of axes, use
previewmap, which resizes the figure to the printed size.
previewmap
For more information on printing, see the Printing and Exporting section of
the MATLAB Graphics documentation.
6-45
6-46
7
Manipulating Geospatial
Data
For some purposes, geospatial data is fine to use as is. Sooner or later,
though, you need to extract, combine, massage, and transform geodata. This
chapter discusses some Mapping Toolbox tools and techniques provided for
such purposes.
Manipulating Vector Geodata on page 7-2
Manipulating Raster Geodata on page 7-32
[latc,lonc] = polysplit(lat,long)
latc =
7-2
[3x1 double]
lonc =
[3x1 double]
[4x1 double]
[4x1 double]
[latc{1} lonc{1}]
[latc{2} lonc{2}]
ans =
45.6
-23.47
78
13
-97.45
165
43.9
-67.14
90
-89
0
-114.2
-18
0
ans =
Note that each cell array element contains a segment of the original line.
4 To reverse the process, use polyjoin:
[lat2,lon2] = polyjoin(latc,lonc);
5 The joined segments are identical with the initial lat and lon arrays:
1
1
1
0
1
1
1
1
7-3
See the polysplit and polyjoin reference pages for further information.
[latm,lonm] = polymerge(lat,lon);
[latm lonm]
ans =
1
2
3
4
NaN
5
6
7-4
11
12
13
14
NaN
15
16
NaN
NaN
Digitized channel
Interpolated
points
Interpolating Sparse Vector Data
7-5
maxdiff = 1;
3 Call interpm to fill in any gaps greater than 1 in either direction:
[newlats,newlongs] = interpm(lats,longs,maxdiff)
newlats =
1.0000
1.5000
2.0000
3.0000
4.0000
5.0000
newlongs =
1.0000
2.0000
3.0000
3.5000
4.0000
5.0000
7-6
newlong = 7.3;
3 Generate a new latitude with linear interpolation:
newlat = intrplat(longs,lats,newlong,'linear')
newlat =
63.3000
4 Generate the latitude using great circle interpolation:
newlat = intrplat(longs,lats,newlong,'gc')
newlat =
63.5029
5 Generate it again, specifying interpolation along a rhumb line:
7-7
newlat = intrplat(longs,lats,newlong,'rh')
newlat =
63.3937
(65, 9)
Rhumb line latitude = 63.5029
Great circle latitude = 63.3937
Linear latitude = 63.3000
(60, 4)
(Longitude = 7.3)
Vector Intersections
A set of Mapping Toolbox functions perform intersection calculations on
vector data computed by the toolbox, which include great and small circles
as well as rhumb line tracks. The functions also determine intersections of
arbitrary vector data.
Compute the intersection of a small circle centered at (0,0) with a radius of
1250 nautical miles and a small circle centered at (5N,30E) with a radius of
2500 kilometers:
[lat,long] = scxsc(0,0,nm2deg(1250),5,30,km2deg(2500))
7-8
lat =
17.7487 -12.9839
long =
11.0624 16.4170
(17.7N, 11.1E)
(5N, 30E)
2500 km
1250 nm
(0, 0)
(13.0N, 16.4E)
In general, small circles intersect twice or never. For the case of exact
tangency, scxsc returns two identical intersection points. Other similar
commands include rhxrh for intersecting rhumb lines, gcxgc for intersecting
great circles, and gcxsc for intersecting a great circle with a small circle.
Imagine a ship setting sail from Norfolk, Virginia (37N,76W), maintaining
a steady due-east course (90), and another ship setting sail from Dakar,
Senegal (15N,17W), with a steady northwest course (315). Where would
the tracks of the two vessels cross?
[lat,long] = rhxrh(37,-76,90,15,-17,315)
lat =
37
7-9
long =
-41.7028
You can also compute the intersection points of arbitrary vectors of latitude
and longitude. The polyxpoly command finds the segments that intersect
and interpolates to find the intersection points. The interpolation is done
linearly, as if the points were in a Cartesian x-y coordinate system. The
polyxpoly command can also identify the line segment numbers associated
with the intersections:
[xint,yint] = polyxpoly(x1,y1,x2,y2);
7-10
If the spacing between points is large, there can be some difference between
the intersection points computed by polyxpoly and the intersections shown
on a map display. This is a result of the difference between straight lines in
the unprojected and projected coordinates. Similarly, there can be differences
between the polyxpoly result and intersections assuming great circles or
rhumb lines between points.
Polygon Area
Use the function areaint to calculate geographic areas for vector data in
polygon format. The function performs a numerical integration using Greens
Theorem for the area on a surface enclosed by a polygon. Because this is a
discrete integration on discrete data, the results are not exact. Nevertheless,
the method provides the best means of calculating the areas of arbitrarily
shaped regions. Better measures result from better data.
The Mapping Toolbox function areaint (for area by integration), like the
other area functions, areaquad and areamat, returns areas as a fraction of
the entire planets surface, unless a radius is provided. Here you calculate
the area of the continental United States using the conus MAT-file. Three
areas are returned, because the data contains three polygons: Long Island,
Marthas Vineyard, and the rest of the continental U.S.:
load conus
earthradius = almanac('earth','radius');
7-11
area = areaint(uslat,uslon,earthradius)
area =
1.0e+06 *
7.9256
0.0035
0.0004
Again, three areas are returned, the largest for the polygon representing
Superior, Michigan, and Huron together, the other two for Erie and Ontario.
7-12
Intersection
Union
Exclusive Or
Subtraction
7-13
theta = -(0:pi/6:2*pi)';
lat1 = sin(theta);
lon1 = cos(theta);
2 Construct a triangle that overlaps it:
lat2 = [0 1 -1 0]';
lon2 = [0 2 2 0]';
3 Plot the two shapes together with blue and red lines:
axesm miller
plotm(lat1,lon1,'b')
plotm(lat2,lon2,'r')
4 Compute the intersection polygon and plot it as a green patch:
[loni,lati] = polybool('intersection',lon1,lat1,lon2,lat2);
[lati loni]
geoshow(lati,loni,'DisplayType','polygon','FaceColor','g')
ans =
0
-0.4409
0
0.4409
0
1.0000
0.8819
0
0.8819
1.0000
[lonu,latu] = polybool('union',lon1,lat1,lon2,lat2);
[latu lonu]
geoshow(latu,lonu,'DisplayType','polygon','FaceColor','m')
ans =
-1.0000
-0.4409
-0.5000
-0.8660
-1.0000
-0.8660
7-14
2.0000
0.8819
0.8660
0.5000
0.0000
-0.5000
-0.5000
0
0.5000
0.8660
1.0000
0.8660
0.5000
0.4409
1.0000
-1.0000
-0.8660
-1.0000
-0.8660
-0.5000
-0.0000
0.5000
0.8660
0.8819
2.0000
2.0000
[lonx,latx] = polybool('xor',lon1,lat1,lon2,lat2);
[latx lonx]
geoshow(latx,lonx,'DisplayType','polygon','FaceColor','y')
ans =
-1.0000
-0.4409
-0.5000
-0.8660
-1.0000
-0.8660
-0.5000
0
0.5000
0.8660
1.0000
0.8660
0.5000
0.4409
1.0000
-1.0000
NaN
0.4409
0
-0.4409
0
0.4409
2.0000
0.8819
0.8660
0.5000
0.0000
-0.5000
-0.8660
-1.0000
-0.8660
-0.5000
-0.0000
0.5000
0.8660
0.8819
2.0000
2.0000
NaN
0.8819
0
0.8819
1.0000
0.8819
7-15
7 Subtract the triangle from the 12-sided polygon and plot the resulting
0.5000
0.8660
0.8819
0
0.8819
0.8660
0.5000
0.0000
-0.5000
-0.8660
-1.0000
-0.8660
-0.5000
-0.0000
0.5000
7-16
axesm ortho
setm(gca,'Origin', [60 170]); framem on; gridm on
7-17
load coast
plotm(lat, long)
2 Generate a small circle that encompasses the North Pole and color it yellow:
[latc,lonc] = scircle1(75,45,30);
patchm(latc,lonc,'y')
3 Flatten the small circle with flatearthpoly:
[latf,lonf] = flatearthpoly(latc,lonc);
4 Plot the cut circle that you just generated as a magenta line:
plotm(latf,lonf,'m')
5 Generate a second small circle that does not include a pole:
[latf1,lonf1] = flatearthpoly(latc1,lonc1);
plotm(latf1,lonf1,'r')
The following figure shows the result of these operations. Note that the
second small circle, which does not cover a pole, has been clipped into two
pieces along the date line. On the right, the polygon for the first small circle
is plotted in plane coordinates to illustrate its flattened shape.
7-18
The flatearthpoly function assumes that the interior of the polygon being
flattened is in the hemisphere that contains most of its edge points. Thus a
polygon produced by flatearthpoly does not cover more than a hemisphere.
Note As this figure illustrates, you do not need to use flatearthpoly to
prepare data for a map display. The Mapping Toolbox display functions
automatically cut and trim geographic data if required by the map projection.
Use this function only when conducting set operations on polygons.
See the flatearthpoly reference page for further information.
7-19
The bufferm function computes and returns vectors that represent a set of
points that define a buffer zone. It forms the buffer by placing small circles at
the vertices of the polygon and rectangles along each of its line segments, and
applying the union set operation to these objects.
border:
ax = worldmap('madagascar');
madagascar = shaperead('landareas',...
'UseGeoCoords', true,...
'Selector', {@(name)strcmpi(name,'Madagascar'), 'Name'});
geoshow(ax, madagascar, 'FaceColor', 'none');
madaLat = madagascar.Lat;
madaLon = madagascar.Lon;
7-20
2 Use bufferm to process the polygon and output a buffer zone .75 degrees
inland:
[latb,lonb] = bufferm(madaLat, madaLon, .75, 'in');
This can take several minutes, because of the great number of geometric
computations that bufferm is performing.
3 Show the buffer zone in yellow, and the rest of the region in green. This is
7-21
7-22
load coast
2 Define a region of interest centered on Australia:
[linelat,linelong] = maptriml(lat,long,latlim,longlim);
4 Do this again, but use maptrimp to produce polygon vectors:
[polylat,polylong] = maptrimp(lat,long,latlim,longlim);
5 See how much data has been reduced:
whos
Name
lat
latlim
linelat
linelong
long
Size
9589x1
1x2
870x1
870x1
9589x1
Bytes
Class
76712
16
6960
6960
76712
double
double
double
double
double
7-23
longlim
polylat
polylong
1x2
878x1
878x1
16
7024
7024
double
double
double
Note that the clipped data is only 10% as large as the original data set.
6 Plot the trimmed patch vectors on a Miller projection:
See the maptriml and maptrimp reference pages for further information.
7-24
Each location defined by lats and lons is mapped to a cell in grid, and the
value of that grid cell is obtained. If that value is found in allowed, that point
is output to flats and flons. Otherwise, the point is filtered out.
The grid might encode political units, and the allowed values might be the
code or codes indexing certain states or countries (e.g., Alabama). The grid
might also be real-valued (e.g., terrain elevations), although it could be
awkward to specify all the values allowed. More often, logical or relational
operators give better results for such grids, enabling the allowed value to be 1
(for true). For example, you could use this transformation of the topo grid:
[flats,flons] = filterm(lats,lons,double(topo>0),topolegend,1)
The output would be those points in lats and lons that occupy dry land
(mostly because some water bodies are above sea level).
For further information, see the filtermreference page. Also see Data Grids
as Logical Variables on page 7-40.
7-25
data, plotting maps at small scales, and creating versions of geodata for use
at small scales.
An easy, but naive, approach to point reduction is to discard every nth
element in each coordinate vector (simple decimation). However, this can
result in poor representations of the original shapes. The toolbox provides a
function to eliminate insignificant geometric detail in linear and polygonal
objects, while still maintaining accurate representations of their shapes.
The reducem function implements a powerful line simplification algorithm
(known as Douglas-Peucker) that intelligently selects and deletes visually
redundant points.
The reducem function takes latitude and longitude vectors, plus an optional
linear tolerance parameter as arguments, and outputs reduced (simplified)
versions of the vectors, in which deviations perpendicular to local trend lines
in the vectors are all greater than the tolerance criterion. Endpoints of vectors
are preserved. Optional outputs are an error measure and the tolerance value
used (it is computed when you do not supply a value).
Note Simplified line data might not always be appropriate for display. If all
or most intermediate points in a feature are deleted, then lines that appear
straight in one projection can be incorrectly displayed as straight lines in
others, and separate lines can be caused to intersect. In addition, when you
are reducing data over large world regions, the effective degree of reduction
near the poles are less than that achieved near the equator, due to the fact
that the algorithm treats geographic coordinates as if they were planar.
7-26
begin with:
maLat = ma.Lat;
maLon = ma.Lon;
numel(maLat)
ans =
957
3 Use reducem to simplify the boundary vectors, and inspect the results:
ans =
252
4 The number of points used to represent the boundary has dropped from 958
ans =
0.2633
7-27
The vectors have been reduced to about a quarter of their original size
using the default tolerance.
5 Examine the error and tolerance values returned by reducem:
[cerr tol]
ans =
0.0331
0.0060
The cerr value says that only 3.3% of total boundary length was eliminated
(despite removing 74% of the points). The tolerance that achieved this was
computed by reducem as 0.006 decimal degrees, or about 0.66 km.
6 Use geoshow to plot the reduced outline in red over the original outline
in blue:
figure
axesm('MapProjection', 'eqdcyl', 'FlatLim', [41.1 43.0],...
'FlonLim', [-69.8, -73.6], 'Frame', 'off', 'Grid', 'off');
geoshow(maLat, maLon, 'DisplayType', 'line', 'color', 'blue')
geoshow(maLat1, maLon1, 'DisplayType', 'line', 'color', 'red')
Differences in details are not apparent unless you zoom in two or three
times; click the Zoom tool to explore the map.
7 Double the tolerance, and reduce the original boundary into new variables:
numel(maLat2)/numel(maLat)
ans =
0.1641
[cerr2 tol2]
7-28
ans =
0.0517 0.0120
geoshow(maLat2, maLon2, 'DisplayType', 'line', 'color', [0 .6 0])
Now you have removed 84% of the points, and 5.2% of total length.
9 Repeat one more time, raising the tolerance to 0.1 degrees, and plot the
result in black:
[maLat3, maLon3, cerr3, tol3] = reducem(maLat', maLon', 0.1);
geoshow(maLat3, maLon3, 'DisplayType', 'line', 'color', 'black')
As overlaid with the original data, the reduced state boundaries look like
this.
7-29
As this example and the composite map below demonstrate, the visual
effects of point reduction are subtle, up to a point. Most of the vertices can
be eliminated before the effects of line simplification are very noticeable.
Experimentation is usually required, because the visual effects a given value
for a tolerance yield depend on the degrees and types of line complexity, and
they are often nonlinear with respect to tolerance values. Also, the extent of
line detail reduction should be informed by the purpose of the map and the
scale at which it is to be displayed.
Note This exercise generalized a set of disconnected patches. When patches
are contiguous (such as the U.S. state outlines), using reducem can result in
inconsistencies in boundary representation and gaps at points where states
meet. For best results, reducem should be applied to line data.
7-30
42.5 N
42.5 N
42.0 N
42.0 N
41.5 N
No reduction
957 points (100%)
73 W
72 W
71 W
41.5 N
70 W
73 W
42.5 N
42.5 N
42.0 N
42.0 N
41.5 N
73 W
72 W
71 W
41.5 N
70 W
72 W
71 W
70 W
71 W
70 W
73 W
72 W
7-31
indiana = shaperead('usastatehi.shp',...
'UseGeoCoords', true,...
'Selector', {@(name)strcmpi('Indiana',name), 'Name'});
inLat = indiana.Lat;
inLon = indiana.Lon;
7-32
2 Set the grid density to be 40 cells per degree, and use vec2mtx to rasterize
Name
gridDensity
inGrid
inLat
inLon
inRefVec
indiana
Size
1x1
164x137
1x626
1x626
1x3
1x1
Bytes
8
179744
5008
5008
24
10960
Class
double
double
double
double
double
struct
The resulting grid contains doubles, and has 80 rows and 186 columns.
3 Make a map of the data grid in contrasting colors:
figure
axesm eqdcyl
meshm(inGrid, inRefVec)
colormap jet(4)
7-33
7-34
5 To fill (recode) the interior of Indiana, you need a seed point (which must
be identified by row and column) and a seed value (to be allocated to all
cells within the polygon). Select the middle row and column of the grid and
choose an index value of 3 to identify the territory when calling encodem to
generate a new grid:
inPt = round([size(inGrid)/2, 3]);
inGrid3 = encodem(inGrid, inPt,1);
The last argument (1) identifies the code for boundary cells, where filling
should halt.
6 Clear and redraw the map using the filled grid:
meshm(inGrid3, inRefVec)
7-35
7 Plot the original vectors on the grid to see how well data was rasterized:
plotm(inLat, inLon,'k')
The resulting map is shown on the left below. Use the Zoom tool on
the figure window to examine the gridding results more closely, as the
right-hand figure shows.
7-36
See the vec2mtx and encodem reference pages for further information. imbedm
is a related function for gridding point values.
7-37
meLat = [centralUS.Lat];
meLon = [centralUS.Lon];
2 Rasterize the trimmed polygons at a 1-arc-minute resolution (60 cells per
figure
axesm eqdcyl
geoshow(meLat, meLon, 'Color', 'r');
meshm(meGrid, meRefVec)
colormap jet(8)
4 Use getseeds to interactively pick seed points for Indiana, Michigan, Ohio,
7-38
ans =
207
219
212
56
393
140
326
506
459
433
3
4
5
6
7
The MATLAB prompt returns after you pick five locations in the figure
window. As you chose them yourself, your row and col numbers will differ.
5 Use encodem to fill each country with a unique value, producing a new grid:
clma
meshm(meGrid5, meRefVec)
7-39
See the getseeds reference page for more information. Themaptrim and
seedm GUI tools are also useful in this context.
This transforms all values greater than 0 into 1s and all other values to 0s.
You can apply multiple conditions to a grid in one operation:
logicalgrid = (realgrid >- 100)&(realgrid < 100);
If several grids are the same size and share the same referencing vector (i.e.,
the grids are co-registered), you can create a logical grid by testing joint
conditions, treating the individual data grids as map layers:
logicalgrid = (population > 10000)&(elevation < 400)&...
(country == nigeria);
Several Mapping Toolbox functions enable the creation of logical grids using
logical and relational operators. Grids resulting from such operations contain
logical rather than numeric values (which reduce storage by a factor of 8), but
might need to be cast to double in order to be used in certain functions. Use
the onem and zerom functions to create grids of all 1s and all 0s.
7-40
1 You can use the topo grid and the greater-than relational operator to
a =
0.2890
The answer is about 30%. (Note that land areas below sea level are
excluded.)
2 You can include a planetary radius in specified units if you want the result
to have those units. Here is the same query specifying units of square
kilometers:
a = areamat((topo > 0),topoR,almanac('earth','radius'))
a =
1.4739e+08
3 Use the usamtx data grid codes to find the area of a specific state within
the U.S.A. As an example, determine the area of the state of Texas, which
is coded as 46 in the usamtx grid:
load usamtx
a = areamat((map == 46), refvec, almanac('earth', 'radius'))
a =
6.2528e+005
The grid codes 625,277 square kilometers of land area as belonging to the
U.S.
4 You can construct more complex queries. For instance, using the last
example, compute what portion of the land area of the conterminous U.S.
7-41
that Texas occupies (water and bordering countries are coded with 2 and
3, respectively):
usaland = areamat((map > 3 | map == 1), maplegend);
texasland = areamat((map == 46), maplegend);
texasratio = texasland/usaland
texasratio =
0.0735
This indicates that Texas occupies roughly 7.35% of the land area of the
U.S.
For further information, see the areamat reference page.
figure;
load korea
2 Get its latitude and longitude limits using limitm and use them to set up
7-42
3 Render the map and apply a digital elevation model (DEM) colormap to it:
meshm(map,maplegend,size(map),map)
demcmap(map)
4 Define endpoints for a straight-line transect through the region:
plot3m(lat,lon,z,'w','LineWidth',2)
7-43
figure; plot(rng,z,'r')
The mapprofile function has other useful options, including the ability to
interactively define tracks and specify units of distance for them. For further
information, see the mapprofile reference page.
7-44
directions. If the grid contains elevations in meters, the aspect and slope
are the angles of the surface normal clockwise from north and up from the
horizontal. Slope is defined as the change in elevation per unit distance along
the path of steepest ascent or descent from a grid cell to one of its eight
immediate neighbors, expressed as the arctangent. The angles are in units
of degrees by default.
Name
aspect
datagrid
gradE
gradN
gridrv
slope
Size
100x100
100x100
100x100
100x100
1x3
100x100
Bytes
Class
80000
80000
80000
80000
24
80000
double
double
double
double
double
double
3 Map the surface data in a cylindrical equal area projection. Start with
7-45
title('Peaks: elevation')
axis square
4 Clear the frame and display the slope grid:
The maps of the peaks surface elevation and gradient data are shown below.
See the gradientm reference page for additional information.
7-46
7-47
7-48
8
Using Map Projections and
Coordinate Systems
All geospatial data must be flattened onto a display surface in order to visually
portray what exists where. The mathematics and craft of map projection are
central to this process. Although there is no limit to the ways geodata can
be projected, conventions, constraints, standards, and applications generally
prescribe its usage. This chapter describes what map projections are, how
they are constructed and controlled, their essential properties, and some
possibilities and limitations.
What Is a Map Projection? on page 8-2
Quantitative Properties of Map Projections on page 8-3
The Three Main Families of Map Projections on page 8-5
Projection Aspect on page 8-10
Projection Parameters on page 8-18
Visualizing and Quantifying Projection Distortions on page 8-27
Accessing, Computing, and Inverting Map Projection Data on page 8-37
Working with the UTM System on page 8-51
Summary and Guide to Projections on page 8-63
If you are not acquainted with the types, properties, and uses of map
projections, read the first four sections. When constructing mapsespecially
in an environment in which a variety of projections are readily availableit is
important to understand how to evaluate projections to select one appropriate
to the contents and purpose of a given map.
8-2
8-3
8-4
Cylindrical Projections
A cylindrical projection is produced by wrapping a cylinder around a globe
representing the Earth. The map projection is the image of the globe projected
onto the cylindrical surface, which is then unwrapped into a flat surface.
When the cylinder aligns with the polar axis, parallels appear as horizontal
lines and meridians as vertical lines. Cylindrical projections can be either
equal-area, conformal, or equidistant. The following figure shows a regular
cylindrical or normal aspect orientation in which the cylinder is tangent to the
8-5
Earth along the Equator and the projection radiates horizontally from the axis
of rotation. The projection method is diagrammed on the left, and an example
is given on the right (equal-area cylindrical projection, normal/equatorial
aspect).
8-6
Conic Projections
A conic projection is derived from the projection of the globe onto a cone placed
over it. For the normal aspect, the apex of the cone lies on the polar axis of the
Earth. If the cone touches the Earth at just one particular parallel of latitude,
it is called tangent. If made smaller, the cone will intersect the Earth twice, in
which case it is called secant. Conic projections often achieve less distortion at
mid- and high latitudes than cylindrical projections. A further elaboration is
the polyconic projection, which deploys a family of tangent or secant cones to
bracket a succession of bands of parallels to yield even less scale distortion.
The following figure illustrates conic projection, diagramming its construction
on the left, with an example on the right (Albers equal-area projection, polar
aspect).
8-7
Azimuthal Projections
An azimuthal projection is a projection of the globe onto a plane. In polar
aspect, an azimuthal projection maps to a plane tangent to the Earth at one
of the poles, with meridians projected as straight lines radiating from the
pole, and parallels shown as complete circles centered at the pole. Azimuthal
projections (especially the orthographic) can have equatorial or oblique
aspects. The projection is centered on a point, that is either on the surface,
at the center of the Earth, at the antipode, some distance beyond the Earth,
or at infinity. Most azimuthal projections are not suitable for displaying the
entire Earth in one view, but give a sense of the globe. The following figure
illustrates azimuthal projection, diagramming it on the left, with an example
on the right (orthographic projection, polar aspect).
8-8
8-9
Projection Aspect
A map projections aspect is its orientation on the page or display screen. If
north or south is straight up, the aspect is said to be equatorial; for most
projections this is the normal aspect. When the central axis of the developable
surface is oriented east-west, the projections aspect is transverse. Projections
centered on the North Pole or the South Pole have a polar aspect, regardless
of what meridian is up. All other orientations have an oblique aspect. So far,
the examples and discussions of map displays have focused on the normal
aspect, by far the most commonly used. This section discusses the use of
transverse, oblique, and skew-oblique aspects.
Projection aspect is primarily of interest in the display of maps. However, this
section also discusses how the idea of projection aspect as a coordinate system
transformation can be applied to map variables for analytical purposes.
The latitude and longitude represent the geographic coordinates of the center
point of the display from which the projection is calculated. The orientation
refers to the clockwise angle from straight up at which the North Pole points
from this center point. The default orientation vector is [0 0 0]; that is, the
projection is centered on the geographic point (0,0) and the North Pole is
straight up from this point. Such a display is in a normal aspect. Changes to
only the longitude value of the orientation vector do not change the aspect;
thus, a normal aspect is one centered on the Equator in latitude with an
orientation of 0.
Both of these Miller projections have normal aspects, despite having different
orientation vectors:
8-10
Projection Aspect
This makes sense if you think about a simple, true cylindrical projection. This
is the projection of the globe onto a cylinder wrapped around it. For normal
aspects, this cylinder is tangent to the globe at the Equator, and changing
the origin longitude simply corresponds to rotating the sphere about the
longitudinal axis of the cylinder. If you continue with the wrapped-cylinder
model, you can understand the other aspects as well.
Following this description, a transverse projection can be thought of as a
cylinder wrapped around the globe tangent at the poles and along a meridian
and its antipodal meridian. Finally, when such a cylinder is tangent along
any great circle other than a meridian, the result is an oblique projection.
Here are diagrams of the four cylindrical map orientations, or aspects:
8-11
Normal
Oblique
Transverse
Skew-Oblique
Of course, few projections are true cylindrical projections, but the concept of
the wrapped cylinder is nonetheless a convenient way to describe aspect.
8-12
Projection Aspect
figure;
axesm sinusoid
framem on; gridm on; tightmap tight
load coast
patchm(lat, long,'g')
getm(gca,'Origin')
ans =
0
a transverse aspect, imagine pulling the North Pole down to the center of
the display, which was originally occupied by the point (0,0). Do this by
setting the first element of Origin parameter to a latitude of 90N:
setm(gca,'Origin',[90 0 0])
8-13
8-14
Projection Aspect
As in the previous example, the location (45N,0E) still occupies the center
of the map.
8-15
8-16
Projection Aspect
8-17
Projection Parameters
Every projection has at least one parameter that controls how it transforms
geographic coordinates into planar coordinates. Some projections are rather
fixed, and aside from the orientation vector and nominal scale factor, have no
parameters that the user should vary, as to do so would violate the definition
of the projection. For example, the Robinson projection has one standard
parallel that is fixed by definition at 38 North and South; the Cassini and
Wetch projections cannot be constructed in other than Normal aspect. In
general, however, projections have several variable parameters. The following
section discusses map projection parameters and provides guidance for
setting them.
8-18
Projection Parameters
The graticule and frame for the default map projection are shown below.
75 N
60 N
180 W
120 W
60 W
45 N
30 N
15 N
00
15 S
30 S
45 S
60 E
120 E
180 E
60 S
75 S
8-19
2 Query the map axes handle using getm to inspect the properties that pertain
getm(h,'scalefactor')
ans =
1
getm(h,'nparallels')
ans =
1
getm(h,'mapparallels')
ans =
0
getm(h,'falsenorthing')
ans =
0
getm(h,'falseeasting')
ans =
0
8-20
Projection Parameters
getm(h,'zone')
ans =
[]
getm(h,'maplatlimit')
ans =
-86
86
getm(h,'maplonlimit')
ans =
-180
180
getm(h,'Flatlimit')
ans =
-86
86
getm(h,'Flonlimit')
ans =
-180
180
For more information on these and other map axes properties, see the
reference page for axesm.
3 Reset the projection type to equal-area conic ('eqaconic'). The figure is
redrawn to reflect the change. Determine the parameters that the toolbox
changes in response:
setm(h,'Mapprojection', 'eqaconic')
getm(h,'aspect')
ans =
normal
getm(h,'origin')
8-21
ans =
0
getm(h,'scalefactor')
ans =
1
getm(h,'nparallels')
ans =
2
getm(h,'mapparallels')
ans =
15
75
getm(h,'falsenorthing')
ans =
0
getm(h,'falseeasting')
ans =
0
getm(h,'zone')
ans =
[]
getm(h,'maplatlimit')
ans =
-86
86
getm(h,'maplonlimit')
8-22
Projection Parameters
ans =
-135
135
getm(h,'Flatlimit')
ans =
-86
86
getm(h,'Flonlimit')
ans =
-135
135
4 Now set the projection type to Stereographic ('stereo') and examine the
8-23
getm(h,'origin')
ans =
0
getm(h,'scalefactor')
ans =
1
getm(h,'nparallels')
ans =
0
getm(h,'mapparallels')
ans =
[]
getm(h,'falsenorthing')
ans =
0
getm(h,'falseeasting')
ans =
0
getm(h,'zone')
ans =
[]
getm(h,'maplatlimit')
ans =
-90
8-24
90
Projection Parameters
getm(h,'maplonlimit')
ans =
-180
180
getm(h,'Flatlimit')
ans =
-Inf
90
getm(h,'Flonlimit')
ans =
-180
180
8-25
Chapter 14, Map Projections Reference (available online and in the PDF
version of this document) lists and illustrates all supported Mapping Toolbox
map projections, including suggestions for parameter usage.
8-26
figure;
axesm sinusoid
gridm on;framem on;
setm(gca,'Origin', [20 30 45])
2 Load the coast data set and plot it as green patches:
8-27
load coast
patchm(lat,long,'g')
3 Plot the default Tissot diagram, shown below:
tissot
Notice that the circles vary considerably in shape. This indicates that the
Sinusoidal projection is not conformal. Despite the distortions, however,
the circles all cover equal amounts of area on the map, because the
projection has the equal-area property.
Default Tissot diagrams are drawn with blue unfilled 100-point circles
spaced 30 degrees apart in both directions. The default circle radius is 1/10
of the current radius of the reference ellipsoid (by default that radius is 1).
4 Now clear the Tissot diagram, rotate the projection to a polar aspect, and
plot a new Tissot diagram using circles paced 20 degrees apart, half as big
as before, drawn with 20 points, and drawn in red:
clmo tissot
setm(gca,'Origin', [90 0 45])
tissot([20 20 .05 20],'Color','r')
The result is shown below. Note that circles are drawn faster because fewer
points are computed for each one. Also note that the distortions are still
smallest close to the map origin, and still greatest near the map frame.
8-28
8-29
load coast
patchm(lat,long,'g')
3 Call mdistort to plot contours of minimum-to-maximum scale ratios:
mdistort('scaleratio')
figure;
axesm('MapProjection','bonne','Grid','on','Frame','on')
patchm(lat,long,'g')
mdistort('scaleratio')
Hammer
Bonne
some other types of distortion. The types you can request are
area Percent departures from equal area
angles Angular distortion of right angles
scale or maxscale Percent of maximum scale
8-30
However, if you are evaluating the current map figure, omit the mstruct. You
need not specify any return values following the last one of interest to you.
8-31
specify a five-degree graticule, and then plot the outline for reference:
figure;
axesm('MapProjection','mercator','grid','on', ...
'MapLatLimit',mlatlim,'MapLonLimit',mlonlim,...
'MLineLocation',5, 'PLineLocation',5)
plotm(alat,alon,'b')
8-32
alats = alat(1:10:numel(alat));
alons = alon(1:10:numel(alat));
5 Compute the area distortions (the first value returned by distortcalc) at
2.7716
8-33
extended farther toward the pole. To see how much larger, get the area
distortion for 50S, 60S, and 70S:
8-34
a=distortcalc(-50,-60)
a =
2.4203
a=distortcalc(-60,-60)
a =
4
>> a=distortcalc(-70,-60)
a =
8.5485
Note You can only use distortcalc to query locations that are within the
current map frame or mstruct limits. Outside points yield NaN as a result.
9 Using this technique, you can write a simple script that lets you query a
Naturally the answer you get will vary depending on what point you pick.
Using this technique, you can write a simple script that lets you query a
map repeatedly to determine any distortion statistic at any desired location.
8-35
Try changing the map projection or even the orientation vector to see how
the choice of projection affects map distortion. For further information, see
the reference page for distortcalc.
8-36
8-37
figure;
ha = axesm('mollweid')
2 Observe that the axes has no XData, YData, or children information:
get(ha,'XData')
??? Error using ==> get
Invalid axes property: 'XData'.
get(ha,'YData')
??? Error using ==> get
Invalid axes property: 'YData'.
get(ha,'children')
ans =
Empty matrix: 0-by-1
3 Display a map frame for the Mollweide projection, obtaining its handle.
xf = get(hf,'XData');
yf = get(hf,'YData');
8-38
load coast
hl = plotm(lat,long)
hl =
106
get(ha, 'children')
ans =
106
105
xline = get(hl,'XData');
yline = get(hl,'YData');
The xline and yline coordinates are 1-by-9591 row vector arrays. Inspect
their contents before proceeding.
7 The units for projected coordinates are established by the ellipsoid vector.
By default, these units are Earth radii, but you can change them at any
time using setm to control the geoid property. For example, set the units
to kilometers on a spherical earth with
setm(gca,'Geoid', almanac('earth','sphere','kilometers'))
Repeat step 6 above to see how this affects coordinate values. See The
Ellipsoid Vector on page 3-4 for further information on specifying
coordinate units and ellipsoids.
8-39
Sinusoidal projection.
mstruct = defaultm('sinusoid');
The structure mstruct appears in the workspace. Use the property editor to
view its fields and contents.
2 Set the map limits for the mstruct. You must invoke defaultm a second
time to fully populate the fields of the map projection structure and to
ensure that the effects of property settings are properly implemented.
mstruct.maplonlimit = [-150 -30];
mstruct.geoid = almanac('earth','grs80','kilometers');
mstruct = defaultm(mstruct);
3 Note that the origin longitude is centered between the longitude limits.
mstruct.origin
4 Trim the coast to the map limits set above.
load coast
[latt,lont] = maptriml(lat,long, ...
mstruct.maplatlimit,mstruct.maplonlimit);
5 Having defined the map projection parameters, project the latitude and
longitude vectors into plane coordinates with the Sinusoidal projection and
display the result using nonmapping MATLAB graphic commands.
[x,y] = mfwdtran(mstruct,latt,lont);
figure
plot(x,y)
axis equal
8-40
The plot shows that resulting data are projected in the specified aspect.
For additional information, see the reference pages for defaultm and
mfwdtran. It is also possible to reverse the process using minvtran, as the
next section, Inverse Map Projection on page 8-41, describes. You may also
use projfwd and projinv, which are newer Mapping Toolbox functions that
use the PROJ.4 map projection library to do forward and inverse projections,
respectively. See the references pages for projfwd and projinv for details.
8-41
source or vendor, you need to know its correct projection parameters in order
for inverse projection to be successful.
Size
9589x1
9589x1
1x1
9599x1
9599x1
Bytes
Class
76712
76712
7360
76792
76792
double
double
struct
double
double
array
array
array
array
array
The difference in size between lat and long and x and y are due to clipping
the x-y data to the map frame (NaNs are inserted at clip locations).
2 Transform the projected x-y data back into geographic coordinates with
8-42
8-43
Note Geographic angles are measured clockwise from north, while projected
angles are measured counterclockwise from the x-axis.
1 Set up an equidistant conic projection for the northern hemisphere:
figure;
axesm('eqdconic','MapLatLimit',[-10 45],'MapLonLimit',[-55 55])
gridm; framem; mlabel; plabel; tightmap
2 Define three locations along the equator:
lats = [0 0 0];
lons = [-45 0 45];
3 Define north and east azimuths for each point:
northazs = [0 0 0];
eastazs = [90 90 90];
4 Compute the projected direction of north for each location:
pnorth = vfwdtran(lats,lons,northazs)
ans =
59.614
90
120.39
North varies from about 60 from the x-axis, to vertical, to 120 from the
x-axis, quite symmetrically.
5 Compute projected direction of east for each location:
peast = vfwdtran(lats,lons,eastazs)
ans =
-30.385
0.0001931
30.386
90
90
pnorth - peast
ans =
90
8-44
The projected east vectors show a similar symmetry, and as expected form
complementary angles to north.
6 Use quiverm to plot the six vectors on the projection; note their plane
angles:
quiverm(lats, lons, [0 0 0], [10 10 10], 0)
quiverm(lats, lons, [10 10 10], [0 0 0], 0)
For more information, see the reference pages for vfwdtran and quiverm.
Coordinate Transformations
In The Orientation Vector on page 8-10, you explored the concept of altering
the aspect of a map projection in terms of pushing the North Pole to new
locations. Another way to think about this is to redefine the coordinate
system, and then to compute a normal aspect projection based on the new
system. For example, you might redefine a spherical coordinate system so
that your home town occupies the origin. If you calculated a map projection
in a normal aspect with respect to this transformed coordinate system, the
resulting display would look like an oblique aspect of the true coordinate
system of latitudes and longitudes.
This transformation of coordinate systems can be useful independent of map
displays. If you transform the coordinate system so that your home town
8-45
is the new North Pole, then the transformed coordinates of all other points
will provide interesting information.
Note The types of coordinate transformations described here are appropriate
for the spherical case only. Attempts to perform them on an ellipsoid will
produce incorrect answers on the order of several to tens of meters.
When you place your home town at a pole, the spherical distance of each
point from your hometown becomes 90 minus its transformed latitude (also
known as a colatitude). The point antipodal to your town would become the
South Pole, at -90. Its distance from your hometown is 90-(-90), or 180, as
expected. Points 90 distant from your hometown all have a transformed
latitude of 0, and thus make up the transformed equator. Transformed
longitudes correspond to their respective great circle azimuths from your
home town.
midl_lat = 32;
midl_lon = -102;
tuls_lat = 36.2; tuls_lon = -96;
newo_lat = 30;
newo_lon = -90;
2 Use the distance function to determine great circle distances and azimuths
8-46
6.5032
az2tuls =
48.1386
[dist2neworl az2neworl] = distance(midl_lat,midl_lon,...
newo_lat,newo_lon)
dist2neworl =
10.4727
az2neworl =
97.8644
Tulsa is about 6.5 degrees distant, New Orleans about 10.5 degrees distant.
3 Compute the absolute difference in azimuth, a fact you will use later.
azdif = abs(az2tuls-az2neworl)
azdif =
49.7258
4 Today, you feel on top of the world, so make Midland, Texas, the north pole
The origin of the new coordinate system is (58N, 78E). Midland is now at
a new latitude of 90.
5 Determine the transformed coordinates of Tulsa and New Orleans using
8-47
tuls_lat1 =
83.4968
tuls_lon1 =
-48.1386
[newo_lat1,newo_lon1] = rotatem(newo_lat,newo_lon,...
origin,'forward','degrees')
newo_lat1 =
79.5273
newo_lon1 =
-97.8644
6 Show that the new colatitudes of Tulsa and New Orleans equal their
cities from Midland was 49.7258. Verify that this equals the difference in
their new longitudes:
tuls_lon1-newo_lon1
ans =
49.7258
You might note small numerical differences in the results (on the order of
10-6), due to roundoff error and trigonometric functions.
For further information, see the reference pages for rotatem, newpole,
putpole, neworig, and org2pol.
8-48
[Z,lat,lon] = neworig(topo,topolegend,origin);
Note that the result, [Z,lat,lon], is a geolocated data grid, not a regular
data grid like the original topo data.
3 Display the new map:
axesm miller
latlim = [ -90 90];
lonlim = [-180 180];
gratsize = [90 180];
[lat,lon] = meshgrat(latlim,lonlim,gratsize);
surfm(lat,lon,Z);
demcmap(topo)
mstruct = getm(gca);
mstruct.origin
4 This map is displayed in normal aspect, as its orientation vector shows:
8-49
mstruct = getm(gca);
mstruct.origin
ans =
0
An interesting feature of this new grid is that every cell in its first row is 01
distant from the point (7N, 80E), and every cell in its second row is 12
distant, etc. Another feature is that every cell in a particular column has the
same great circle azimuth from the new origin.
8-50
8-51
axesm utm
2 Get the map axes properties and inspect them in the Command Window or
with the Variable Editor. The first few illustrate the projection defaults:
h = getm(gca)
mapprojection: 'utm'
zone: '31N'
angleunits: 'degrees'
aspect: 'normal'
falsenorthing: 0
falseeasting: 500000
fixedorient: []
geoid: [6.3782e+006 0.082483]
maplatlimit: [0 8]
maplonlimit: [0 6]
mapparallels: []
nparallels: 0
origin: [0 3 0]
scalefactor: 0.9996
trimlat: [-80 84]
trimlon: [-180 180]
frame: 'off'
ffill: 100
fedgecolor: [0 0 0]
ffacecolor: 'none'
flatlimit: [0 8]
flinewidth: 2
8-52
flonlimit: [-3 3]
...
Note that the default zone is 31N. This is selected because the map origin
defaults to [0 3 0], which is on the equator and at a longitude of 3 E. This is
the center longitude of zone 31N, which has a latitude limit of [0 8], and a
longitude limit of [0 6].
3 Move the zone one to the east, and inspect the other parameters again:
setm(gca,'zone','32n')
h = getm(gca)
mapprojection: 'utm'
zone: '32N'
angleunits: 'degrees'
aspect: 'normal'
falsenorthing: 0
falseeasting: 500000
fixedorient: []
geoid: [6.3782e+006 0.082483]
maplatlimit: [0 8]
maplonlimit: [6 12]
mapparallels: []
nparallels: 0
origin: [0 9 0]
scalefactor: 0.9996
trimlat: [-80 84]
trimlon: [-180 180]
frame: 'off'
ffill: 100
fedgecolor: [0 0 0]
ffacecolor: 'none'
flatlimit: [0 8]
flinewidth: 2
flonlimit: [-3 3]
...
Note that the map origin and limits are adjusted for zone 32N.
4 Draw the map grid and label it:
8-53
setm(gca,'grid','on','meridianlabel','on','parallellabel','on')
5 Load and plot the coast data set to see a close-up of the Gulf of Guinea
8-54
1 You can Shift+click in a map axes window, or type axesmui to display the
Universal Transverse
Mercator (UTM).
Note For UTM and UPS maps, the Aspect field is set to normal and
cannot be changed. If you attempt to specify transverse, an error results.
2 Click the Zone button to open the utmzoneui panel. Click the map near
8-55
Note that while you can open the utmzoneui control panel from the
command line, you then have to manually update the figure with the zone
name it returns with a setm command:
setm(gca,'zone',ans)
3 Click the Accept button.
The utmzoneui panel closes, and the zone field is set to the one you picked.
The map limits are updated accordingly, and the geoid parameters are
automatically set to an appropriate ellipsoid definition for that zone. You
can override the default choice by selecting another ellipsoid from the list
or by typing the parameters in the Geoid field.
8-56
8-57
What you see depends on the zone you selected. The preceding display
is for zone 18T, which contains portions of New England and the Middle
Atlantic states.
You can also calculate projected UTM grid coordinates from latitudes and
longitudes:
[latlim, lonlim] = utmzone('15S')
latlim =
32
40
lonlim =
-96
-90
[x,y] = mfwdtran(latlim, lonlim)
x =
8-58
-1.5029e+006 -7.8288e+005
y =
3.7403e+006 4.5369e+006
p1 = [40.7, -74.0];
2 Obtain the UTM zone for this point:
z1 = utmzone(p1)
z1 =
18T
3 Obtain the suggested ellipsoid vector and name for this zone:
[ellipsoid,estr] = utmgeoid(z1)
ellipsoid =
6.3782e+006
estr =
clarke66
0.082272
utmstruct = defaultm('utm');
utmstruct.zone = '18T';
utmstruct.geoid = ellipsoid;
utmstruct = defaultm(utmstruct)
8-59
[x,y] = mfwdtran(utmstruct,p1(1),p1(2))
x =
5.8448e+005
y =
4.5057e+006
More on utmzone
You can also use the utmzone function to compute the zone limits for a given
zone name. For example, using the preceding data, the latitude and longitude
limits for zone 18T are
utmzone('18T')
ans =
40
48
-78
-72
Therefore, you can call utmzone recursively to obtain the limits of the UTM
zone within which a point location falls:
[zonelats zonelons] = utmzone(utmzone(40.7, -74.0))
zonelats =
40
48
zonelons =
-78
-72
For further information, see the reference pages for utmzone, utmgeoid, and
defaultm.
8-60
Note You might receive warnings about points from landareas.shp falling
outside the valid projection region. You can ignore such warnings.
8-61
8-62
Projection
Syntax
Type
Equal-Area
Conformal
Equidistant
Balthasart
balthsrt
Cylindrical
Behrmann
behrmann
Cylindrical
Bolshoi Sovietskii
Atlas Mira
bsam
Cylindrical
Braun Perspective
braun
Cylindrical
Cassini
cassini
Cylindrical
Central
ccylin
Cylindrical
Equal-Area Cylindrical
eqacylin
Cylindrical
Equidistant
Cylindrical
eqdcylin
Cylindrical
Gall Isographic
giso
Cylindrical
Gall Orthographic
gortho
Cylindrical
Gall Stereographic
gstereo
Cylindrical
Lambert Equal-Area
Cylindrical
lambcyln
Cylindrical
Special
Features
8-63
8-64
Equal-Area
Projection
Syntax
Type
Mercator
mercator
Cylindrical
Miller
miller
Cylindrical
Plate Carre
pcarree
Cylindrical
Trystan Edwards
trystan
Cylindrical
Universal Transverse
Mercator (UTM)
utm
Cylindrical
Wetch
wetch
Cylindrical
Apianus II
apianus
Pseudocylindrical
Collignon
collig
Pseudocylindrical
Craster Parabolic
craster
Pseudocylindrical
Eckert I
eckert1
Pseudocylindrical
Eckert II
eckert2
Pseudocylindrical
Eckert III
eckert3
Pseudocylindrical
Eckert IV
eckert4
Pseudocylindrical
Eckert V
eckert5
Pseudocylindrical
Eckert VI
eckert6
Pseudocylindrical
Fournier
fournier
Pseudocylindrical
Goode Homolosine
goode
Pseudocylindrical
Conformal
Equidistant
Special
Features
Equal-Area
Projection
Syntax
Type
Hatano Asymmetrical
Equal-Area
hatano
Pseudocylindrical
Kavraisky V
kavrsky5
Pseudocylindrical
Kavraisky VI
kavrsky6
Pseudocylindrical
Loximuthal
loximuth
Pseudocylindrical
McBryde-Thomas
Flat-Polar Parabolic
flatplrp
Pseudocylindrical
McBryde-Thomas
Flat-Polar Quartic
flatplrq
Pseudocylindrical
McBryde-Thomas
Flat-Polar Sinusoidal
flatplrs
Pseudocylindrical
Mollweide
mollweid
Pseudocylindrical
Putnins P5
putnins5
Pseudocylindrical
Quartic Authalic
quartic
Pseudocylindrical
Robinson
robinson
Pseudocylindrical
Sinusoidal
sinusoid
Pseudocylindrical
Tissot Modified
Sinusoidal
modsine
Pseudocylindrical
Wagner IV
wagner4
Pseudocylindrical
Winkel I
winkel
Pseudocylindrical
Conformal
Equidistant
Special
Features
8-65
8-66
Projection
Syntax
Type
Equal-Area
Conformal
Equidistant
Special
Features
Albers Equal-Area
Conic
eqaconic
Conic
Equidistant Conic
eqdconic
Conic
Lambert Conformal
Conic
lambert
Conic
Murdoch I Conic
murdoch1
Conic
murdoch3
Conic
Bonne
bonne
Pseudoconic
Werner
werner
Pseudoconic
Polyconic
polycon
Polyconic
vgrint1
Polyconic
Breusing Harmonic
Mean
breusing
Azimuthal
Equidistant Azimuthal
eqdazim
Azimuthal
Gnomonic
gnomonic
Azimuthal
Lambert Azimuthal
Equal-Area
eqaazim
Azimuthal
Orthographic
ortho
Azimuthal
Stereographic
stereo
Azimuthal
Universal Polar
Stereographic (UPS)
ups
Azimuthal
Vertical Perspective
Azimuthal
vperspec
Azimuthal
Wiechel
wiechel
Pseudoazimuthal
Aitoff
aitoff
Modified
Azimuthal
Equal-Area
Projection
Syntax
Type
Briesemeister
bries
Modified
Azimuthal
Hammer
hammer
Modified
Azimuthal
Globe
globe
Spherical
Conformal
Equidistant
Special
Features
in azimuth.
3 Correct total area.
4 Straight line great circles.
5 Great and small circles appear as circles or lines.
6 Three-dimensional display (not a map projection).
8-67
8-68
9
Creating Web Map Service
Maps
Introduction to Web Map Service on page 9-2
Basic Workflow for Creating WMS Maps on page 9-5
Searching the WMS Database on page 9-8
Refining Your Search on page 9-11
Updating Your Layer on page 9-13
Retrieving Your Map on page 9-15
Modifying Your Request on page 9-22
Overlaying Multiple Layers on page 9-30
Animating Data Layers on page 9-40
Saving Favorite Servers on page 9-50
Exploring Other Layers from a Server on page 9-52
Writing a KML File on page 9-55
Searching for Layers Outside the Database on page 9-56
Hosting Your Own WMS Server on page 9-57
Common Problems with WMS Servers on page 9-58
9-2
As an example, the WMS Global Mosaic map displays data from Landsat7
satellite scenes.
Courtesy NASA/JPL-Caltech
The Ozone Effect on Global Warming map displays data from the NASA
Goddard Institute for Space Studies (GISS) computer model study.
9-3
9-4
Refine your search again to include only the layer with DEM (Digital
Elevation Model) in the LayerName field.
demlayer = euroheight.refine('DEM', 'SearchField', 'layername');
3 Update your layer. You can skip this optional step for this example. The
9-5
background color, and other properties of the map. In this simple example,
you can skip this step.
5 Retrieve your map:
First, set up a map axes with projection and geographic limits appropriate
for Europe.
figure
worldmap europe;
Then, return the map axes map structure, which contains the settings for
all the current map axes properties.
mstruct = gcm;
Use the WMSLayer object elevation as input for wmsread. Set the wmsread
longitude and latitude limit parameters to the current map axes limits.
[elevationImage,R] = wmsread(demlayer, 'Latlim', ...
mstruct.maplatlimit, 'Lonlim', mstruct.maplonlimit);
geoshow(elevationImage,R);
title({'Europe','Elevation'}, 'FontWeight', 'bold')
9-6
9-7
9-8
Field Name
Data Type
Field Content
ServerTitle
String
ServerURL
String
LayerTitle
String
LayerName
String
Field Name
Data Type
Field Content
Latlim
Two-element
vector
Lonlim
Two-element
vector
The LayerTitle and LayerName fields sometimes have the same values. The
LayerName indicates a code used by the servers, such as '29:2', while the
LayerTitle provides more descriptive information. For instance, 'Elevation
and Rivers with Backdrop' is a LayerTitle.
wmsfind is the only WMS function that accesses the stored WMS Database.
The following example illustrates how to use wmsfind to find a layer.
layers = wmsfind('temperature');
9-9
A WMSLayer object contains three fields that do not appear in the WMS
DatabaseAbstract, CoordRefSysCodes, and Details. (By default, these
fields do not display in the command window if they are not populated with
wmsupdate. For more information, see Updating Your Layer on page 9-13
in the Mapping Toolbox Users Guide.)
Note WMSLayer is one of several classes related to WMS. If you are new to
object-oriented programming, you can learn more about classes, methods,
and properties in the Object-Oriented Programming section of the MATLAB
documentation.
9-10
temperature.
layers = wmsfind('temperature');
sst = layers.refine('sea surface');
2 Refine the search again to include only layers that contain the term global.
global_sst = sst.refine('global');
3 Display one of the layers.
global_sst(4).disp
Sample Output:
Index:
ServerTitle:
ServerURL:
LayerTitle:
4
'NASA SVS Image Server'
'http://aes.gsfc.nasa.gov/cgi-bin/wms?'
'Background Image for Global Sea Surface ...
Temperature Anomalies from June, 2002 ...
to September, 2003 (WMS)'
LayerName: '2906_17499_bg'
Latlim: [-90.0000 90.0000]
Lonlim: [-180.0000 180.0000]
9-11
layers = wmsfind('hurricane');
2 Refine your search by selecting layers that are in the western hemisphere.
temperature data.
temp_and_west = western_hemisphere.refine('temperature');
9-12
Temperature.
global_sst = wmsfind ('Global Sea Surface Temperature', ...
'SearchField', 'LayerTitle');
2 Use the WMSLayer servers method to determine the number of unique
servers.
global_sst.servers
3 If your search returns more than one server, consider setting the wmsupdate
Type daily.Abstract at the command line to view the abstract. The data
for this layer updates daily; thus the name of the layer.
9-13
Sample Output:
Global sea surface temperature. The data used are from the
DUE/Medspiration project which is a real-time service for
the production and delivery of high-resolution sea surface
temperature from all available satellite sensors. The data
cover the period from 2007-10-01 and is updated daily.
5 Type daily.CoordRefSysCodes at the command line to view the coordinate
command line.
Sample Output:
ans =
MetadataURL:
Attributes:
BoundingBox:
Dimension:
ImageFormats:
ScaleLimits:
Style:
Version:
[1x75 char]
[1x1 struct]
[1x1 struct]
[1x1 struct]
{4x1 cell}
[1x1 struct]
[1x1 struct]
'1.3.0'
You can go to the URL listed in the MetadataURL field to learn more about
when and how this data was collected. The Style field covers a wide range
of information, such as the line styles used to render vector data, the
background color, the numeric format of data, the month of data collection,
or the dimensional units. In this case, the WMS server provides no style
information.
9-14
9-15
those layers with the phrase 'bluemarble' in the LayerName field. This
syntax creates an exact search.
layer = nasa.refine('bluemarble',
'MatchType', 'exact');
[A, R] = wmsread(layer);
9-16
4 Open a figure window, set up your map axes, and display your map.
figure
axesm globe
axis off
geoshow(A, R)
title('Blue Marble')
Courtesy NASA/JPL-Caltech
layers. Search the WMS Database for layers that contain the string
'esa.int' in the ServerURL field.
9-17
function to determine the background color and cell size as you retrieve
your map.
[A,R] = wmsread(gtopo30Layer, 'BackgroundColor', oceanColor, ...
'CellSize', 0.5);
5 Open a figure window, set up a world map axes, and display your map.
figure
worldmap world
geoshow(A, R)
6 Load and plot coastline data and title your map.
coast = load('coast');
plotm(coast.lat, coast.long)
title('GTOPO30 Elevation Model')
9-18
mars = wmsfind('shadedred');
2 Update the results from multiple servers by setting the
9-19
4 Use the WebMapServer handle object and the WMSLayer object to create a
WMSMapRequest object.
request = WMSMapRequest(mars, server);
5 Use the WMSMapRequest.boundImageSize method to bound the size of the
output map such that the longest dimension has a size of 2048 pixels.
request = request.boundImageSize(2048);
6 The WMSMapRequest class includes a RequestURL property composed of the
server URL with additional WMS parameters and values. Obtain your
map of Mars by passing the WMSMapRequest.RequestURL of request to the
WebMapServer.getMap method of server.
A = server.getMap(request.RequestURL);
7 Open a figure window and set the window to black.
figure
set(gcf,'color','black')
8 Set the axes.
axesm globe
axis off
9 Display the map. The geoshow function accepts an image and a referencing
9-20
9-21
(ESA) server.
esa = wmsfind('esa.int', 'SearchField', 'serverurl');
2 Refine your search to include only layers with 'global sea surface' in
WebMapServer object.
mapRequest = WMSMapRequest(sst, server);
9-22
5 Use the Latlim and Lonlim properties of WMSMapRequest to set the latitude
mapRequest.BackgroundColor = [0 0 0];
7 Send your request to the server with the WebMapServer.getMap method.
Pass in a WMSMapRequest.RequestURL.
sstImage = server.getMap(mapRequest.RequestURL);
8 Set up empty map axes with the specified geographic limits.
figure
worldmap(mapRequest.Latlim, mapRequest.Lonlim);
9 Project and display an image georeferenced to latitude and longitude.
9-23
Courtesy ESA
server = WebMapServer(layer.ServerURL);
9-24
WebMapServer object.
mapRequest = WMSMapRequest(layer, server);
4 Set the geographic limits of the WMSMapRequest object.
mapRequest.ImageHeight = ...
round(diff(mapRequest.Latlim)/samplesPerInterval);
7 Set the ImageWidth property.
mapRequest.ImageWidth = ...
round(diff(mapRequest.Lonlim)/samplesPerInterval);
8 Set the StyleName property to 'short_int' for meters. (The Abstract
mapRequest.ImageFormat = 'image/geotiff';
10 After setting the WMSMapRequest properties, send the RequestURL of your
method.
Z = server.getMap(mapRequest.RequestURL);
11 Open a figure window and set up a map axes with geographic limits that
9-25
figure
worldmap(mapRequest.Latlim, mapRequest.Lonlim)
12 Convert your map data to double precision and display it on your map
demcmap(double(Z))
14 Use the zbuffer renderer setting because this example uses lighting.
set(gcf,'Renderer','zbuffer')
15 Display and contour the map at sea level (0 m).
9-26
Courtesy NASA/JPL
command line.
Sample Output:
ans =
http://g0hep12u.ecs.nasa.gov/mapserv-bin/wms_ogc? ...
SERVICE=WMS ...
9-27
&LAYERS=bluemarble ...
&EXCEPTIONS=application/vnd.ogc.se_xml ...
&FORMAT=image/jpeg&TRANSPARENT=FALSE ...
&HEIGHT=256 ...
&BGCOLOR=0xFFFFFF ...
&REQUEST=GetMap ...
&WIDTH=512 ...
&BBOX=-180.0,-90.0,180.0,90.0 ...
&STYLES=&SRS=EPSG:4326 ...
&VERSION=1.1.1
3 Modify the bounding box to include the southern hemisphere by directly
Then enter the lengthy URL as shown in the previous code sample, but
change the bounding box:
&BBOX=-180.0,-90.0,180.0,0.0
[A, R] = wmsread(modifiedURL);
figure
axesm globe
axis off
geoshow(A, R)
title('Blue Marble: Southern Hemisphere Edition')
9-28
Courtesy NASA/JPL-Caltech
9-29
Visualization server.
vizglobe = wmsfind('viz.globe', 'SearchField', 'serverurl');
coastlines = vizglobe.refine('coastline');
national_boundaries = vizglobe.refine('national*bound');
base_layer = vizglobe.refine('egm96');
2 Concatenate the results into a single WMSLayer array.
layers = [base_layer;coastlines;national_boundaries];
3 Construct a WMSMapRequest object from the WMSLayer array. (For this to
9-30
raster map.
request = request.boundImageSize(720);
6 Pass the RequestURL of request to WebMapServer.getMap to retrieve your
composite map.
overlayImage = request.Server.getMap(request.RequestURL);
7 Display your composite map.
figure
worldmap('world')
geoshow(overlayImage, request.RasterRef);
title(base_layer.LayerTitle)
9-31
figure
worldmap('world')
geoshow(boundariesImage, R);
title(national_boundaries.LayerTitle)
10 Compare the composite map with all three layers with the contoured data
9-32
rivers = shaperead('worldrivers.shp','UseGeoCoords',true);
riverImage = vec2mtx([rivers.Lat], [rivers.Lon], landImage, refvec);
3 Merge the rivers with the land.
9-33
mergedImage(riverImage == 1) = 3;
4 Merge the rivers and land with the boundaries. You must first flip
where columns run from south to north. (The columns of WMS images run
from north to south.)
mergedImage = flipud(mergedImage);
mergedImage(boundariesImage(:,:,1) == 0) = 1;
5 Display the result.
figure
worldmap(mergedImage, R)
geoshow(mergedImage, R, 'DisplayType', 'texturemap')
colormap([.45 .60 .30; 0 0 0; 0 0.5 1; 0 0 1])
9-34
1 Uncompress the zip file and read it with the ugs24kdem function. Set the
geographic limits to the minimum and maximum values in the DEM file.
filenames = gunzip('sanfranciscos.dem.gz', tempdir);
demFilename = filenames{1};
[lat,lon,Z,header,profile] = usgs24kdem(demFilename, 1);
delete(demFilename);
Z(Z==0) = -1;
latlim = [min(lat(:)) max(lat(:))];
lonlim = [min(lon(:)) max(lon(:))];
2 Display the USGS 24K DEM data. Create map axes for the United States
9-35
from various regions of the United States. The ortho-imagery layer name
is UrbanArea, and the topographic layer name is DRG (short for Digital
Raster Graphic).
terraserver = wmsfind('terraservice.net','search','serverurl');
orthoLayer = terraserver.refine('UrbanArea');
topoLayer = terraserver.refine('DRG');
5 Construct a WebMapServer object for the ortho-imagery layer.
server = WebMapServer(orthoLayer.ServerURL);
6 Construct a WMSMapRequest object from the WebMapServer object and the
9-36
mapRequest.ImageHeight = size(Z,1);
mapRequest.ImageWidth = size(Z,2);
7 Request a map of the ortho-imagery layer.
orthoImage = server.getMap(mapRequest.RequestURL);
8 Request a map of the topographic layer.
mapRequest.Layer = topoLayer;
topoMap = server.getMap(mapRequest.RequestURL);
9 Drape the ortho-image onto the elevation data.
figure
usamap(latlim, lonlim)
geoshow(lat, lon, Z, ...
'DisplayType', 'surface', 'CData', orthoImage);
daspectm('m',1)
title('San Francisco Ortho-Image');
axis vis3d
set(gca,'CameraPosition', cameraPosition, ...
'CameraTarget', cameraTarget, ...
'CameraViewAngle', cameraAngle)
9-37
figure
usamap(latlim, lonlim)
geoshow(lat, lon, Z, ...
'DisplayType', 'surface', 'CData', topoMap);
daspectm('m',1)
title('San Francisco Topo Map');
axis vis3d
set(gca,'CameraPosition', cameraPosition, ...
'CameraTarget', cameraTarget, ...
'CameraViewAngle', cameraAngle)
9-38
9-39
daily = wmsfind('daily');
daily_planet = daily.refine('planet');
2 Construct a WebMapServer object.
server = WebMapServer(daily_planet.ServerURL);
3 Construct a WMSMapRequest object.
of January.
9-40
numberOfFrames = 31;
6 Open a figure window with axes appropriate for the region specified by the
daily_planet layer.
figure
worldmap(mapRequest.Latlim, mapRequest.Lonlim);
7 Retrieve a map of the daily_planet layer for each day of the month of
Courtesy NASA/JPL-Caltech
9-41
server = WebMapServer(iceLayer(1).ServerURL);
3 Use the WebMapServer.updateLayers method to synchronize the layer
with the WMS source server. Retrieve the most recent data and fill in the
Abstract, CoordRefSysCodes, and Details fields.
iceLayer = server.updateLayers(iceLayer(1));
4 View the abstract.
fprintf('%s\n', iceLayer(1).Abstract)
5 Create the WMSMapRequest object.
Click Details in the Variable Editor. Then, click Dimension. The name
of the dimension is 'time'. Click Extent. The Extent field provides the
available values for a dimension, in this case time. Save this information
by entering the following at the command line:
extent = [',' iceLayer.Details.Dimension.Extent, ','];
7 Calculate the number of required frames. (The extent contains a comma
before the first frame and after the last frame. To obtain the number of
frames, subtract 1.)
frameIndex = findstr(extent, ',');
numFrames = numel(frameIndex) - 1;
9-42
8 Open a figure window and set up a map axes with appropriate geographic
limits.
h = figure;
worldmap(request.Latlim, request.Lonlim)
9 Set the map axes properties. MLineLocation establishes the interval
animated(1,1,1,numFrames) = 0;
11 Display the image of the Larsen Ice Shelf on different days.
for k=1:numFrames
request.Time = extent(frameIndex(k)+1:frameIndex(k+1)-1);
iceImage = server.getMap(request.RequestURL);
geoshow(iceImage, request.RasterRef)
title(request.Time, 'Interpreter', 'none')
drawnow
shg
frame = getframe(h);
if k == 1
[animated, cmap] = rgb2ind(frame.cdata, 256, 'nodither');
else
animated(:,:,1,k) = rgb2ind(frame.cdata, cmap, 'nodither');
end
end
12 Save and then view the animated GIF file.
filename = 'wmsanimated.gif';
imwrite(animated, cmap, filename, 'DelayTime', 1.5, ...
'LoopCount', inf);
web(filename)
9-43
precipitation. Refine your search to include only layers with this phrase
in one of the search fields.
nexrad = mesonet.refine('nexrad-n0r', 'SearchField', 'any');
9-44
3 Update your nexrad layer to fill in all fields and obtain most recent data.
Also remove the WMST layer because it contains data for different times.
index = strcmpi('nexrad-n0r-900913',{nexrad.LayerName});
nexrad(index) = [];
index = strcmpi('nexrad-n0r-wmst',{nexrad.LayerName});
nexrad(index) = [];
5 'conus' represents the conterminous 48 U.S. states (all except Hawaii
and Alaska). Use the usamap function to construct a map axes for the
conterminous states. Read in the nexrad layers.
region = 'conus';
figure
usamap(region)
mstruct = gcm;
latlim = mstruct.maplatlimit;
lonlim = mstruct.maplonlimit;
[A, R] = wmsread(nexrad, 'Latlim', latlim, 'Lonlim', lonlim, ...
'Transparent', true);
6 Display the NEXRAD merged layers map. Overlay with United States
9-45
hfig = figure;
usamap(region)
geoshow('usastatehi.shp', 'FaceColor', 'none');
numFrames = numel(nexrad);
frames = struct('cdata', [], 'colormap', []);
frames(numFrames) = frames;
hmap = [];
frameIndex = 0;
for k = numFrames:-1:1
frameIndex = frameIndex + 1;
delete(hmap)
[A, R] = wmsread(nexrad(k), 'Latlim', latlim, 'Lonlim', lonlim);
hmap = geoshow(A, R);
title(nexrad(k).LayerName)
drawnow
frames(frameIndex) = getframe(hfig);
9-46
end
8 Create an array to write out as an animated GIF file.
animated(1,1,1,numFrames) = 0;
for k=1:numFrames
if k == 1
[animated, cmap] = rgb2ind(frames(k).cdata, 256, 'nodither');
else
animated(:,:,1,k) = ...
rgb2ind(frames(k).cdata, cmap, 'nodither');
end
end
9 View the animated GIF file.
filename = 'wmsnexrad.gif';
imwrite(animated, cmap, filename, 'DelayTime', 1.5, ...
'LoopCount', inf);
web(filename)
region = 'conus';
9-47
hfig = figure;
usamap(region)
mstruct = gcm;
4 Obtain geographic limits and read the backdrop image.
latlim = mstruct.maplatlimit;
lonlim = mstruct.maplonlimit;
cellsize = .1;
backdrop = wmsread(backdrop, 'ImageFormat', 'image/png', ...
'Latlim', latlim, 'Lonlim', lonlim, 'Cellsize', cellsize);
5 Calculate current time minus 24 hours and set up frames to hold the data
from getframe.
now_m24 = datestr(now-1);
hour_m24 = [now_m24(1:end-5) '00:00'];
hour = datenum(hour_m24);
hmap = [];
numFrames = 24;
frames = struct('cdata', [], 'colormap', []);
frames(numFrames) = frames;
6 For each hour, obtain the hourly NEXRAD map data and combine it with a
copy of the backdrop. Because of how this Web server handles PNG format,
the resulting map data has an image with class double. Thus, you must
convert it to uint8 before merging.
geoshow('usastatehi.shp', 'FaceColor', 'none');
black = [0,0,0];
threshold = 0;
for k=1:numFrames
time = datestr(hour);
[A, R] = wmsread(wmst, 'Latlim', latlim, 'Lonlim', lonlim, ...
'Time', time, 'CellSize', cellsize, ...
'BackgroundColor', black, 'ImageFormat', 'image/png');
delete(hmap)
index = any(A > threshold, 3);
combination = backdrop;
index = cat(3,index,index,index);
combination(index) = uint8(255*A(index));
9-48
numTimes = 10;
fps = 1.5;
movie(hfig, frames, numTimes, fps);
9-49
nasa = wmsfind('nasa','SearchField','serverurl');
esa = wmsfind('esa.int','SearchField','serverurl');
whoi = wmsfind('whoi','SearchField','serverurl');
favoriteLayers = [nasa; esa; whoi];
favoriteLayers = wmsupdate(favoriteLayers, ...
'AllowMultipleServers', true);
favoriteServers = favoriteLayers.servers;
2 Save your favorite layers in a MAT-file.
fields, so you can search within any field, including the Abstract.
windSpeed = favoriteLayers.refine('wind speed','SearchFields','any')
In the following output, the phrase wind speed does not occur in the
LayerTitle or LayerName fields, but it does occur in the Abstract.
Sample Output:
Index: 14
ServerTitle: 'NASA SVS Image Server'
ServerURL: 'http://svs.gsfc.nasa.gov/cgi-bin/wms?'
LayerTitle: 'Hurricane Dennis (Sequence)'
LayerName: '3194_22037'
Latlim: [8.9033 42.1490]
Lonlim: [-95.7348 -62.7839]
Abstract: 'The formation of Hurricane Dennis on July 5 ...
made that the earliest date on record that four named storms ...
formed in the Atlantic basin....After re-emerging over open ...
9-50
9-51
capabilities.LayerNames
Sample Output:
ans =
'CO'
'NO2'
'NOX'
'NOY'
'O3'
'SO2'
'pm10'
3 Read the Carbon Monoxide ('CO') layer.
layer = capabilities.Layer.refine('CO');
[A,R] = wmsread(layer,'cellsize',.1,'ImageFormat','image/png');
4 Set the longitude and latitude limits to the values specified for the layer.
latlim = layer.Latlim;
lonlim = layer.Lonlim;
5 Display the map.
figure
9-52
usamap(layer.Latlim, layer.Lonlim)
geoshow('usastatehi.shp','FaceColor','none','EdgeColor','black')
geoshow(A,R)
title(layer.LayerTitle)
Courtesy EPA
6 Examine the Style field. (Open layer and then Details and then Style.)
There are two structures. The style of the first one is set to 'data'. Read
the layer again with the StyleName set to 'data' and the cell size set to
0.1 degree resolution. (When the style is set to 'data', the map does not
include a legend.)
[A,R] = wmsread(layer,'cellsize',.1, ...
'ImageFormat','image/png','StyleName','data');
figure
usamap(layer.Latlim, layer.Lonlim)
geoshow('usastatehi.shp','FaceColor','none','EdgeColor','black')
geoshow(A,R)
title(layer.LayerTitle)
9-53
Courtesy EPA
9-54
request = WMSMapRequest(landsat);
request.Latlim = [36.042423, 36.161439];
request.Lonlim = [-113.358918, -113.129789];
3 Request the pseudo-color image with infrared and visual bands.
request.StyleName = 'pseudo';
4 Request an image format that opens in Google Earth.
request.ImageFormat = 'application/vnd.google-earth.kml+xml';
5 Use the urlwrite function to write out a KML file.
filename = 'landsat.kml';
urlwrite(request.RequestURL, filename);
6 Open the file with Google Earth to view.
9-55
engine. If you are using Google, select Images and enter the following in
the search box: getmap wms.
2 View the images to choose a map. Click the map link and find the WMS
document.
c = wmsinfo(url);
4 Next, read in a layer and display it as a map.
9-56
9-57
Connection Errors
One of the challenges of working with WMS is that sometimes you can have
trouble connecting to a server.
Time-Out Error
A server may issue a time-out error such as:
Connection timed out: connect
Or
Read timed out
System Overload
The NASA Jet Propulsion Laboratory (JPL) server may issue an error
message due to server overloading:
Service denied due to system overload. Please try again later.
9-58
9-59
WMSServlet Removed
If the columbo.nrlssc.navy.mil server issues an error such as:
WebMapServer cannot communicate to the host columbo.nrlssc.navy.mil.
The host is unknown.
Wrong Scale
The columbo.nrlssc.navy.mil server often throws this error message:
This layer is not visible for this scale. The maximum valid scale
is approximately X. Zoom in and try again if desired. The scale of
the image requested is Y.
X and Y represent specific values that vary from layer to layer.
Workaround: Some of the WMS sources this server accesses have map
layers sensitive to the requested scale. Zoom in (choose a smaller region of
interest), or zoom out (choose a larger region of interest). Alternatively, you
can select a larger output image size to view the layer at the appropriate scale.
9-60
Workaround: To address this problem, set the Latlim and Lonlim properties
of WMSLayer:
layer = wmsfind('SampleServer.com', 'SearchField', 'serverurl');
layer = wmsupdate(layer);
latlim = [min(layer.Latlim), max(layer.Latlim)];
lonlim = [min(layer.Lonlim), max(layer.Lonlim)];
layer.Latlim = [max([ -90, latlim(1)]), min([ 90, latlim(2)])];
layer.Lonlim = [max([-180, lonlim(1)]), min([180, lonlim(2)])];
[A,R] = wmsread(layer);
Update your layer before setting the limits. Otherwise, wmsread updates the
limits from the server, and you once again have descending limits.
9-61
the layers position in this sequence, the LayerName property has changed.
For layers from the columbo.nrlssci.navy.mil server, wmsupdate matches
the LayerTitle property rather than the LayerName property.
9-62
&CRS=EPSG:4326');
Workaround: This problem occurs because the server breaks with the
requirements of the OGC standard and returns the XML capabilities
document rather than the requested map. Choose a different layer or server.
times (20)
9-63
9-64
10
Mapping Applications
This chapter describes several types of numerical applications for geospatial
data, including computing and spatial statistics, and calculating tracks,
routes, and other information useful for solving navigation problems.
Geographic Statistics on page 10-2
Navigation on page 10-11
10
Mapping Applications
Geographic Statistics
In this section...
Statistics for Point Locations on a Sphere on page 10-2
Geographic Means on page 10-2
Geographic Standard Deviation on page 10-4
Equal-Areas in Geographic Statistics on page 10-7
Geographic Means
Consider the problem of calculating the mean position of a collection of
geographic points. Taking the arithmetical mean of the latitudes and
longitudes using the standard MATLAB mean function may seem reasonable,
but doing this could yield misleading results.
10-2
Geographic Statistics
Take two points at the same latitude, 180 apart in longitude, for example
(30N,90W) and (30N,90E). The mean latitude is (30+30)/2=30, which seems
right. Similarly, the mean longitude must be (90+(-90))/2=0. However, as
one can also express 90W as 270E, (90+270)/2=180 is also a valid mean
longitude. Thus there are two correct answers, the prime meridian and
the dateline. This demonstrates how the sphericity of the Earth introduces
subtleties into spatial statistics.
This problem is further complicated when some points are at different
latitudes. Because a degree of longitude at the Arctic Circle covers a much
smaller distance than a degree at the equator, distance between points having
a given difference in longitude varies by latitude.
Is in fact 30N the right mean latitude in the first example? The mean
position of two points should be equidistant from those two points, and should
also minimize the total distance. Does (30N,0) satisfy these criteria?
dist1 = distance(30,90,30,0)
dist1 =
75.5225
dist2 = distance(30,-90,30,0)
dist2 =
75.5225
Consider a third point, (lat,lon), that is also equidistant from the above
two points, but at a lesser distance:
dist1 = distance(30,90,lat,lon)
dist1 =
60.0000
dist2 = distance(30,-90,lat,lon)
dist2 =
60.0000
What is this mystery point? The lat is 90N, and any lon will do. The North
Pole is the true geographic mean of these two points. Note that the great
circle containing both points runs through the North Pole (a great circle
represents the shortest path between two points on a sphere).
10-3
10
Mapping Applications
The Mapping Toolbox function meanm determines the geographic mean of any
number of points. It does this using three-dimensional vector addition of all
the points. For example, try the following:
lats = [30 30];
longs = [-90 90];
[latbar,longbar] = meanm(lats,longs)
latbar =
90
longbar =
0
This is the answer you now expect. This geographic mean can result in one
oddity; if the vectors all cancel each other, the mean is the center of the
planet. In this case, the returned mean point is (NaN,NaN) and a warning is
displayed. This phenomenon is highly improbable in real data, but can be
easily constructed. For example, it occurs when all the points are equally
spaced along a great circle. Try taking the geographic mean of (0,0), (0,120),
and (0,240), which trisect the equator.
elats = [0 0 0];
elons = [60 120 240];
meanm(elats, elons)
ans =
0 120.0000
10-4
Geographic Statistics
The function returns two deviations, one for latitudes and one for longitudes.
Latitude deviation is a straightforward standard deviation calculation from
the mean latitude (mean parallel) returned by meanm. This is a reasonable
measure for most cases, since on a sphere at least, a degree of latitude always
has the same arc length.
Longitude deviation is another matter. Simple calculations based on
sum-of-squares angular deviation from the mean longitude (mean meridian)
are misleading. The arc length represented by a degree of longitude at
extreme latitudes is significantly smaller than that at low latitudes.
The term departure is used to represent the arc length distance along a
parallel of a point from a given meridian. For example, assuming a spherical
planet, the departure of a degree of longitude at the Equator is a degree of
arc length, but the departure of a degree of longitude at a latitude of 60 is
one-half a degree of arc length. The stdm function calculates a sum-of-squares
departure deviation from the mean meridian.
If you want to plot the one-sigma lines for stdm, the latitude sigma lines are
parallels. However, the longitude sigma lines are not meridians; they are
lines of constant departure from the mean parallel.
Longitude one-sigma
lines are not meridians
Latitude one-sigma
lines are parallels
Mean Position
This handling of deviation has its problems. For example, its dependence upon
the logic of the coordinate system can cause it to break down near the poles.
For this reason, the standard distance provided by stdist is often a better
10-5
10
Mapping Applications
In short, the standard distance is the average, norm, or cubic norm of the
distances of the data points in a great circle sense from the mean position.
It is probably a superior measure to the two deviations returned by stdm
except when a particularly latitude- or longitude-dependent feature is under
examination.
Standard
Distance
Mean Position
10-6
Geographic Statistics
Geographic Histograms
The geographic histogram function histr allows you to display binned-up
geographic observations. The histr function results in equirectangular
binning. Each bin has the same angular measurement in both latitude and
longitude, with a default measurement of 1 degree. The center latitudes and
longitudes of the bins are returned, as well as the number of observations
per bin:
[binlat,binlon,num] = histr(lats,lons)
10-7
10
Mapping Applications
The fourth output is the weighted observation count. Each bins observation
count is divided by its normalized area. Therefore, a high-latitude bin will
have a larger weighted number than a low-latitude bin with the same number
of actual observations. The same data and bins look much different when
they are area-weighted:
10-8
Geographic Statistics
Notice that there are larger symbols to the north in this display. The
previous display suggested that the data was relatively uniformly distributed.
When equal-area considerations are included, it is clear that the data is
skewed to the north. In fact, the data used is northerly skewed, but a simple
equirectangular handling failed to demonstrate this.
The histr function, therefore, does provide for the display of area-weighted
data. However, the actual bins used are of varying areas. Remember, the
one-degree-by-one-degree bin near a pole is much smaller than its counterpart
near the equator.
The hista function provides for actual equal-area bins.
10-9
10
Mapping Applications
10-10
Navigation
Navigation
In this section...
What Is Navigation? on page 10-11
Conventions for Navigational Functions on page 10-12
Fixing Position on page 10-13
Planning on page 10-25
Track Laydown Displaying Navigational Tracks on page 10-29
Dead Reckoning on page 10-31
Drift Correction on page 10-36
Time Zones on page 10-38
What Is Navigation?
Navigation is the process of planning, recording, and controlling the
movement of a craft or vehicle from one location to another. The word derives
from the Latin roots navis (ship) and agere (to move or direct). Geographic
informationusually in the form of latitudes and longitudesis at the core of
navigation practice. The toolbox includes specialized functions for navigating
across expanses of the globe, for which projected coordinates are of limited use.
Navigating on land, over water, and through the air can involve a variety
of tasks:
Establishing position, using known, fixed landmarks (piloting)
Using the stars, sun, and moon (celestial navigation)
Using technology to fix positions (inertial guidance, radio beacons, and
satellite navigation, including GPS)
Deducing net movement from a past known position (dead reckoning)
Another navigational task involves planning a voyage or flight, which includes
determining an efficient route (usually by great circle approximation),
weather avoidance (optimal track routing), and setting out a plan of intended
10-11
10
Mapping Applications
10-12
Navigation
waypoint 1
leg 1
waypoint 6
waypoint 5
waypoint 2
leg 5
leg 2
waypoint 3
waypoint 4
leg 4
leg 3
Here, five track legs require six waypoints. In navigational track format, the
waypoints are represented by two 6-by-1 vectors, one for the latitudes and
one for the longitudes.
Fixing Position
The fundamental objective of navigation is to determine at a given moment
how to proceed to your destination, avoiding hazards on the way. The first step
in accomplishing this is to establish your current position. Early sailors kept
within sight of land to facilitate this. Today, navigation within sight (or radar
range) of land is called piloting. Positions are fixed by correlating the bearings
and/or ranges of landmarks. In real-life piloting, all sighting bearings are
treated as rhumb lines, while in fact they are actually great circles.
Over the distances involved with visual sightings (up to 20 or 30 nautical
miles), this assumption causes no measurable error and it provides the
significant advantage of allowing the navigator to plot all bearings as straight
lines on a Mercator projection.
The Mercator was designed exactly for this purpose. Range circles, which
might be determined with a radar, are assumed to plot as true circles on a
Mercator chart. This allows the navigator to manually draw the range arc
with a compass.
These assumptions also lead to computationally efficient methods for fixing
positions with a computer. The toolbox includes the navfix function, which
mimics the manual plotting and fixing process using these assumptions.
10-13
10
Mapping Applications
Point A
Cape Jones
Point C
Gilligans
Lighthouse
Point B
Radio tower
But wait; your port lookout says he took a bearing on Cape Jones of 300. If
that line exactly crosses the point of intersection of the first two lines, you
will have a perfect fix.
10-14
Navigation
Point A
Cape Jones
Point C
Gilligans
Lighthouse
Point B
Radio tower
2
(poor fix)
3
Whoops. What happened? Is your lookout in error? Possibly, but perhaps one
or both of your bearings was slightly in error. This happens all the time.
Which point, 1, 2, or 3, is correct? As far as you know, they are all equally
valid.
In practice, the little triangle is plotted, and the fix position is taken as either
the center of the triangle or the vertex closest to a danger (like shoal water).
If the triangle is large, the quality is reported as poor, or even as no fix. If
a fourth line of bearing is available, it can be plotted to try to resolve the
ambiguity. When all three lines appear to cross at exactly the same point, the
quality is reported as excellent or perfect.
Notice that three lines resulted in three intersection points. Four lines would
return six intersection points. This is a case of combinatorial counting. Each
intersection corresponds to choosing two lines to intersect from among n lines.
The next time you traverse these straits, it is a very foggy morning. You
cant see any landmarks, but luckily, your navigational radar is operating.
Each of these landmarks has a good radar signature, so youre not worried.
10-15
10
Mapping Applications
You get a range from the radio tower of 14 nautical miles and a range from
the lighthouse of 15 nautical miles.
Point A
Cape Jones
Point C
Gilligans
Lighthouse
2
Point B
Radio tower
Now what? You took ranges from only two objects, and yet you have two
possible positions. This ambiguity arises from the fact that circles can
intersect twice.
Luckily, your radar watch reports that he has Cape Jones at 18 nautical
miles. This should resolve everything.
10-16
Navigation
Point A
Cape Jones
fix
Point C
Gilligans
Lighthouse
Point B
Radio tower
You were lucky this time. The third range resolved the ambiguity and gave
you an excellent fix. Three intersections practically coincide. Sometimes
the ambiguity is resolved, but the fix is still poor because the three closest
intersections form a sort of circular triangle.
Sometimes the third range only adds to the confusion, either by bisecting the
original two choices, or by failing to intersect one or both of the other arcs at
all. In general, when n arcs are used, 2x(n-choose-2) possible intersections
result. In this example, it is easy to tell which ones are right.
Bearing lines and arcs can be combined. If instead of reporting a third range,
your radar watch had reported a bearing from the radar tower of 20, the
ambiguity could also have been resolved. Note, however, that in practice,
lines of bearing for navigational fixing should only be taken visually, except
in desperation. A radars beam width can be a degree or more, leading to
uncertainty.
10-17
10
Mapping Applications
Point A
Cape Jones
fix
Point C
Gilligans
Lighthouse
Point B
Radio tower
Using navfix
The navfix function can be used to determine the points of intersection
among any number of lines and arcs. Be warned, however, that due to the
combinatorial nature of this process, the computation time grows rapidly with
the number of objects. To illustrate this function, assign positions to the
landmarks. Point A, Cape Jones, is at (latA,lonA). Point B, the radio tower, is
at (latB,lonB). Point C, Gilligans Lighthouse, is at (latC,lonC).
For the bearing-lines-only example, the syntax is:
[latfix,lonfix] = navfix([latA latB latC],[lonA lonB lonC],...
[300 270 0])
This defines the three points and their bearings as taken from the ship. The
outputs would look something like this, with actual numbers, of course:
10-18
Navigation
latfix =
latfix1
latfix2
latfix3
lonfix =
lonfix1
lonfix2
lonfix3
NaN
NaN
NaN
% A intersecting B
% A intersecting C
% B intersecting C
NaN
NaN
NaN
% A intersecting B
% A intersecting C
% B intersecting C
Notice that these are two-column matrices. The second column consists of
NaNs because it is used only for the two-intersection ambiguity associated
with arcs.
For the range-arcs-only example, the syntax is
[latfix,lonfix] = navfix([latA latB latC],[lonA lonB lonC],...
[16 14 15],[0 0 0])
This defines the three points and their ranges as taken from the ship. The
final argument indicates that the three cases are all ranges.
The outputs have the following form:
latfix =
latfix11
latfix21
latfix31
lonfix =
lonfix11
lonfix21
lonfix31
latfix12
latfix22
latfix32
% A intersecting B
% A intersecting C
% B intersecting C
lonfix12
lonfix22
lonfix32
% A intersecting B
% A intersecting C
% B intersecting C
Here, the second column is used, because each pair of arcs has two potential
intersections.
For the bearings and ranges example, the syntax requires the final input to
indicate which objects are lines of bearing (indicated with a 1) and which
are range arcs (indicated with a 0):
[latfix,lonfix] = navfix([latB latB latC],[lonB lonB lonC],...
[20 14 15],[1 0 0])
10-19
10
Mapping Applications
NaN
latfix22
latfix32
NaN
lonfix22
lonfix32
Only one intersection is returned for the line from B with the arc about B,
since the line originates inside the circle and intersects it once. The same line
intersects the other circle twice, and hence it returns two points. The two
circles taken together also return two points.
Usually, you have an idea as to where you are before you take the fix. For
example, you might have a dead reckoning position for the time of the fix (see
below). If you provide navfix with this estimated position, it chooses from
each pair of ambiguous intersections the point closest to the estimate. Heres
what it might look like:
[latfix,lonfix] = navfix([latB latB latC],[lonB lonB lonC],...
[20 14 15],[1 0 0],drlat,drlon)
latfix =
latfix11
% the only point
latfix21
% the closer point
latfix31
% the closer point
lonfix =
lonfix11
% the only point
lonfix21
% the closer point
lonfix31
% the closer point
10-20
Navigation
axesm('MapProjection','mercator','Frame','on',...
'MapLatLimit',[2.8 3.3],'MapLonLimit',[-56.3 -55.8])
plotm([lata latb latc],[lona lonb lonc],...
'LineStyle','none','Marker','pentagram',...
'MarkerEdgeColor','b','MarkerFaceColor','b',...
'MarkerSize',12)
Here is what it looks like (the labeling and imaginary coastlines are added
after the fact for illustration).
Point C
(3.15N, 55.95W)
Point A
(3.1N, 56.2vW)
Point B
(2.95N, 55.9W)
3 Take three visual bearings: Point A bears 289, Point B bears 135, and
10-21
10
Mapping Applications
newlat =
3.0214
3.0340
3.0499
newlong =
-55.9715
-56.0079
-56.0000
NaN
NaN
NaN
NaN
NaN
NaN
plotm(newlat,newlong,'LineStyle','none',...
'Marker','diamond','MarkerEdgeColor','r',...
'MarkerFaceColor','r','MarkerSize',9)
Point C
Point A
Point B
Notice that each pair of objects results in only one intersection, since all
are lines of bearing.
10-22
Navigation
5 What if instead, you had ranges from the three points, A, B, and C, of
Point C
Point A
Point B
10-23
10
Mapping Applications
6 What if, instead of a range from Point A, you had a bearing to it of 284?
Point C
Point A
Point B
Again, visual inspection of the results indicates which three of the six
possible points seem like reasonable positions.
7 When using the dead reckoning position (3.05N,56.0W), the closer, more
10-24
Navigation
Planning
You know that the shortest path between two geographic points is a great
circle. Sailors and aviators are interested in minimizing distance traveled,
and hence time elapsed. You also know that the rhumb line is a path of
constant heading, the natural means of traveling. In general, to follow a great
circle path, you would have to continuously alter course. This is impractical.
However, you can approximate a great circle path by rhumb line segments so
that the added distance is minor and the number of course changes minimal.
Surprisingly, very few rhumb line track legs are required to closely
approximate the distance of the great circle path.
Consider the voyage from Norfolk, Virginia (37N,76W), to Cape St. Vincent,
Portugal (37N,9W), one of the most heavily trafficked routes in the Atlantic.
A due-east rhumb line track is 3,213 nautical miles, while the optimal great
circle distance is 3,141 nautical miles.
Although the rhumb line path is only a little more than 2% longer, this is an
additional 72 miles over the course of the trip. For a 12-knot tanker, this
results in a 6-hour delay, and in shipping, time is money. If just three rhumb
line segments are used to approximate the great circle, the total distance of
the trip is 3,147 nautical miles. Our tanker would suffer only a half-hour
delay compared to a continuous rhumb line course. Here is the code for
computing the three types of tracks between Norfolk and St. Vincent:
figure('color','w');
ha = axesm('mapproj','mercator',...
'maplatlim',[25 55],'maplonlim',[-80 0]);
10-25
10
Mapping Applications
10-26
Navigation
75W
45N
60W
45W
30W
15W
Norfolk
St. Vincent
30N
All the inputs for this function are scalars a (starting and an ending position).
The numlegs input is the number of equal-length legs desired, which is
10 by default. The outputs are column vectors representing waypoints in
navigational track format ([heading distance]). The size of each of these
vectors is [(numlegs+1) 1]. Here are the points for this example:
[latpts,lonpts] = gcwaypts(norfolk(1),norfolk(2),...
stvincent(1),stvincent(2),3)
% Compute 3 waypoints
latpts =
37.0000
41.5076
41.5076
37.0000
lonpts =
-76.0000
-54.1777
10-27
10
Mapping Applications
-30.8223
-9.0000
These points represent waypoints along the great circle between which the
approximating path follows rhumb lines. Four points are needed for three
legs, because the final point at Cape St. Vincent must be included.
Now we can compute the distance in nautical miles (nm) along each track
and via the waypoints:
drh = distance('rh',norfolk,stvincent); % Get rhumb line dist (deg)
dgc = distance('gc',norfolk,stvincent); % Get gt. circle dist (deg)
% Compute headings and distances for the waypoint legs
[course distnm] = legs(latpts,lonpts,'rh');
deg2nm(drh)
deg2nm(dgc)
= sum(distnm)
distrhnm - distgcnm
distlegsnm - distgcnm
%
%
%
%
%
distrhnm =
3.2127e+003
distgcnm =
3.1407e+003
distlegsnm =
3.1490e+003
rhgcdiff =
71.9980
trgcdiff =
8.3446
Following just three rhumb line legs reduces the distance travelled from 72
nm to 8.3 nm compared to a great circle course.
10-28
Navigation
10-29
10
Mapping Applications
[lttrk,lntrk] = track(waypoints);
plotm(lttrk,lntrk,'r')
Although these track segments are straight lines on the Mercator projection,
they are curves on others:
The segments of a track like this are called legs. Each of these legs can be
described in terms of course and distance. The function legs will take the
waypoints in navigational track format and return the course and distance
required for each leg. Remember, the order of the points in this format
determines the direction of travel. Courses are therefore calculated from each
waypoint to its successor, not the reverse.
[courses,distances] = legs(waypoints)
courses =
90.0000
70.3132
90.0000
151.8186
98.0776
131.5684
distances =
145.6231
10-30
Navigation
356.2117
283.6839
204.2073
854.0092
135.6415
Since this is a navigation function, the courses are all in degrees and the
distances are in nautical miles. From these distances, speeds required to
arrive at Port Said at a given time can be calculated. Southbound traffic is
allowed to enter the canal only once per day, so this information might be
economically significant, since unnecessarily high speeds can lead to high
fuel costs.
Dead Reckoning
When sailors first ventured out of sight of land, they faced a daunting
dilemma. How could they find their way home if they didnt know where they
were? The practice of dead reckoning is an attempt to deal with this problem.
The term is derived from deduced reckoning.
Briefly, dead reckoning is vector addition plotted on a chart. For example, if
you have a fix at (30N,10W) at 0800, and you proceed due west for 1 hour
at 10 knots, and then you turn north and sail for 3 hours at 7 knots, you
should be at (30.35N,10.19W) at 1200.
10-31
10
Mapping Applications
However, a sailor shoots the sun at local apparent noon and discovers that the
ships latitude is actually 30.29N. Whats worse, he lives before the invention
of a reliable chronometer, and so he cannot calculate his longitude at all from
this sighting. What happened?
Leaving aside the difficulties in speed determination and the need to tack off
course, even modern craft have to contend with winds and currents. However,
despite these limitations, dead reckoning is still used for determining position
between fixes and for forecasting future positions. This is because dead
reckoning provides a certainty of assumptions that estimations of wind and
current drift cannot.
When navigators establish a fix from some source, be it from piloting, celestial,
or satellite observations, they plot a dead reckoning (DR) track, which is a
plot of the intended positions of the ship forward in time. In practice, dead
reckoning is usually plotted for 3 hours in advance, or for the time period
covered by the next three expected fixes. In open ocean conditions, hourly
fixes are sufficient; in coastal pilotage, three-minute fixes are common.
10-32
Navigation
Specific DR positions, which are sometimes called DRs, are plotted according
to the Rules of DR:
DR at every course change
DR at every speed change
DR every hour on the hour
DR every time a fix or running fix is obtained
DR 3 hours ahead or for the next three expected fixes
DR for every line of position (LOP), either visual or celestial
For example, the navigator plots these DRs:
Notice that the 1523 DR does not coincide with the LOP at 1523. Although
note is taken of this variance, one line is insufficient to calculate a new fix.
Mapping Toolbox function dreckon calculates the DR positions for a given set
of courses and speeds. The function provides DR positions for the first three
rules of dead reckoning. The approach is to provide a set of waypoints in
navigational track format corresponding to the plan of intended movement.
10-33
10
Mapping Applications
The time of the initial waypoint, or fix, is also needed, as well as the speeds to
be employed along each leg. Alternatively, a set of speeds and the times for
which each speed will apply can be provided. dreckon returns the positions
and times required of these DRs:
dreckon calculates the times for position of each course change, which
will occur at the waypoints
dreckon calculates the positions for each whole hour
If times are provided for speed changes, dreckon calculates positions for
these times if they do not occur at course changes
Imagine you have a fix at midnight at the point (10N,0):
waypoints(1,:) = [10 0]; fixtime = 0;
You intend to travel east and alter course at the point (10N,0.13E) and head
for the point (10.1N,0.18E). On the first leg, you will travel at 5 knots, and
on the second leg you will speed up to 7 knots.
waypoints(2,:) = [10 .13];
waypoints(3,:) = [10.1 .18];
speeds = [5;7];
To determine the DR points and times for this plan, use dreckon:
[drlat,drlon,drtime] = dreckon(waypoints,fixtime,speeds);
[drlat drlon drtime]
ans =
10.0000
0.0846
1.0000
% Position at 1 am
10.0000
0.1301
1.5373
% Time of course change
10.0484
0.1543
2.0000
% Position at 2 am
10.1001
0.1801
2.4934
% Time at final waypoint
10-34
Navigation
However, you would like to get to the final point a little earlier to make a
rendezvous. You decide to recalculate your DRs based on speeding up to 7
knots a little earlier than planned. The first calculation tells you that you
were going to increase speed at the turn, which would occur at a time 1.5373
hours after midnight, or 1:32 a.m. (at time 0132 in navigational time format).
What time would you reach the rendezvous if you increased your speed to 7
knots at 1:15 a.m. (0115, or 1.25 hours after midnight)?
To indicate times for speed changes, another input is required, providing a
time interval after the fix time at which each ordered speed is to end. The
first speed, 5 knots, is to end 1.25 hours after midnight. Since you dont know
when the rendezvous will be made under these circumstances, set the time
for the second speed, 7 knots, to end at infinity. No DRs will be returned
past the last waypoint.
spdtimes = [1.25; inf];
[drlat,drlon,drtime] = dreckon(waypoints,fixtime,...
speeds,spdtimes);
[drlat,drlon,drtime]
ans =
10.0000
0.0846
1.0000
% Position at 1 am
10.0000
0.1058
1.2500
% Position at speed change
10.0000
0.1301
1.4552
% Time of course change
10.0570
0.1586
2.0000
% Position at 2 am
10.1001
0.1801
2.4113
% Time at final waypoint
10-35
10
Mapping Applications
The times at planned positions after the speed change are a little earlier; the
position at the known time (2 a.m.) is a little farther along. With this plan,
you will arrive at the rendezvous about 4 1/2 minutes earlier, so you may
want to consider a greater speed change.
Drift Correction
Dead reckoning is a reasonably accurate method for predicting position if the
vehicle is able to maintain the planned course. Aircraft and ships can be
pushed off the planned course by winds and current. An important step in
navigational planning is to calculate the required drift correction.
In the standard drift correction problem, the desired course and wind are
known, but the heading needed to stay on course is unknown. This problem
is well suited to vector analysis. The wind velocity is a vector of known
magnitude and direction. The vehicles speed relative to the moving air mass
is a vector of known magnitude, but unknown direction. This heading must be
chosen so that the sum of the vehicle and wind velocities gives a resultant in
the specified course direction. The ground speed can be larger or smaller than
the air speed because of headwind or tailwind components. A navigator would
10-36
Navigation
like to know the required heading, the associated wind correction angle, and
the resulting ground speed.
Course
Heading
Drift correction
angle
Drift
Ground
speed
Speed
What heading puts an aircraft on a course of 250 when the wind is 38 knots
from 285? The aircraft flies at an airspeed of 145 knots.
course = 250; airspeed = 145; windfrom = 285; windspeed = 38;
[heading,groundspeed,windcorrangle] = ...
driftcorr(course,airspeed,windfrom,windspeed)
heading =
258.65
groundspeed =
112.22
windcorrangle =
8.65
The required heading is about 9 to the right of the course. There is a 33-knot
headwind component.
10-37
10
Mapping Applications
A related problem is the calculation of the wind speed and direction from
observed heading and course. The wind velocity is just the vector difference of
the ground speed and the velocity relative to the air mass.
[windfrom,windspeed] = ...
driftvel(course,groundspeed,heading,airspeed)
windfrom =
285.00
windspeed =
38.00
Time Zones
Time zones used for navigation are uniform 15 extents of longitude. The
timezone function returns a navigational time zone, that is, one based solely
on longitude with no regard for statutory divisions. So, for example, Chicago,
Illinois, lies in the statutory U.S. Central time zone, which has irregular
boundaries devised for political or convenience reasons. However, from a
navigational standpoint, Chicagos longitude places it in the S (Sierra) time
zone. The zones description is +6, which indicates that 6 hours must be added
to local time to get Greenwich, or Z (Zulu) time. So, if it is noon, standard
time in Chicago, it is 12+6, or 6 p.m., at Greenwich.
Each 15 navigational time zone has a distinct description and designating
letter. The exceptions to this are the two zones on either side of the date line,
M and Y (Mike and Yankee). These zones are only 7-1/2 wide, since on one
side of the date line, the description is +12, and on the other, it is -12.
Navigational time zones are very important for celestial navigation
calculations. Although there are no Mapping Toolbox functions designed
specifically for celestial navigation, a simple example can be devised.
10-38
Navigation
F G H I K L
MY
X W V U T S R Q P O N Z A B C D E
10-39
10
Mapping Applications
-8
zltr =
H
zone =
-8 H
This means that at our longitude, 123E, we should experience local apparent
noon at 11:48 a.m., 12 minutes early.
10-40
11
Function Reference
Geospatial Data Import and Access
(p. 11-2)
Constructing, georeferencing,
analyzing, and manipulating raster
geodata
11
Function Reference
11-2
arcgridread
geotiffinfo
geotiffread
getworldfilename
kmlwrite
makeattribspec
sdtsdemread
sdtsinfo
shapeinfo
shaperead
shapewrite
worldfileread
worldfilewrite
dteds
etopo
globedem
globedems
gtopo30
gtopo30s
satbath
tbase
11-3
11
Function Reference
usgs24kdem
usgsdem
usgsdems
11-4
dcwdata
dcwgaz
dcwread
dcwrhead
fipsname
gshhs
tgrline
vmap0data
vmap0read
vmap0rhead
avhrrlambert
egm96geoid
readfk5
vmap0ui
readfields
readmtx
spcread
11-5
11
Function Reference
Display properties
refine (WMSLayer)
Refine search
refineLimits (WMSLayer)
servers (WMSLayer)
serverTitles (WMSLayer)
updateLayers (WebMapServer)
WebMapServer
WMSCapabilities
wmsfind
WMSLayer
wmsupdate
11-6
disp (WMSCapabilties)
Display properties
getCapabilities (WebMapServer)
WebMapServer
WMSCapabilities
wmsinfo
getMap (WebMapServer)
WebMapServer
WMSMapRequest
wmsread
extractm
updategeostruct
11-7
11
Function Reference
Data Manipulation
bufferm
flatearthpoly
interpm
intrplat
intrplon
ispolycw
nanclip
poly2ccw
poly2cw
poly2fv
polycut
polymerge
reducem
11-8
closePolygonParts
isShapeMultipart
polyjoin
polysplit
removeExtraNanSeparators
Spatial Referencing
latlon2pix
Convert latitude-longitude
coordinates to pixel coordinates
limitm
makerefmat
11-9
11
Function Reference
map2pix
mapbbox
mapoutline
meshgrat
pix2map
pixcenters
refmat2vec
refvec2mat
setltln
setpostn
Terrain Analysis
11-10
gradientm
los2
viewshed
Other Analysis/Access
areamat
filterm
findm
ltln2val
mapprofile
encodem
geoloc2grid
imbedm
neworig
resizem
sizem
vec2mtx
11-11
11
Function Reference
Initialization
nanm
onem
spzerom
zerom
For specific map projections, see Chapter 14, Map Projections Reference.
11-12
maps
projlist
minvtran
projfwd
projinv
Map Trimming
maptriml
maptrimp
maptrims
11-13
11
Function Reference
vfwdtran
vinvtran
tissot
UTM System
utmgeoid
utmzone
11-14
newpole
org2pol
putpole
trimcart
trimdata
undoclip
undotrim
11-15
11
Function Reference
11-16
axesm
displaym
geoshow
grid2image
mapview
usamap
worldmap
Vector Symbolization
makesymbolspec
contourfm
contourm
linem
plot3m
plotm
Patch Data
fill3m
fillm
patchesm
patchm
11-17
11
Function Reference
Data Grids
meshm
pcolorm
surfacem
surfm
meshlsrm
shaderel
surflm
surflsrm
Thematic Maps
11-18
comet3m
cometm
quiverm
scatterm
stem3m
symbolm
Map Annotation
clabelm
framem
gridm
lcolorbar
mlabel
mlabelzero22pi
northarrow
plabel
rotatetext
scaleruler
textm
11-19
11
Function Reference
demcmap
polcmap
gtextm
inputm
sectorg
trackg
GUIs
11-20
clrmenu
colorm
colorui
getseeds
lightmui
maptool
maptrim
mlayers
mobjects
originui
panzoom
parallelui
qrydata
rootlayr
seedm
surfdist
uimaptbx
utmzoneui
defaultm
11-21
11
Function Reference
gcm
geotiff2mstruct
getm
handlem
ismap
ismapped
makemapped
namem
project
restack
rotatem
setm
tagm
zdatam
Map Appearance
11-22
axesscale
camposm
camtargm
Geographic Calculations
camupm
daspectm
paperscale
previewmap
tightmap
Display Clearing
clma
clmo
hidem
showaxes
showm
Geographic Calculations
Geometry of Sphere and Ellipsoid
(p. 11-24)
11-23
11
Function Reference
11-24
antipode
areaint
areaquad
azimuth
departure
distance
ellipse1
gc2sc
meridianarc
meridianfwd
reckon
scircle1
Geographic Calculations
scircle2
track1
track2
3-D Coordinates
ecef2geodetic
ecef2lv
elevation
geodetic2ecef
lv2ecef
convertlat
ecc2flat
ecc2n
flat2ecc
11-25
11
Function Reference
geocentric2geodeticLat
geodetic2geocentricLat
majaxis
minaxis
n2ecc
rcurve
rsphere
11-26
circcirc
gcxgc
gcxsc
ingeoquad
intersectgeoquad
linecirc
outlinegeoquad
polybool
polyxpoly
Geographic Calculations
rhxrh
scxsc
Geographic Statistics
combntns
eqa2grn
grn2eqa
hista
meanm
stdist
stdm
Navigation
crossfix
dreckon
driftcorr
driftvel
11-27
11
Function Reference
gcwaypts
legs
navfix
timezone
track
Utilities
11-28
Utilities
Angle Conversions
degrees2dm
degrees2dms
Convert degrees to
degrees-minutes-seconds
degtorad
dm2degrees
dms2degrees
Convert degrees-minutes-seconds to
degrees
fromDegrees
fromRadians
radtodeg
str2angle
toDegrees
toRadians
Data Precision
epsm
roundn
Round to multiple of 10
11-29
11
Function Reference
Distance Conversions
deg2km, deg2nm, deg2sm
Image Conversion
ind2rgb8
String Formatters
angl2str
dist2str
11-30
unwrapMultipart
wrapTo180
wrapTo2Pi
GUIs
wrapTo360
wrapToPi
GUIs
demdataui
originui
parallelui
11-31
11
Function Reference
utmzoneui
vmap0ui
Mapping Tools
maptool
maptrim
mapview
mlayers
mobjects
qrydata
11-32
clrmenu
hidem-ui
lightmui
panzoom
GUIs
colorui
handlem
handlem-ui
hidem
property editors
showm
tagm
zdatam
Track Tools
scircleg
scirclui
sectorg
surfdist
trackg
trackui
11-33
11
Function Reference
11-34
colorm
seedm
12
Functions Alphabetical
List
almanac
Purpose
Syntax
almanac
almanac(body)
data = almanac(body,parameter)
data = almanac(body,parameter,units)
data = almanac(parameter,units,referencebody)
Description
almanac.
almanac(body) lists the options, or parameters, available for each
celestial body. Valid body strings are
'earth'
'jupiter'
'mars'
'mercury'
'moon'
'neptune'
'pluto'
'saturn'
'sun'
'uranus'
'venus'
12-2
'everest'
'bessel'
'airy'
'clarke66'
almanac
'clarke80'
'international'
'krasovsky'
'wgs60'
iau65
'wgs66'
'iau68'
'wgs72'
'grs80'
'wgs84'
For the Earth, the parameter strings 'ellipsoid' and 'geoid' are
equivalent to'grs80'.
data = almanac(body,parameter,units) specifies the units to be
used for the output measurement, where units is any valid distance
units string. Note that these are linear units, but the result for surface
area is in square units, and for volume is in cubic units. The default
units are 'kilometers'.
data = almanac(parameter,units,referencebody) specifies the
source of the information. This sets the assumptions about the shape of
the celestial body used in the calculation of volumes and surface areas.
A referencebody string of 'actual' returns a tabulated value rather
than one dependent upon a ellipsoid model assumption. Other possible
referencebody strings are 'sphere' for a spherical assumption and
'ellipsoid' for the default ellipsoid model. The default reference body
is 'sphere'.
For the Earth, any of the preceding predefined ellipsoid definition
strings can also be entered as a reference body.
For Mercury, Pluto, Venus, the Sun, and the Moon, the eccentricity of
the ellipsoid model is zero, that is, the 'ellipsoid' reference body
is actually a sphere.
12-3
almanac
Examples
0.0001
Note that the radius returned for any ellipsoid model reference body is
the semimajor axis:
almanac('earth','radius','kilometers','ellipsoid')
Warning: Semimajor axis returned for radius parameter
ans =
6.3781e+03
12-4
almanac
almanac('earth','surfarea','statutemiles','wgs66')
ans =
1.969371331484438e+008
Note that these values are so close that long notation is required to
differentiate them.
Some lunar measurements are
almanac('moon','radius')
ans =
1738
almanac('moon','surfarea')
ans =
3.7959e+07
almanac('moon','volume')
ans =
2.1991e+10
Remarks
Take care when using angular arc length units for distance
measurements. All planets have a radius of 1 radian, for example, and
an area unit of square degrees indicates unit squares, 1 degree of arc
length on a side, not 1-degree-by-1-degree quadrangles.
See Also
distance
12-5
angl2str
Purpose
Syntax
str
str
str
str
Description
=
=
=
=
angl2str(angle)
angl2str(angle,signcode)
angl2str(angle,signcode,units)
angl2str(angle,signcode,units,n)
'ns'
'pm'
'none'
12-6
Units
Units of Angle
Output Format
'degrees'
degrees
decimal degrees
'degrees2dm'
degrees
degrees + decimal
minutes
angl2str
Units
Units of Angle
Output Format
'degrees2dms'
degrees
degrees + minutes +
decimal seconds
'radians'
radians
decimal radians
Remarks
Examples
00'
30'
00'
30'
00'
00.000"
00.000"
00.000"
00.000"
00.000"
S
S
N
N
12-7
angl2str
3
1
0
1
3
See Also
12-8
00'
30'
00'
30'
00'
00.000"
00.000"
00.000"
00.000"
00.000"
S
S
N
N
str2angle, dist2str
angledim
Purpose
Syntax
angleOut = angledim(angleIn,from,to)
Description
Example
See Also
12-9
antipode
Purpose
Syntax
[newlat,newlon] = antipode(lat,lon)
[newlat,newlon] = antipode(lat,lon,angleunits)
Description
coordinates of the points exactly opposite on the globe from the input
points given by lat and lon. All angles are in degrees.
[newlat,newlon] = antipode(lat,lon,angleunits) specifies
the input and output units with the string angleunits. The string
angleunits can be either 'degrees' or 'radians'. It can be
abbreviated and is case-insensitive.
Examples
Example 1
Given a point (43N, 15E), find its antipode:
[newlat,newlong] = antipode(43,15)
newlat =
-43
newlong =
-165
or (43S, 165W).
Example 2
Perhaps the most obvious antipodal points are the North and South
Poles. The function antipode demonstrates this:
[newlat,newlong] = antipode(90,0,'degrees')
newlat =
-90
newlong =
180
Note that in this case longitudes are irrelevant because all meridians
converge at the poles.
12-10
antipode
Example 3
Find the antipode of the location of the Mathworks corporate
headquarters in Natick, Massachusetts. Map the headquarters location
and its antipode in an orthographic projection. Begin by specifying
latitude and longitude as degree-minutes-seconds and then convert
to decimal degrees.
mwlat = dms2degrees([ 42 18 2.5])
mwlon = dms2degrees([-71 21 7.9])
mwlat =
42.3007
mwlon =
-71.3522
[amwlat amwlon] = antipode(mwlat,mwlon)
amwlat =
-42.3007
amwlon =
108.6478
12-11
antipode
geoshow(mwlat,mwlon,'Marker','o','Color','red')
s = ['Looking down at (' angl2str(mwlat,'ns') ...
',' angl2str(mwlon,'ew') ')'];
title(s)
12-12
arcgridread
Purpose
Syntax
[Z,R] = arcgridread(filename)
Description
Example
[Z,R] = arcgridread('MtWashington-ft.grd');
mapshow(Z,R,'DisplayType','surface');
xlabel('x (easting in meters)'); ylabel('y (northing in meters)')
colormap(demcmap(Z))
% View the terrain in 3-D
axis normal; view(3); axis equal; grid on
zlabel('elevation in feet')
12-13
arcgridread
See Also
12-14
areaint
Purpose
Syntax
area
area
area
area
Description
=
=
=
=
areaint(lat,lon)
areaint(lat,lon,ellipsoid)
areaint(lat,lon,units)
areaint(lat,lon,ellipsoid,units)
Examples
Consider the area enclosed by a 30 lune from pole to pole and bounded
by the prime meridian and 30E. You can use the function areaquad to
get an exact solution:
area = areaquad(90,0,-90,30)
area =
0.0833
This is 1/12 the spherical area. The more points used to define this
polygon, the more integration steps areaint takes, improving the
estimate. This first attempt takes a point every 30 of latitude:
lats = [-90:30:90,60:-30:-60]';
lons = [zeros(1,7), 30*ones(1,5)]';
12-15
areaint
area = areaint(lats,lons)
area =
0.0792
Algorithm
= [-90:1:90,89:-1:-89]';
= [zeros(1,181), 30*ones(1,179)]';
= areaint(lats,lons)
=
0.0833
12-16
areaint
See Also
12-17
areamat
Purpose
Syntax
A = areamat(BW,R)
A = areamat(BW,refvec,ellipsoid)
[A, cellarea] = areamat(...)
Description
kilometers.
[A, cellarea] = areamat(...) returns a vector, cellarea,
describing the area covered by the data cells in BW. Because all the cells
in a given row are exactly the same size, only one value is needed per
row. Therefore cellarea has size M-by-1, where M = size(BW,1) is
the number of rows in BW.
Remarks
12-18
Given a regular data grid that is a logical 0-1 matrix, the areamat
function returns the area corresponding to the true, or 1, elements. The
areamat
Examples
load topo
area = areamat((topo>127),topolegend)
area =
0.2411
12-19
areamat
[area,cellarea] = areamat(BW,refvec)
area =
1.0000
cellarea =
0.0017
0.0048
0.0074
0.0091
0.0096
0.0091
0.0074
0.0048
0.0017
Each entry of cellarea represents the portion of the unit spheres total
area a cell in that row of BW would contribute. Since the column extends
from pole to pole in this case, it is symmetric.
See Also
12-20
areaquad
Purpose
Syntax
area = areaquad(lat1,lon1,lat2,lon2)
area = areaquad(lat1,lon1,lat2,lon2,ellipsoid)
area = areaquad(lat1,lon1,lat2,lon2,ellipsoid,units)
Description
Definitions
12-21
areaquad
Quadrangle
Zone
Lune
Examples
Find the fraction of the Earths surface that lies between 30N and 45N,
and also between 25W and 60E:
area = areaquad(30,-25,45,60)
area =
0.0245
For comparison,
12-22
areaquad
almanac('earth','surfarea','km')
ans =
5.1006e+08
Algorithm
See Also
12-23
avhrrgoode
Purpose
Syntax
[latgrat,longrat,z] = avhrrgoode(region,filename)
[...] = avhrrgoode(region,filename,scalefactor)
[...] = avhrrgoode(region,filename,scalefactor,latlim,lonlim)
[...] = avhrrgoode(region,filename,scalefactor,latlim,lonlim,
gsize)
[...] = avhrrgoode(region,filename,scalefactor,latlim,lonlim,gsize,...
nrows,ncols)
[...] = avhrrgoode(region,filename,scalefactor,latlim,lonlim,gsize,...
nrows,ncols,resolution)
[...] = avhrrgoode(region,filename,scalefactor,latlim,lonlim,gsize,...
nrows,ncols,resolution,precision)
Description
'g' or 'global'
'af' or 'africa'
'ap' or 'australia/pacific'
'ea' or 'eurasia'
'na' or 'north america'
'sa' or 'south america'
filename is a string specifying the name of the data file. Output Z is
a geolocated data grid with coordinates latgrat and longrat in units
of degrees. Z, latgrat, and longrat are of class double. Projected
coordinates that lie within the interrupted areas of the projection are
12-24
avhrrgoode
set to NaN. A scale factor of 100 is applied to the original data set, so
that Z contains every 100th point in both X and Y directions.
= avhrrgoode(region,filename,scalefactor) uses the
integer scalefactor to downsample the data. A scale factor of 1
returns every point. A scale factor of 10 returns every 10th point. The
default value is 100.
[...]
[...] =
avhrrgoode(region,filename,scalefactor,latlim,lonlim) returns
data for the specified region. The returned data can extend somewhat
beyond the requested area. Limits are two-element vectors in units of
degrees, with latlim in the range [-90 90] and lonlim in the range
[-180 180]. latlim and lonlim must be ascending. If latlim and
lonlim are empty, the entire area covered by the data file is returned.
If the quadrangle defined by latlim and lonlim (when projected to
form a polygon in the appropriate Goode projection) fails to intersect
the bounding box of the data in the projected coordinates, then Z,
latgrat, and longrat are returned as empty.
[...] =
avhrrgoode(region,filename,scalefactor,latlim,lonlim,gsize)
controls the size of the graticule matrices. gsize is a two-element
12-25
avhrrgoode
Background
Remarks
This function reads the binary files as is. You should not use
byte-swapping software on these files.
The AVHRR project and data sets are described in and provided by
various U.S. Government Web sites. See the entry for Global Land
Cover Characteristics (GLCC) in the tech note referred to below.
12-26
avhrrgoode
Note For details on locating map data for download over the
Internet, see the following documentation at the MathWorks Web site:
http://www.mathworks.com/support/tech-notes/2100/2101.html.
Limitations
Most files store the data in scaled integers. Though this function returns
the data as double, the scaling from integer to float is not performed.
Check the datas README file for the appropriate scaling parameters.
Examples
12-27
avhrrgoode
12-28
avhrrgoode
See Also
avhrrlambert
12-29
avhrrlambert
Purpose
Syntax
[latgrat,longrat,Z] = avhrrlambert(region,filename)
[...] = avhrrlambert(region,filename, scalefactor)
[...] = avhrrlambert(region,filename, scalefactor, latlim,
lonlim)
[...] = avhrrlambert(region,filename, scalefactor, latlim,
lonlim, gsize)
[...] = avhrrlambert(region,filename, scalefactor, latlim,
lonlim, gsize,precision)
Description
Region Specifiers
'a' or 'asia'
'af' or 'africa'
'ap' or 'australia/pacific'
'e' or 'europe'
'na' or 'north america'
'sa' or 'south america'
= avhrrlambert(region,filename, scalefactor) uses
the integer scalefactor to downsample the data. A scale factor of 1
returns every point. A scale factor of 10 returns every 10th point. The
default value is 100.
[...]
12-30
avhrrlambert
in the ftp directory for specification of the file format and contents.
Background
12-31
avhrrlambert
Remarks
This function reads the binary files as is. You should not use
byte-swapping software on these files.
The AVHRR project and data sets are described in and provided by
various U.S. Government Web sites.
Note For details on locating map data for download over the
Internet, see the following documentation at the MathWorks Web site:
http://www.mathworks.com/support/tech-notes/2100/2101.html.
Examples
Example 1
Read and display every 100th point from the Global Land Cover
Characteristics (GLCC) file covering North America with the USGS
classification scheme, named nausgs1_2l.img.
[latgrat, longrat, Z] = avhrrlambert('na','nausgs1_2l.img');
Display the data using the Lambert Equal Area Azimuthal projection.
origin = [50 -100 0];
ellipsoid = [6370997 0];
figure
axesm('MapProjection','eqaazim', 'Origin',origin, 'Geoid',
ellipsoid)
geoshow(latgrat, longrat, Z, 'DisplayType', 'texturemap');
Example 2
Read and display every 50th point from the Global Land Cover
Characteristics (GLCC) file covering Europe with the USGS
classification scheme, named eausgs1_2le.img.
figure
worldmap europe
mstruct = gcm;
latlim = mstruct.maplatlimit;
lonlim = mstruct.maplonlimit;
12-32
avhrrlambert
scalefactor = 50;
[latgrat, longrat, Z] = ... avhrrlambert('e', ...
'eausgs1_2le.img', scalefactor, latlim, lonlim);
geoshow(latgrat, longrat, Z, 'DisplayType', 'texturemap');
See Also
avhrrgoode
12-33
axes2ecc
Purpose
Syntax
eccentricity = axes2ecc(semimajor,semiminor)
eccentricity = axes2ecc(axes)
Description
Examples
See Also
12-34
axesm
Purpose
Syntax
axesm
axesm(PropertyName,PropertyValue,...)
axesm(ProjectionFcn,PropertyName,PropertyValue,...)
Description
The axesm function creates a map axes into which both vector and raster
geographic data can be projected using functions such as plotm and
geoshow. Properties specific to map axes can be assigned upon creation
with axesm, and for an existing map axes they can be queried and
changed using getm and setm. Use the standard get and set methods to
query and control the standard MATLAB axes properties of a map axes.
Axes
Definition
Map axes are standard MATLAB axes with different default settings for
some properties and a data structure for storing projection parameters
and other data. The main differences in default settings are
Axes properties XGrid, YGrid, XTick, YTick are set to 'off'.
The properties XColor, YColor, and ZColor are set to the background
color.
The hold mode is on.
12-35
axesm
The map data structure stores the map axes properties, which, in
addition to the special standard axes settings described here, allow
Mapping Toolbox functions to recognize an axes or an opened FIG-file
as a map axes. See Map Axes Object Properties on page 12-36, below,
for descriptions of the map axes properties.
Examples
Create map axes for a Mercator projection, with selected latitude limits:
axesm('MapProjection','mercator','MapLatLimit',[-70 80])
Each projection function includes default values for all properties. Any
following property name/property value pairs are treated as overrides.
In either of the above examples, data displayed in the given map axes
is in a Mercator projection. Any data falling outside the prescribed
limits is not displayed.
Note The names of projection files are case sensitive. The projection
files included in Mapping Toolbox software use only lowercase letters
and Arabic numerals.
Map Axes
Object
Properties
12-36
axesm
12-37
axesm
FalseNorthing
scalar {0}
12-38
axesm
12-39
axesm
12-40
axesm
12-41
axesm
Color of the displayed frame edge Specifies the color used for
the displayed frame. You can specify a color using a vector of RGB
values or a MATLAB colorspec name. By default, the frame
edge is displayed in black ([0 0 0]).
FFaceColor
ColorSpec | {none}
Color of the displayed frame face Specifies the color used for
the displayed frame face. You can specify a color using a vector
of RGB values or a MATLAB colorspec name. By default, the
12-42
axesm
FLineWidth
scalar {2}
Frame edge line width Sets the line width of the displayed
frame edge. The value is a scalar representing points, which is 2
by default.
FLonLimit
[western_limit eastern_limit]
12-43
axesm
are plotted and beyond which they are trimmed. For non-oblique
and non-azimuthal projections, which have quadrangular frames,
this property controls the east-west extent of the frame. If a
projection is made oblique by the inclusion of a non-zero rotation
angle (the third element of the Origin vector), FLonLimit still
applies, but in the rotated latitude-longitude system rather than
in the geographic system. The FLonLimit property is ignored
for azimuthal projections.
Note In most common situations, including non-oblique
cylindrical and conic projections, there is no need to set
FLonLimit; use MapLonLimit instead.
TrimLat
[southern_limit northern_limit]
(read-only, projection-dependent)
12-44
axesm
Grid z-axis setting Sets the z-axis location for the grid when
displayed. Its default value is infinity, which is displayed above
all other map objects. However, you can set this to some other
value for stacking objects above the grid, if desired.
GColor
ColorSpec | {[0 0 0]}
Color of the displayed grid Specifies the color used for the
displayed grid. You can specify a color using a vector of RGB
values or one of the MATLAB colorspec names. By default, the
map grid is displayed in black ([0 0 0]).
GLineStyle
LineStyle {:}
Grid line style Determines the style of line used when the grid
is displayed. You can specify any line style supported by the
MATLAB line function. The default line style is a dotted line
(that is, ':').
GLineWidth
scalar {0.5}
12-45
axesm
Grid line width Sets the line width of the displayed grid. The
value is a scalar representing points, which is 0.5 by default.
MLineException
vector of longitudes {[]}
12-46
axesm
12-47
axesm
PLineLocation
scalar interval or specific vector {15}
Select italic or normal font for all grid labels Selects the
character slant for all displayed grid labels. 'normal' specifies
nonitalic font. 'italic' and 'oblique' specify italic font.
FontColor
ColorSpec | {black}
Text color for all grid labels Sets the color of all displayed grid
labels. ColorSpec is a three-element vector specifying an RGB
triple or a predefined MATLAB color string (colorspec).
FontName
courier | {helvetica} | symbol | times
Font family name for all grid labels Sets the font for all
displayed grid labels. To display and print properly, FontName
must be a font that your system supports.
FontSize
scalar in units specified in FontUnits {9}
12-48
axesm
Font size An integer specifying the font size to use for all
displayed grid labels, in units specified by the FontUnits
property. The default point size is 9.
FontUnits
{points} | normalized | inches | centimeters | pixels
Labeling format for grid Specifies the format of the grid labels.
If 'compass' is employed (the default), meridian labels are
suffixed with an E for east and a W for west, and parallel
labels are suffixed with an N for north and an S for south.
If 'signed' is used, meridian labels are prefixed with a + for
east and a - for west, and parallel labels are suffixed with a
+ for north and a - for south. If 'none' is selected, straight
latitude and longitude numerical values are employed, so western
meridian labels and southern parallel labels will have a -, but no
symbol precedes eastern and northern (positive) labels.
LabelRotation
on | {off}
12-49
axesm
align to the graticule. This option is not available for the Globe
display.
LabelUnits
{degrees} | dm | dms | radians
Label format
'degrees'
decimal degrees
'dm'
degrees/decimal minutes
'dms'
degrees/minutes/decimal seconds
'radians'
decimal radians
12-50
axesm
12-51
axesm
PLabelMeridian
east | {west} | prime | scalar longitude
See Also
12-52
axesscale
Purpose
Syntax
axesscale
axesscale(hbase)
axesscale(hbase,hother)
Description
axesscale resizes all axes in the current figure to have the same scale
as the current axes (gca). In this context, scale means the relationship
between axes x- and y-coordinates and figure and paper coordinates.
When axesscale is used, a unit of length in x and y is printed and
displayed at the same size in all the affected axes. The XLimMode and
YLimMode of the axes are set to 'manual' to prevent autoscaling from
changing the scale.
axesscale(hbase) uses the axes hbase as the reference axes, and
rescales the other axes in the current figure.
axesscale(hbase,hother) uses the axes hbase as the base axes, and
rescales only the axes in hother.
Examples
12-53
axesscale
12-54
axesscale
Limitations
Remarks
To ensure the same map scale between axes, use the same ellipsoid
and scale factors.
See Also
paperscale
12-55
azimuth
Purpose
Syntax
az
az
az
az
az
Description
=
=
=
=
=
azimuth(lat1,lon1,lat2,lon2)
azimuth(lat1,lon1,lat2,lon2,ellipsoid)
azimuth(lat1,lon1,lat2,lon2,units)
azimuth(lat1,lon1,lat2,lon2,ellipsoid,units)
azimuth(track,...)
12-56
azimuth
Definitions
Azimuth
An azimuth is the angle at which a smooth curve crosses a meridian,
taken clockwise from north. The North Pole has an azimuth of 0 from
every other point on the globe. You can calculate azimuths for great
circles or rhumb lines.
Geodesic
A geodesic is the shortest distance between two points on a curved
surface, such as an ellipsoid.
Great Circle
A great circle is a type of geodesic that lies on a sphere. It is the
intersection of the surface of a sphere with a plane passing through the
center of the sphere. For great circles, the azimuth is calculated at the
starting point of the great circle path, where it crosses the meridian. In
general, the azimuth along a great circle is not constant.
Rhumb Line
A rhumb line is a curve that crosses each meridian at the same angle.
For rhumb lines, the azimuth is the constant angle between true north
and the entire rhumb line passing through the two points.
For more information on the distinction between great circles and
rhumb lines, see Great Circles, Rhumb Lines, and Small Circles on
page 3-32 in the Mapping Toolbox documentation.
Examples
Find the azimuth between two points on the same parallel, for example,
(10N, 10E) and (10N, 40E). The azimuth between two points depends
on the track string selected.
% Try the 'gc' track string.
az = azimuth('gc',10,10,10,40)
% Compare to the result obtained from the 'rh' track string.
az = azimuth('rh',10,10,10,40)
12-57
azimuth
Find the azimuth between two points on the same meridian, say (10N,
10E) and (40N, 10E):
% Try the 'gc' track string.
az = azimuth(10,10,40,10)
% Compare to the 'rh' track string.
az = azimuth('rh',10,10,40,10)
Rhumb lines and great circles coincide along meridians and the
Equator. The azimuths are the same because the paths coincide.
Algorithm
Eccentricity
Geodesic azimuths on an ellipsoid are valid only for small eccentricities
typical of the Earth (for example, 0.08 or less).
Alternatives
If you are calculating both the distance and the azimuth, you can call
just the distance function. The function returns the azimuth as the
second output argument. It is unnecessary to call azimuth separately.
See Also
How To
12-58
bufferm
Purpose
Syntax
[latb,lonb] = bufferm(lat,lon,dist,direction)
[latb,lonb] = bufferm(lat,lon,dist,direction,npts)
[latb,lonb] = bufferm(lat,lon,dist,direction,npts,
outputformat)
Description
Examples
Load the coordinates for the conterminous U.S. and its great lakes.
Construct a 1-degree buffer zone around the great lakes, another buffer
one-third of a degree wide inside the great lakes, and display the
resulting buffers over the lake and state boundaries using geoshow:
load conus
tol = 0.1; % Tolerance for simplifying polygon outlines
12-59
bufferm
See Also
12-60
polybool
camposm
Purpose
Syntax
camposm(lat,long,alt)
[x,y,z] = camposm(lat,long,alt)
Description
Examples
Look at northern Australia from a point south and one Earth radius
above New Zealand:
figure
axesm('globe','galt',0)
gridm('glinestyle','-')
load topo
geoshow(topo,topolegend,'DisplayType','texturemap');
demcmap(topo)
camlight;
material(0.6*[ 1 1 1])
plat = -50; plon = 160;
tlat = -10; tlon = 130;
camtargm(tlat,tlon,0);
camposm(plat,plon,1);
camupm(tlat,tlon)
set(gca,'CameraViewAngle',75)
land = shaperead('landareas.shp','UseGeoCoords',true)
linem([land.Lat],[land.Lon])
axis off
12-61
camposm
See Also
12-62
camtargm
Purpose
Syntax
camtargm(lat,long,alt)
[x,y,z] = camtargm(lat,long,alt)
Description
Examples
Look down the spine of the Andes from a location three Earth radii
above the surface:
figure
axesm('globe','galt',0)
gridm('glinestyle','-')
load topo
geoshow(topo,topolegend,'DisplayType','texturemap');
demcmap(topo)
lightm(-80,-180);
material(0.6*[ 1 1 1])
plat = 10; plon = -65;
tlat = -30; tlon = -70;
camtargm(tlat,tlon,0);
camposm(plat,plon,3);
camupm(tlat,tlon);
camva(20)
set(gca,'CameraViewAngle',30)
land = shaperead('landareas.shp','UseGeoCoords',true)
linem([land.Lat],[land.Lon])
axis off
12-63
camtargm
See Also
12-64
camupm
Purpose
Syntax
camupm(lat,long)
[x,y,z] = camupm(lat,long)
Description
Examples
Look at northern Australia from a point south of and one Earth radius
above New Zealand. Set CameraUpVector to the antipode of the camera
target for that down under view:
figure
axesm('globe','galt',0)
gridm('glinestyle','-')
load topo
geoshow(topo,topolegend,'DisplayType','texturemap');
demcmap(topo)
camlight;
material(0.6*[ 1 1 1])
plat = -50; plon = 160;
tlat = -10; tlon = 130;
[alat,alon] = antipode(tlat,tlon);
camtargm(tlat,tlon,0);
camposm(plat,plon,1);
camupm(alat,alon)
set(gca,'CameraViewAngle',80)
land = shaperead('landareas.shp','UseGeoCoords',true)
linem([land.Lat],[land.Lon])
axis off
12-65
camupm
See Also
12-66
cart2grn
Purpose
Syntax
[lat,lon,alt] = cart2grn
[lat,lon,alt] = cart2grn(hndl)
[lat,lon,alt] = cart2grn(hndl,mstruct)
Description
When objects are projected and displayed on map axes, they are plotted
in Cartesian coordinates appropriate for the selected projection.
This function transforms those coordinates back into the Greenwich
frame, in which longitude is measured positively East from Greenwich
(longitude 0), England and negatively West from Greenwich.
[lat,lon,alt] = cart2grn returns the latitude, longitude, and
structure associated with the object. The map structure of the current
axes is the default.
See Also
12-67
changem
Purpose
Syntax
mapout = changem(Z,newcode,oldcode)
Description
Examples
Invent a map:
A = magic(3)
A =
8
3
4
1
5
9
6
7
2
12-68
0],[9 8])
6
7
2
circcirc
Purpose
Syntax
[xout,yout] = circcirc(x1,y1,r1,x2,y2,r2)
Description
When the two circles are tangent, two identical points are returned.
All inputs must be scalars.
See Also
linecirc
12-69
clabelm
Purpose
Syntax
h1
h1
h1
h1
Description
h1 = clabelm(c,h) rotates the labels and inserts them in line with the
contour lines. The handles of the labels can be returned in h1.
=
=
=
=
clabelm(c,h)
clabelm(c,h,v)
clabelm(c,h,'manual')
clabelm(c), h1 = clabelm(c,v)
select with a mouse. You press the left mouse button (the only mouse
button on a single-button mouse), or the space bar to label a contour at
the closest location beneath the center of the cursor. Press the Return
key while the cursor is within the figure window to terminate labeling.
The labels are inserted in line with the contour lines.
h1 = clabelm(c), h1 = clabelm(c,v), and h1 =
clabelm(c,'manual') operate as above, except that instead
of rotating the labels and placing them in line with the contours,
the labels are upright, and a + indicates the contour line the label is
annotating.
The clabelm function adds height labels to a two-dimensional contour
plot. By default, clabelm labels all displayed contours and randomly
selects label positions.
c is the contour matrix as described on the contourm reference page of
this guide; h is the vector of handles for the displayed contours.
Example
12-70
load geoid
axesm miller
framem
tightmap
[c,h] = contourm(geoid,geoidlegend,-100:50:80);
clabelm(c,h)
clabelm
50
50
10
0
50
50
50
50
0
0
50
0
0
50
See Also
12-71
clegendm
Purpose
Syntax
clegendm(cs,h)
clegendm(cs,h,pos)
clegendm(...,unitstr)
clegendm(...,str)
Description
-1
Examples
12-72
load topo
axesm robinson; framem
[cs,h] = contourm(topo,topolegend,3);
clegendm(cs,h,2)
clegendm
-4172
-871
2430
12-73
clegendm
See Also
12-74
clipdata
Purpose
Syntax
[lat,long,splitpts] = clipdata(lat,long,'object')
Description
The input data must be in radians and properly transformed for the
particular aspect and origin so that it fits in the specified clipping range.
The output data is in radians, with clips placed at the proper locations.
The output variable splitpts returns the row and column indices of
the clipped elements (columns 1 and 2 respectively). These indices
are necessary to restore the original data if the map parameters or
projection are ever changed.
Allowable object strings are:
surface for clipping graticules
light for clipping lights
line for clipping lines
patch for clipping patches
text for clipping text object location points
point for clipping point data
none to skip all clipping operations
See Also
12-75
clma
Purpose
Syntax
clma
clma all
clma purge
Description
clma deletes all displayed map objects from the current map axes but
leaves the frame if it is displayed.
clma all deletes all displayed map objects, including the frame, but it
leaves the map structure intact, thereby retaining the map axes.
clma purge clears all displayed map objects and converts the map axes
to standard axes. This is equivalent to cla reset.
See Also
12-76
clmo
Purpose
Syntax
clmo
clmo(handle)
clmo(object)
Description
See Also
12-77
closePolygonParts
Purpose
Syntax
Description
the start point at the end of each ring, unless the start and end points
are already identical. Coordinate vectors xdata and ydata must match
in size and have identical NaN locations.
[lat, lon] = closePolygonParts(lat, lon, angleunits) works
Examples
12-78
NaN
0.8000
1.0000
closePolygonParts
Name
Size
Bytes
xClosed
xOpen
yClosed
yOpen
1x10
1x8
1x10
1x8
80
64
80
64
Class
Attributes
double
double
double
double
See Also
isshapemultipart, removeextrananseparators
12-79
colorui
Purpose
Syntax
c = colorui
c = colorui(InitClr)
c = colorui(InitClr,FigTitle)
Description
See Also
12-80
uisetcolor
combntns
Purpose
Syntax
combos = combntns(set,subset)
Description
Examples
How can the numbers 1 to 5 be taken in sets of three (that is, what
is 5 choose 3)?
combos = combntns(1:5,3)
combos =
1
2
1
2
1
2
1
3
1
3
1
4
2
3
2
3
2
4
3
4
size(combos,1)
3
4
5
4
5
5
4
5
5
5
% "5 choose 3"
ans =
12-81
combntns
10
Remarks
12-82
2
5
5
comet3m
Purpose
Syntax
comet3m(lat,lon,z)
comet3m(lat,lon,z,p)
Description
Examples
See Also
comet3, cometm
12-83
cometm
Purpose
Syntax
cometm(lat,lon)
cometm(lat,lon,p)
Description
Examples
See Also
12-84
comet, comet3m
contour3m
Purpose
Syntax
contour3m(Z,R)
contour3m(lat,lon,Z)
contour3m(Z,R,n) or contour3m(lat,lon,Z,n)
contour3m(Z,V,R) or contour3m(lat,lon,Z,V)
contour3m(..., linespec)
contour3m(..., prop1, val1, prop2, val2,...)
C = contour3m(...)
[C,h] = contour3m(...)
Description
12-85
contour3m
Examples
Example 1
Make a default contour map of world topography data
load topo
axesm robinson; framem; view(3)
contour3m(topo,topolegend)
set(gca,'DataAspectRatio',[1 1 3000])
12-86
contour3m
Example 2
Contour EGM96 geoid heights as a 3-D surface with 50 levels, set
contour patch edge color to black, show the geoid surface under and
coastlines above the contour lines on an orthographic projection.
load geoid
axesm ortho
% Contour the geoid surface in black using 50 levels
[c,h]=contour3m(geoid, geoidrefvec, 50,'EdgeColor','black');
% Add the geoid surface.
hold on
geoshow(geoid,geoidrefvec,'DisplayType','surface')
% Add a title and colorbar.
title('EGM96 Geoid Heights with 50 Contour Levels');
colorbar
% Set the colormap to blue - green
colormap('winter')
% Set the Z-datum so that all contours show
zdatam(handlem('surface'),min(geoid(:)));
12-87
contour3m
Example 3
Display the EGM96 geoid height contours in a default world map.
load geoid
figure
worldmap('world');
% Contour the geoid height with 10 levels and
% set the color to magenta.
[c,h]=contour3m(geoid, geoidrefvec, 10,'m');
12-88
contour3m
See Also
12-89
contourcmap
Purpose
Syntax
contourcmap(cdelta,cmap)
contourcmap(cdelta,cmap,property,value,...)
hcb = contourcmap(...)
Description
add a colorbar and control the colorbars properties. You turn the
colorbar on with the property-value pair 'Colorbar' and 'on'. The
location of the colorbar is controlled by the 'Location' property. Valid
entries for Location are 'vertical' (the default) or 'horizontal'.
Properties 'TitleString', 'XLabelString', 'YLabelString' and
'ZLabelString' set the respective strings. Property 'ColorAlignment'
controls whether the colorbar labels are centered on the color bands
or the color breaks. Valid values for ColorAlignment are 'center'
or 'ends'. Property 'SourceObject' controls which object is used to
determine the color limits for the colormap. The SourceObject value
is the handle of a currently displayed object. If omitted, gca is used.
Other valid property-value pairs are any properties and values that can
be applied to the title and labels of the colorbar axes.
hcb = contourcmap(...) returns a handle to the colorbar.
Example
Create a colormap and set color limits to make the color changes occur
at multiples of 20 for the geoid.
load geoid
figure
worldmap(geoid, geoidrefvec)
contourm(geoid, geoidrefvec, -120:20:100);
12-90
contourcmap
See Also
12-91
contourfm
Purpose
Syntax
contourfm(lat,lon,Z)
contourfm(Z,R)
contourfm(lat,lon,Z,n,...)
contourfm(...,v,...)
contourfm(...,LineSpec)
c = contourfm(...)
[c,h] = contourfm(...)
Description
scalar.
contourfm(...,v,...) draws contours at the levels specified by the
input vector v.
contourfm(...,LineSpec) uses any valid LineSpec string to draw
12-92
contourfm
first row representing longitude data and the second row representing
latitude data.
[c,h] = contourfm(...) returns the contour matrix and an array of
Examples
Plot the Earths geoid with filled contours. The data is in meters.
load geoid
figure
axesm eckert4
framem;gridm
load coast
plotm(lat,long,'k')
caxis([-120 100]);colormap(jet(11));colorbar
contourfm(geoid,geoidrefvec,-120:20:100);
12-93
contourfm
You can reproduce the filled contour display by using a surface instead
of the patches created by contourfm.
figure
axesm eckert4
framem;gridm
load coast
plotm(lat,long,'k')
meshm(geoid,geoidrefvec,size(geoid),'Facecolor','interp')
contourcmap(20,'jet');colorbar
Surfaces also allow use of lighting to bring out the smaller variations
in the data.
clmo surface
meshm(geoid,geoidrefvec,size(geoid),geoid,'Facecolor','interp')
light;lighting phong; material(0.6*[ 1 1 1])
12-94
contourfm
set(gca,'dataaspectratio',[ 1 1 200])
gridm reset
zdatam(handlem('line'),max(geoid(:)))
Limitations
Remarks
See Also
12-95
contourm
Purpose
Syntax
contourm(Z, R)
contourm(lat, lon, Z)
contourm(Z, R, n)
contourm(Z, R, V) or contourm(lat, lon, Z, V)
contourm(..., linespec)
contourm(..., prop1, val1, prop2, val2,...)
C = contourm(...)
[C,h] = contourm(...)
Description
12-96
contourm
first row representing longitude data and the second row representing
latitude data.
[C,h] = contourm(...) returns the contour matrix and the handle to
the contour patches drawn onto the current axes. The handle is type
hggroup.
Examples
Example 1
Contour EGM96 geoid heights as dotted lines and with 10 levels and
set the contour labels on.
load geoid
figure
contourm(geoid, geoidrefvec, 10, ':','ShowText','on');
xlabel('Longitude');
ylabel('Latitude');
12-97
contourm
Example 2
Contour the Korean bathymetry and elevation data:
% Load the data.
load korea;
load geoid;
% Create a worldmap of Korea.
figure
worldmap(map, refvec);
% Display the digital elevation data and colormap.
geoshow(map, refvec, 'DisplayType', 'surface');
colormap(demcmap(map));
% Contour the geoid values from -100 to 100 in increments of 5.
[c,h] = contourm(geoid, geoidlegend, -100:5:100, 'k');
12-98
contourm
Example 3
Contour the geoid and topography heights:
% Load the data.
load topo
load geoid
% Create a Miller projection with geoid contours as red lines,
% and topography contours as black lines.
figure; axesm miller
hold on
contourm(geoid, geoidrefvec, 'r');
contourm(topo, topolegend, 'k');
12-99
contourm
See Also
12-100
convertlat
Purpose
Syntax
latout = convertlat(ellipsoid,latin,from,to,units)
Description
Latitude Type
Description
geodetic
authalic
conformal
geocentric
12-101
convertlat
Latitude Type
Description
isometric
parametric
rectifying
Example
12-102
convertlat
'geodetic','isometric','deg');
plot(geodetic, (authalic - geodetic),...
geodetic, (conformal - geodetic),...
geodetic, (geocentric - geodetic),...
geodetic, (parametric - geodetic),...
geodetic, (rectifying - geodetic),...
geodetic(1:end-5), (isometric - geodetic(1:end-5))/200);
title('Auxiliary Latitudes vs. Geodetic')
xlabel('geodetic latitude, degrees')
ylabel('departure from geodetic, degrees');
legend('authalic','conformal','geocentric', ...
'parametric','rectifying', 'isometric/200',...
'Location','NorthWest');
12-103
convertlat
See Also
12-104
almanac, rsphere
crossfix
Purpose
Syntax
[newlat,newlon]
[newlat,newlon]
[newlat,newlon]
drlong)
[newlat,newlon]
[newlat,newlon]
[newlat,newlon]
units)
[newlat,newlon] =
drlong,units)
= crossfix(lat,long,az)
= crossfix(lat,long,az_range,case)
= crossfix(lat,long,az_range,case,drlat,
= crossfix(lat,long,az,units)
= crossfix(lat,long,az_range,case,units)
= crossfix(lat,long,az_range,drlat,drlong,
crossfix(lat,long,az_range,case,drlat,
mat = crossfix(...)
Description
12-105
crossfix
[newlat,newlon] =
crossfix(lat,long,az,units), [newlat,newlon] =
crossfix(lat,long,az_range,case,units), [newlat,newlon] =
crossfix(lat,long,az_range,drlat,drlong,units),
and [newlat,newlon] =
crossfix(lat,long,az_range,case,drlat,drlong,units) allow
the specification of the angle units to be used for all angles
and ranges, where units is any valid angle units string. The
default value of units is 'degrees'.
mat = crossfix(...) returns the output in a two- or four-column
matrix mat.
Example
Where do the small circles defined as all points 8 in distance from the
points (0,0), (5N,5E), and (0,10E)" intersect?
figure('color','w');
ha = axesm('mapproj','mercator', ...
'maplatlim',[-10 15],'maplonlim',[-10 20],...
'MLineLocation',2,'PLineLocation',2);
axis off, gridm on, framem on;
mlabel on, plabel on;
latpts = [0;5;0];
lonpts = [0;5;10];
radii = [8;8;8];
12-106
crossfix
'markeredgecolor','r','markerfacecolor','r','marker','o')
% Draw magenta diamond markers at intersection points just found
geoshow(reshape(newlat,6,1),reshape(newlon,6,1),'DisplayType','point',...
'markeredgecolor','m','markerfacecolor','m','marker','d')
% Generate a small circle 8 deg radius for each original point
[latc1,lonc1] = scircle1(latpts(1),lonpts(1),radii(1));
[latc2,lonc2] = scircle1(latpts(2),lonpts(2),radii(2));
[latc3,lonc3] = scircle1(latpts(3),lonpts(3),radii(3));
% Plot the small circles to show the intersections are as determined
geoshow(latc1,lonc1,'DisplayType','line',...
'color','b','linestyle','-')
geoshow(latc2,lonc2,'DisplayType','line',...
'color','b','linestyle','-')
geoshow(latc3,lonc3,'DisplayType','line',...
'color','b','linestyle','-')
12-107
crossfix
10 W8 W6 W4 W2 W 0
14 N
12 N
10 N
8 N
6 N
4 N
2 N
2 S
4 S
6 S
8 S
10 S
If a dead reckoning position is provided, say (0,5E), then one from each
pair is returned (the closest one):
[newlat,newlong] = crossfix([0 5 0]',[0 5 10]',...
[8 8 8]',[0 0 0]',0,5)
newlat =
-2.5744
6.2529
-2.5744
newlong =
7.5770
5.0000
12-108
crossfix
2.4230
See Also
12-109
daspectm
Purpose
Syntax
daspectm(zunits)
daspectm(zunits,vfac)
daspectm(zunits,vfac,lat,long)
daspectm(zunits,vfac,lat,long,az)
daspectm(zunits,vfac,lat,long,az,gunits)
daspectm(zunits,vfac,lat,long,az,gunits,radius)
Description
Examples
12-110
daspectm
load korea
[latlim,lonlim] = limitm(map,refvec);
worldmap(latlim,lonlim)
meshm(map,refvec,size(map),map)
demcmap(map)
view(3)
daspectm('m',30)
tightmap
camlight
Limitations
See Also
daspect, paperscale
12-111
dcwdata
Purpose
Syntax
struct = dcwdata(library,latlim,lonlim,theme,topolevel)
struct = dcwdata(devicename,library,...)
[struct1, struct2,...] =
dcwdata(...,{topolevel1,topolevel2,
...})
Description
struct = dcwdata(library,latlim,lonlim,theme,topolevel)
reads data for the specified theme and topology level directly from
the DCW CD-ROM. There are four CDs, one for each of the libraries:
'NOAMER' (North America), 'SASAUS' (Southern Asia and Australia),
'EURNASIA' (Europe and Northern Asia), and 'SOAMAFR' (South
America and Africa). The desired theme is specified by a two-letter code
string. A list of valid codes is displayed when an invalid code, such as
'?', is entered. The region of interest can be given as a point latitude
and longitude or as a region with two-element vectors of latitude and
longitude limits. The units of latitude and longitude are degrees. The
data covering the requested region is returned, but will include data
extending to the edges of the 5-by-5 degree tiles. The result is returned
as a Version 1 Mapping Toolbox display structure.
struct = dcwdata(devicename,library,...) specifies the logical
levels. The levels must be specified as a cell array with the entries
'patch', 'line', 'point', or 'text'. Entering {'all'} for the topology
level argument is equivalent to {'patch', 'line', 'point', 'text'}.
Upon output, the data structures are returned in the output arguments
by topology level in the same order as they were requested.
Background
12-112
dcwdata
Remarks
12-113
dcwdata
Examples
On a Macintosh computer,
s = dcwdata('NOAMER',41,-69,'?','patch');
??? Error using ==> dcwdata
Theme not present in library NOAMER
Valid two-letter theme identifiers are:
PO: Political/Oceans
PP: Populated Places
LC: Land Cover
VG: Vegetation
RD: Roads
RR: Railroads
UT: Utilities
AE: Aeronautical
DQ: Data Quality
DN: Drainage
DS: Supplemental Drainage
HY: Hypsography
HS: Supplemental Hypsography
CL: Cultural Landmarks
OF: Ocean Features
PH: Physiography
TS: Transportation Structure
POpatch = dcwdata('NOAMER',[41 44],[-72 -69],'PO','patch')
POpatch =
1x234 struct array with fields:
type
otherproperty
tag
altitude
12-114
dcwdata
lat
long
tag2
tag3
References
The format and the history of the DCW are described in reference [1]
of the Bibliography at the end of this chapter.
See Also
12-115
dcwgaz
Purpose
Syntax
dcwgaz(library,object)
dcwgaz(devicename,library,object)
mtextstruc = dcwgaz(...)
[mtextstruc,mpointstruc] = dcwgaz(...)
Description
(South America and Africa). Items that exactly match or begin with the
object string are displayed on screen.
dcwgaz(devicename,library,object) specifies the logical device
name of the CD-ROM for computers that do not automatically name the
mounted disk.
mtextstruc = dcwgaz(...) displays the matched items on screen
and returns a Mapping Toolbox display structure with the matches
as text entries.
[mtextstruc,mpointstruc] = dcwgaz(...) returns the matches in
structures formatted both as text and as points.
Background
Remarks
The search is not case sensitive. Items that match are those that begin
with the object string. Spaces are significant.
Examples
On a Macintosh computer,
s = dcwgaz('EURNASIA','apatin')
12-116
dcwgaz
APATIN
s =
type:
otherproperty:
tag:
string:
altitude:
lat:
long:
'text'
{1x2 cell}
'Built up area'
'APATIN'
[]
45.6660
18.9830
12-117
dcwgaz
See Also
12-118
dcwread
Purpose
Syntax
dcwread(filepath,filename)
dcwread(filepath,filename,recordIDs)
dcwread(filepath,filename,recordIDs,field,varlen)
struc = dcwread(...)
[struc,field] = dcwread(...)
[struc,field,varlen] = dcwread(...)
[struc,field,varlen,description] = dcwread(...)
[struc,field,varlen,description,
narrativefield] = dcwread(...)
Description
dcwread reads a DCW file. The user selects the file interactively.
dcwread(filepath,filename) reads the specified file. The combination
[filepath filename] must form a valid complete filename.
dcwread(filepath,filename,recordIDs) reads selected records or
fields from the file. If recordIDs is a scalar or a vector of integers, the
function returns the selected records. If recordIDs is a cell array of
integers, all records of the associated fields are returned.
dcwread(filepath,filename,recordIDs,field,varlen) uses
previously read field and variable-length record information to skip
parsing the file header (see below).
struc = dcwread(...) returns the file contents in a structure.
[struc,field] = dcwread(...) returns the file contents and a
current file.
12-119
dcwread
Background
The Digital Chart of the World (DCW) uses binary files in a variety of
formats. This function determines the format of the file and returns the
contents in a structure. The field names of this structure are the same
as the field names in the DCW file.
Remarks
This function reads all DCW files except index files (files with names
ending in 'X'), thematic index files (files with names ending in 'TI'),
and spatial index files (files with names ending in 'SI').
File separators are platform dependent. The filepath input must
use appropriate file separators, which you can determine using the
MATLAB filesep function.
Examples
The following examples use the Macintosh directory system and file
separators for the pathname:
s = dcwread('NOAMER:DCW:NOAMER:','GRT')
s =
ID: 1
DATA_TYPE: 'GEO'
UNITS: '014'
ELLIPSOID: 'WGS 84'
ELLIPSOID_DETAIL: 'A=6378137,B=6356752 Meters'
VERT_DATUM_REF: 'MEAN SEA LEVEL'
VERT_DATUM_CODE: '015'
SOUND_DATUM: 'MEAN SEA LEVEL'
SOUND_DATUM_CODE: '015'
GEO_DATUM_NAME: 'WGS 84'
GEO_DATUM_CODE: 'WGE'
PROJECTION_NAME: 'DECIMAL DEGREES'
s = dcwread('NOAMER:DCW:NOAMER:AE:','INT.VDT')
s =
5x1 struct array with fields:
ID
TABLE
ATTRIBUTE
12-120
dcwread
VALUE
DESCRIPTION
for i = 1:length(s); disp(s(i)); end
ID: 1
TABLE: 'AEPOINT.PFT'
ATTRIBUTE: 'AEPTTYPE'
VALUE: 1
DESCRIPTION: 'Active civil'
ID:
TABLE:
ATTRIBUTE:
VALUE:
DESCRIPTION:
ID: 3
TABLE:
ATTRIBUTE:
VALUE:
DESCRIPTION:
ID:
TABLE:
ATTRIBUTE:
VALUE:
DESCRIPTION:
2
'AEPOINT.PFT'
'AEPTTYPE'
2
'Active civil and military'
'AEPOINT.PFT'
'AEPTTYPE'
3
'Active military'
4
'AEPOINT.PFT'
'AEPTTYPE'
4
'Other'
ID: 5
TABLE: 'AEPOINT.PFT'
ATTRIBUTE: 'AEPTTYPE'
VALUE: 5
DESCRIPTION: 'Added from ONC when not available from DAFIF'
s = dcwread('NOAMER:DCW:NOAMER:AE:','AEPOINT.PFT',1)
s =
ID: 1
AEPTTYPE: 4
AEPTNAME: 'THULE AIR BASE'
AEPTVAL: 251
12-121
dcwread
AEPTDATE:
AEPTICAO:
AEPTDKEY:
TILE_ID:
END_ID:
'19900502000000000000'
'1261'
'BR17652'
94
1
s = dcwread('NOAMER:DCW:NOAMER:AE:','AEPOINT.PFT',{1,2})
s =
4678x1 struct array with fields:
ID
AEPTTYPE
See Also
12-122
dcwrhead
Purpose
Syntax
dcwrhead
dcwrhead(filepath,filename)
dcwrhead(filepath,filename,fid)
dcwrhead(...)
str = dcwrhead(...)
Description
Background
The Digital Chart of the World (DCW) uses header strings in most
files to document the contents and format of that file. This function
reads the header string, displays a formatted version in the command
window, or returns it as a string.
Remarks
This function reads all DCW files except index files (files with names
ending in 'X'), thematic index files (files with names ending in 'TI'),
and spatial index files (files with names ending in 'SI').
File separators are platform dependent. The filepath input must
use appropriate file separators, which you can determine using the
MATLAB filesep function.
Examples
12-123
dcwrhead
AEPOINT.DOC
ID=I,
1,P,Row Identifier,-,-,
AEPTTYPE=I, 1,N,Airport Type,INT.VDT,-,
AEPTNAME=T, 50,N,Airport Name,-,-,
AEPTVAL=I, 1,N,Airport Elevation Value,-,-,
AEPTDATE=D, 1,N,Aeronautical Information Date,-,-,
AEPTICAO=T, 4,N,International Civil Organization Number,-,-,
AEPTDKEY=T, 7,N,DAFIF Reference Number,-,-,
TILE_ID=S, 1,F,Tile Reference Identifier,-,AEPOINT.PTI,
END_ID=I 1,F,Entity Node Primitive Foreign Key,-,-,
s = dcwrhead('NOAMER:DCW:NOAMER:AE:','AEPOINT.PFT')
s =
;Aeronautical Points;AEPOINT.DOC;ID=I,
1,P,Row
Identifier,-,-,:AEPTTYPE=I, 1,N,Airport
Type,INT.VDT,-,:AEPTNAME=T, 50,N,Airport Name,-,-,:AEPTVAL=I,
1,N,Airport Elevation Value,-,-,:AEPTDATE=D, 1,N,Aeronautical
Information Date,-,-,:AEPTICAO=T, 4,N,International Civil
Organization Number,-,-,:AEPTDKEY=T, 7,N,DAFIF Reference
Number,-,-,:TILE_ID=S, 1,F,Tile Reference
Identifier,-,AEPOINT.PTI,:END_ID=I 1,F,Entity Node Primitive
Foreign Key,-,-,:;
See Also
12-124
defaultm
Purpose
Syntax
mstruct = defaultm(projection)
mstruct = defaultm(mstruct)
Description
mstruct.origin, etc.
12-125
defaultm
If youve set field prop1 of mstruct to value1, field prop2 to value2, and
so forth, then the following sequence
mstruct = defaultm(projection);
mstruct.prop1 = value1;
mstruct.prop2 = value2;
...
mstruct = defaultm(mstruct);
You must also use values in radians when assigning any angle-valued
properties (such as mstruct.origin, mstruct.parallels,
mstruct.maplatlimit, mstruct.maplonlimit, etc.).
See the Mapping Toolbox Users Guide section on Working in UTM
Without a Map Axes on page 8-59 for information and an example
showing the use of defaultm in combination with UTM.
12-126
defaultm
Examples
'mercator'
[]
'degrees'
'normal'
[]
[]
[]
[1 0]
[]
[]
0
1
[]
[]
[-86 86]
[-180 180]
[]
100
[0 0 0]
'none'
[]
2
[]
[]
Inf
[0 0 0]
':'
0.5000
[]
100
[]
[]
12-127
defaultm
mlinevisible:
plineexception:
plinefill:
plinelimit:
plinelocation:
plinevisible:
fontangle:
fontcolor:
fontname:
fontsize:
fontunits:
fontweight:
labelformat:
labelrotation:
labelunits:
meridianlabel:
mlabellocation:
mlabelparallel:
mlabelround:
parallellabel:
plabellocation:
plabelmeridian:
plabelround:
'on'
[]
100
[]
[]
'on'
'normal'
[0 0 0]
'helvetica'
9
'points'
'normal'
'compass'
'off'
[]
[]
[]
[]
0
[]
[]
[]
0
Now change the map origin to [0 90 0], and fill in default projection
parameters accordingly:
mstruct.origin = [0 90 0];
mstruct = defaultm(mstruct)
mstruct =
mapprojection:
zone:
angleunits:
aspect:
falseeasting:
falsenorthing:
12-128
'mercator'
[]
'degrees'
'normal'
0
0
defaultm
fixedorient:
geoid:
maplatlimit:
maplonlimit:
mapparallels:
nparallels:
origin:
scalefactor:
trimlat:
trimlon:
frame:
ffill:
fedgecolor:
ffacecolor:
flatlimit:
flinewidth:
flonlimit:
grid:
galtitude:
gcolor:
glinestyle:
glinewidth:
mlineexception:
mlinefill:
mlinelimit:
mlinelocation:
mlinevisible:
plineexception:
plinefill:
plinelimit:
plinelocation:
plinevisible:
fontangle:
fontcolor:
fontname:
fontsize:
fontunits:
[]
[1 0]
[-86 86]
[-90 270]
0
1
[0 90 0]
1
[-86 86]
[-180 180]
'off'
100
[0 0 0]
'none'
[-86 86]
2
[-180 180]
'off'
Inf
[0 0 0]
':'
0.5
[]
100
[]
30
'on'
[]
100
[]
15
'on'
'normal'
[0 0 0]
'Helvetica'
10
'points'
12-129
defaultm
fontweight:
labelformat:
labelrotation:
labelunits:
meridianlabel:
mlabellocation:
mlabelparallel:
mlabelround:
parallellabel:
plabellocation:
plabelmeridian:
plabelround:
See Also
12-130
'normal'
'compass'
'off'
'degrees'
'off'
30
86
0
'off'
15
-90
0
Purpose
Syntax
km
nm
sm
km
nm
sm
km
nm
sm
Description
=
=
=
=
=
=
=
=
=
deg2km(deg)
deg2nm(deg)
deg2sm(deg)
deg2km(deg,radius)
deg2nm(deg,radius)
deg2sm(deg,radius)
deg2km(deg,sphere)
deg2nm(deg,sphere)
deg2sm(deg,sphere)
measured along a great circle on a sphere with a radius of 6371 km, the
mean radius of the Earth.
nm = deg2nm(deg) and sm = deg2sm(deg) work identically, except
that the output units are nautical miles and statute miles, respectively.
km = deg2km(deg,radius) converts distances from degrees to
identically, except that the output units are nautical miles and statute
miles, respectively.
12-131
Examples
See Also
12-132
degrees2dm
Purpose
Syntax
DM = degrees2dm(angleInDegrees)
Description
Example
See Also
12-133
degrees2dms
Purpose
Syntax
DMS = degrees2dms(angleInDegrees)
Description
Example
format long g
angleInDegrees = [ 30.8457722555556; ...
-82.0444189583333; ...
-0.504756513888889;...
0.004116666666667];
dms = degrees2dms(angleInDegrees)
dms =
30
-82
0
0
50
2
-30
0
44.7801200001663
39.9082499998644
17.1234500000003
14.8200000000012
12-134
degrees2dms
See Also
12-135
degtorad
Purpose
Syntax
angleInRadians = degtorad(angleInDegrees)
Description
Examples
2*pi - degtorad(360)
ans =
0
See Also
12-136
demcmap
Purpose
Syntax
demcmap(Z)
demcmap(Z,ncolors)
demcmap(Z,ncolors,cmapsea,cmapland)
demcmap(color,Z,spec)
demcmap(color,Z,spec,cmapsea,cmapland)
Description
Examples
12-137
demcmap
See Also
12-138
departure
Purpose
Syntax
dist
dist
dist
dist
Description
=
=
=
=
departure(long1,long2,lat)
departure(long1,long2,lat,geoid)
departure(long1,long2,lat,units)
departure(long1,long2,lat,geoid,units)
form. In this case, the departure is computed in the same units as the
semimajor axes of the geoid vector.
Definitions
Examples
12-139
departure
See Also
12-140
distance | stdm
displaym
Purpose
Syntax
displaym(displaystruct)
displaym(displaystruct,str)
displaym(displaystruct,strings)
displaym(displaystruct,strings,searchmethod)
h = displaym(displaystruct)
Description
current axes. The current axes must be a map axes with a valid map
definition. See the remarks about Version 1 Display Structures on
page 12-142 below for details on the contents of display structures.
displaym(displaystruct,str) displays the vector data elements of
displaystruct whose 'tag' fields contains strings beginning with the
string str. Vector data elements are those whose 'type' field is either
'line' or 'patch. The string match is case-insensitive.
displaym(displaystruct,strings) displays the vector data elements
of displaystruct whose 'tag' field matches begins with one of the
elements (or rows) of strings. strings is a cell array of strings (or a
2-D character array). In the case of character array, trailing blanks are
stripped from each row before matching.
displaym(displaystruct,strings,searchmethod) controls the
method used to match the values of the tag field in displaystruct,
as follows:
12-141
displaym
created by displaym.
Note The type of display structure accepted by displaym is not the
same as a geographic data structure (geostructs and mapstructs).
introduced in Mapping Toolbox Version 2. Use geoshow or mapshow
instead of displaym to display geostructs or mapstructscreated using
shaperead and gshhs, for example. For more information, see Mapping
Toolbox Geographic Data Structures on page 2-16.
Remarks
12-142
displaym
Field Name
Type
light
Type
line
Type
patch
Type
regular
Type
surface
Type
text
type
tag
lat
long
map
maplegend
meshgrat
string
altitude
otherproperty
Some fields can contain empty entries, but each indicated field must
exist for the objects in the struct array to be displayed correctly.
For instance, the altitude field can be an empty matrix and the
otherproperty field can be an empty cell array.
The type field must be one of the specified map object types: 'line',
'patch', 'regular', 'surface', 'text', or 'light'.
The tag field must be a string different from the type field usually
containing the name or kind of map object. Its contents must not be
equal to the name of the object type (i.e., line, surface, text, etc.).
The lat, long, and altitude fields can be scalar values, vectors, or
matrices, as appropriate for the map object type.
The map field is a data grid. If map is a regular data grid, maplegend is its
corresponding referencing vector, and meshgrat is a two-element vector
12-143
displaym
specifying the graticule mesh size. If map is a geolocated data grid, lat
and long are the matrices of latitude and longitude coordinates.
The otherproperty field is a cell array containing any additional
display properties appropriate for the map object. Cell array entries can
be a line specification string, such as 'r+', or property name/property
value pairs, such as 'color','red'. If the otherproperty field is left
as an empty cell array, default colors are used in the display of lines
and patches based on the tag field.
Note In some cases you can use the geoshow function as a direct
alternative to displaym. It accepts display structures of type line and
patch.
See Also
12-144
dist2str
Purpose
Syntax
str
str
str
str
str
Description
=
=
=
=
=
dist2str(distin)
dist2str(dist,format)
dist2str(dist,format,units)
dist2str(dist,format,digits)
dist2str(dist,format,units,digits)
input distances are supplied, and which are encoded in the string
matrix. Units must be one of the following: 'feet', 'kilometers',
'meters', 'nauticalmiles', 'statutemiles', 'degrees', or
'radians'. Note that statute miles are encoded as 'mi' in the string
matrix, whereas in most Mapping Toolbox functions, 'mi' indicates
international miles. If omitted or blank, 'kilometers' is assumed.
str = dist2str(dist,format,digits) or str =
dist2str(dist,format,units,digits) uses the input
digits to determine the number of decimal digits in the output matrix.
digits = -2 uses accuracy in the hundredths position, digits = 0
uses accuracy in the units position. Default is digits = -2. For further
discussion of specifying digits, see roundn.
Examples
12-145
dist2str
str = dist2str(d,'none','km')
str =
-3.70 km
2.95 km
87.00 km
Now change the units to nautical miles, add plus signs to positive
values, and truncate to the tenths (101) slot:
str = dist2str(d,'pm','nm',-1)
str =
-3.7 nm
+3.0 nm
+87.0 nm
See Also
12-146
angl2str, roundn
distance
Purpose
Syntax
[dist,az]
[dist,az]
[dist,az]
[dist,az]
[dist,az]
[dist,az]
[dist,az]
[dist,az]
[dist,az]
Description
=
=
=
=
=
=
=
=
=
distance(lat1,lon1,lat2,lon2)
distance(lat1,lon1,lat2,lon2,ellipsoid)
distance(lat1,lon1,lat2,lon2,units)
distance(lat1,lon1,lat2,lon2,ellipsoid,units)
distance(pt1,pt2)
distance(pt1,pt2,ellipsoid)
distance(pt1,pt2,units)
distance(pt1,pt2,ellipsoid,units)
distance(track,...)
coordinates, but the output range has the same units as the semimajor
axis of the ellipsoid vector.
12-147
distance
calling forms.
[dist,az] = distance(track,...) specifies whether great circle
Examples
Using pt1,pt2 notation, find the distance from Norfolk, Virginia (37N,
76W), to Cape St. Vincent, Portugal (37N, 9W), just outside the
Straits of Gibraltar. The distance between these two points depends
upon the track string selected.
dist = distance('gc',[37,-76],[37,-9])
dist =
52.3094
dist = distance('rh',[37,-76],[37,-9])
dist =
53.5086
12-148
distance
The distances are the same, 30, or about 1800 nautical miles (there are
about 60 nautical miles in a degree of arc length).
Algorithm
Alternatives
Distance between two points can be calculated in two ways. For great
circles (on the sphere) and geodesics (on the ellipsoid), the distance is
the shortest surface distance between two points. For rhumb lines, the
distance is measured along the rhumb line passing through the two
points, which is not, in general, the shortest surface distance between
them.
When you need to compute both distance and azimuth for the same
point pair(s), it is more efficient to do so with a single call to distance.
That is, use
[dist az] = distance(...);
12-149
distance
See Also
How To
12-150
distortcalc
Purpose
Syntax
areascale = distortcalc(lat,long)
areascale = distortcalc(mstruct,lat,long)
[areascale,angdef,maxscale,minscale,merscale,
parscale] = distortcalc(...)
Description
deformation of right angles (in the angle units of the defined projection),
the particular maximum and minimum scale distortions in any
direction, and the particular scale along the meridian and parallel. You
can also call distortcalc with fewer output arguments, in the order
shown.
Background
Examples
At the equator, the Mercator projection is free of both area and angular
distortion:
axesm mercator
[areascale,angdef] = distortcalc(0,0)
12-151
distortcalc
areascale =
1.0000
angdef =
8.5377e-007
At 60 degrees north, objects are shown at 400% of their true area. The
projection is conformal, so angular distortion is still zero.
[areascale,angdef] = distortcalc(60,0)
areascale =
4.0000
angdef =
4.9720e-004
Remarks
See Also
mdistort, tissot
12-152
distdim
Purpose
Syntax
distOut = distdim(distIn,from,to)
distOut = distdim(distIn,from,to,radius)
distOut = distdim(distIn,from,to,sphere)
Description
'kilometers' or 'km'
'nauticalmiles' or 'nm'
'miles', 'statutemiles', 'mi', or 'sm'
Statute miles
'degrees' or 'deg'
'radians' or 'rad'
12-153
distdim
Remarks
12-154
distdim
statute miles (also known as U.S. survey miles), and does not support
international miles at all. By definition, one international mile is 5,280
international feet and one statute mile is 5,280 survey feet. You can
evaluate:
unitsratio('millimeter','statute mile') - ...
unitsratio('millimeter','mile')
Replacing distdim
If both from and to are known at the time of coding, then you may
be able to replace distdim with a direct conversion utility, as in the
following examples:
distdim(dist,'nm',km')
nm2km(dist)
distdim(dist,'sm','deg')
sm2deg(dist)
distdim(dist, 'rad',
'km', 'moon')
rad2km(dist,'moon')
with
12-155
distdim
If you are using units of feet or miles, see the cautionary note above
about how they are interpreted. For example, with distIn in meters
and distOut in survey feet, distOut = distdim(distIn, 'meters',
'feet') should be replaced with distOut = unitsratio('survey
feet','meters') * distIn. Saving a multiplicative factor computed
with unitsratio and using it to convert in a separate step can make
code cleaner and more efficient than using distdim. For example,
replace
dist1_meters = distdim(dist1_nm, 'nm', 'meters');
dist2_meters = distdim(dist2_nm, 'nm', 'meters');
with
metersPerNM = unitsratio('meters','nm');
dist1_meters = metersPerNM * dist1_nm;
dist2_meters = metersPerNM * dist2_nm;
unitsratio does not perform great-circle conversion between units of
length and angle, but it can be easily combined with other functions to
do so. For example, to convert degrees to meters along a great-circle arc
on a sphere approximating the planet Mars, you could replace
distdim(dist, 'degrees', 'meters', 'mars')
with
unitsratio('meters','km') * deg2km(dist, 'mars')
Examples
12-156
distdim
100
distnm = distdim(distkm,'kilometers','nauticalmiles')
distnm =
53.9957
See Also
12-157
dm2degrees
Purpose
Syntax
angleInDegrees = dm2degrees(DM)
Description
where SGN is 1 if D and M are both nonnegative and -1 if the first nonzero
element of [D M] is negative (an error results if a nonzero D is followed
by a negative M). Any fractional parts in the first (degrees) columns of DM
are ignored. An error results unless the absolute values of all elements
in the second (minutes) column are less than 60.
Example
dm = [ ...
30 44.78012; ...
-82 39.90825; ...
0 -17.12345; ...
0 14.82000];
format long g
angleInDegrees = dm2degrees(dm)
angleInDegrees =
30.7463353333333
-82.6651375
12-158
dm2degrees
-0.285390833333333
0.247
See Also
12-159
dms2degrees
Purpose
Syntax
angleInDegrees = dms2degrees(DMS)
Description
Example
dms = [ ...
30 50 44.78012; ...
-82
2 39.90825; ...
0 -30 17.12345; ...
0
0 14.82000];
format long g
angleInDegrees = dms2degrees(dms)
12-160
dms2degrees
angleInDegrees =
30.8457722555556
-82.0444189583333
-0.504756513888889
0.00411666666666667
See Also
12-161
dreckon
Purpose
Syntax
[drlat,drlong,drtime] = dreckon(waypoints,time,speed)
[drlat,drlong,drtime] = dreckon (waypoints,time,speed,
spdtimes)
Description
the positions and times of required dead reckoning (DR) points for
the input track that starts at the input time. The track should be in
navigational track format (two columns, latitude then longitude, in
order of traversal). These waypoints are the starting and ending points
of each leg of the track. There is one fewer track leg than waypoints, as
the last point included is the end of the track. In navigation, the first
waypoint would be a navigational fix, taken at time. The speed input
can be a scalar, in which case a constant speed is used throughout, or it
can be a vector in which one speed is given for each track leg (that is,
speed changes coincide with course changes).
[drlat,drlong,drtime] = dreckon
(waypoints,time,speed,spdtimes) allows speed changes to occur
independent of course changes. The elements of the speed vector must
have a one-to-one correspondence with the elements of the spdtimes
vector. This latter variable consists of the time interval after time at
which each speed order ends. For example, if time is 6.75, and the first
element of spdtimes is 1.35, then the first speed element is in effect
from 6.75 to 8.1 hours. When this syntax is used, the last output DR is
the earlier of the final spdtimes time or the final waypoints point.
Background
12-162
dreckon
on the hour. Navigators also DR at other times that are not relevant
to this function.
Often in practice, when two events occur that require DRs within a
very short time, only one DR is generated. This function mimics that
practice by setting a tolerance of 3 minutes (0.05 hours). No two DRs
will fall closer than that.
Refer to Navigation on page 10-11 in the Mapping Toolbox Guide for
further information.
Examples
waypoints =
10.1000
-34.6000
% Fix at noon
9.9000
-34.5000
% Rendezvous point
-37.0000
% Ultimate destination
noon = 12;
[drlat,drlong,drtime] = dreckon(waypoints,noon,speed,spdtimes);
[drlat,drlong,drtime]
ans =
9.8999
-34.4999
12.5354
9.7121
-34.5478
13.0000
% On the hour
9.3080
-34.6508
14.0000
% On the hour
9.1060
-34.7022
14.5000
8.9847
-34.7330
15.0000
% On the hour
12-163
dreckon
8.8635
-34.7639
15.5000
See Also
12-164
driftcorr
Purpose
Syntax
heading = driftcorr(course,airspeed,windfrom,windspeed)
[heading,groundspeed,windcorrangle] = driftcorr(...)
Description
heading = driftcorr(course,airspeed,windfrom,windspeed)
computes the heading that corrects for drift due to wind (for aircraft) or
current (for watercraft). course is the desired direction of movement
(in degrees), airspeed is the speed of the vehicle relative to the moving
air or water mass, windfrom is the direction facing into the wind or
current (in degrees), and windspeed is the speed of the wind or current
(in the same units as airspeed).
[heading,groundspeed,windcorrangle] = driftcorr(...) also
returns the ground speed and wind correction angle. The wind
correction angle is positive to the right, and negative to the left.
Example
12-165
driftcorr
See Also
12-166
driftvel
driftvel
Purpose
Syntax
Description
[windfrom,windspeed] = driftvel
(course,groundspeed,heading,airspeed) computes the wind (for
Example
See Also
driftcorr
12-167
dted
Purpose
Syntax
[Z,
[Z,
[Z,
[Z,
[Z,
[Z,
Description
[Z, refvec] = dted returns all of the elevation data in a DTED file
as a regular data grid, Z, with elevations in meters. The file is selected
interactively. This function reads the DTED elevation files, which
generally have filenames ending in .dtN, where N is 0,1,2,3,... refvec is
the associated three-element referencing vector that geolocates Z.
refvec]
refvec]
refvec]
refvec]
refvec]
refvec,
= dted
= dted(filename)
= dted(filename, samplefactor)
= dted(filename, samplefactor, latlim, lonlim)
= dted(dirname, samplefactor, latlim, lonlim)
UHL, DSI, ACC] = dted(...)
the specified DTED file. The file must be found on the MATLAB path.
If not found, the file may be selected interactively.
[Z, refvec] = dted(filename, samplefactor) subsamples data
from the specified DTED file. samplefactor is a scalar integer. When
samplefactor is 1 (the default), DTED reads the data at its full
resolution. When samplefactor is an integer n greater than one, every
nth point is read.
[Z, refvec] = dted(filename, samplefactor, latlim, lonlim)
reads the data for the part of the DTED file within the latitude and
longitude limits. The limits must be two-element vectors in units of
degrees.
[Z, refvec] = dted(dirname, samplefactor, latlim, lonlim)
12-168
dted
containing the DTED User Header Label (UHL), Data Set Identification
(DSI) and ACCuracy metadata records.
Background
Remarks
Latitude-Dependent Sampling
In DTED files north of 50 North and south of 50 South, where the
meridians have converged significantly relative to the equator, the
longitude sampling interval is reduced to half of the latitude sampling
interval. In order to retain square output cells, this function reduces
the latitude sampling to match the longitude sampling. For example, it
will return a 121-by-121 elevation grid for a DTED file covering from 49
to 50 degrees north, but a 61-by-61 grid for a file covering from 50 to
51 degrees north. When you supply a directory name instead of a file
name, and latlim spans either 50 North or 50 South, an error results.
12-169
dted
divided, the data grid returned will include all areas between your
latitude-longitude limits and the next row or column of cells, potentially
in all four directions.
Examples
See Also
12-170
[Z,refvec] = dted('n38.dt0');
[Z,refvec,UHL,DSI,ACC] = dted('n38.dt0',1,[38.5 38.8],...
[-76.8 -76.6]);
[Z,refvec,UHL,DSI,ACC] = dted('f:',1,[38.5 38.8],...
[-76.8 -76.6]);
usgsdem, gtopo30, tbase, etopo
dteds
Purpose
Syntax
fname = dteds(latlim,lonlim)
fname = dteds(latlim,lonlim,level)
Description
files include 0, 1, or 2.
Background
Examples
See Also
dted
12-171
eastof
Purpose
Syntax
lonWrapped = eastof(lon,meridian)
lonWrapped = eastof(lon,meridian,angleunits)
Description
12-172
ecc2flat
Purpose
Syntax
flattening = ecc2flat(eccentricity)
Description
two-column vector, only the second column is used. This allows the
standard two-element ellipsoid vectors to be used as rows of the input,
because the second element of these vectors is the eccentricity. In all
other cases, all columns of the input are used.
Flattening and eccentricity are two methods of defining an ellipsoid.
Example
flattening = ecc2flat(almanac('earth','ellipsoid'))
flattening =
0.0034
See Also
12-173
ecc2n
Purpose
Syntax
n = ecc2n(eccentricity)
Description
Example
See Also
12-174
n = ecc2n(almanac('earth','ellipsoid'))
n =
0.00167922039463
almanac, ecc2flat, majaxis, n2ecc
ecef2geodetic
Purpose
Syntax
[phi,lambda,h] = ecef2geodetic(x,y,z,ellipsoid)
Description
Definitions
See Also
12-175
ecef2lv
Purpose
Syntax
[xl,yl,zl] = ecef2lv(x,y,z,phi0,lambda0,h0,ellipsoid)
Description
[xl,yl,zl] = ecef2lv(x,y,z,phi0,lambda0,h0,ellipsoid)
Definitions
See Also
12-176
egm96geoid
Purpose
Syntax
Description
The gridded EGM96 data set must be on your path in a file named
'WW15MGH.GRD'.
[N, refvec] = egm96geoid(samplefactor,latlim,lonlim) imports
data for the part of the world within the specified latitude and longitude
limits. The limits must be two-element vectors in units of degrees.
Longitude limits can be defined in the range [-180 180] or [0 360]. For
example, lonlim = [170 190] returns data centered on the dateline,
while lonlim = [-10 10] returns data centered on the prime meridian.
Background
Examples
Read the EGM 96 geoid grid for the world, taking every 10th point.
[N,refvec] = egm96geoid(10);
12-177
egm96geoid
Read a subset of the geoid grid at full resolution and interpolate to find
the geoid height at a point between grid points.
[N,refvec] = egm96geoid(1,[-10 -12],[129 132]);
n = ltln2val(N,refvec,-11.1,130.22,'bicubic')
n =
52.7151
Remarks
This function reads the 15-minute EGM96 grid file WW15MGH.GRD. The
grid is available as either a DOS self-extracting compressed file or a
UNIX compressed file. Do not modify the file once it has been extracted.
Note For details on locating map data for download over the
Internet, see the following documentation at the MathWorks Web site:
http://www.mathworks.com/support/tech-notes/2100/2101.html
Maps will extend a half a cell outside the requested map limits.
There are 721 rows and 1441 columns of values in the grid at full
resolution. The low resolution data in GEOID.MAT is derived from the
EGM 96 grid.
See Also
12-178
ltln2val
elevation
Purpose
Syntax
[elevationangle,slantrange,azimuthangle] = ...
elevation(lat1,lon1,alt1,lat2,lon2,alt2)
[...] = elevation(lat1,lon1,alt1,lat2,lon2,alt2,...
angleunits)
[...] = elevation(lat1,lon1,alt1,lat2,lon2,alt2,...
angleunits,distanceunits)
[...] = elevation(lat1,lon1,alt1,lat2,lon2,alt2,...
angleunits,ellipsoid)
Description
[elevationangle,slantrange,azimuthangle] = ...
elevation(lat1,lon1,alt1,lat2,lon2,alt2) computes the
elevation angle, slant range, and azimuth angle of point 2 (with geodetic
coordinates lat2, lon2, and alt2) as viewed from point 1 (with geodetic
coordinates lat1, lon1, and alt1). The coordinates alt1 and alt2
are ellipsoidal heights. The elevation angle is the angle of the line
of sight above the local horizontal at point 1. The slant range is the
three-dimensional Cartesian distance between point 1 and point 2. The
azimuth is the angle from north to the projection of the line of sight
on the local horizontal. Angles are in units of degrees; altitudes and
distances are in meters. The figure of the earth is the default ellipsoid
(GRS 80) as defined by almanac.
Inputs can be vectors of points, or arrays of any shape, but must match
in size, with the following exception: Elevation, range, and azimuth
from a single point to a set of points can be computed very efficiently
by providing scalar coordinate inputs for point 1 and vectors or arrays
for point 2.
[...] = elevation(lat1,lon1,alt1,lat2,lon2,alt2,...
angleunits) uses the string angleunits to specify the units of
the input and output angles. If the string angleunits is omitted,
'degrees' is assumed.
[...] = elevation(lat1,lon1,alt1,lat2,lon2,alt2,...
angleunits,distanceunits) uses the string distanceunits to
specify the altitude and slant-range units. If the string distanceunits
12-179
elevation
semimajor axis, and the slant range will be returned in these units. If
ellipsoid is omitted, the default earth ellipsoid defined by azimuth is
Examples
Visually check the result using the los2 line of sight function. Construct
a data grid of zeros to represent the Earths surface. The los2 function
with no output arguments creates a figure displaying the geometry.
Z = zeros(180,360);
refvec = [1 90 -180];
los2(Z,refvec,lat1,lon1,lat2,lon2,alt1,alt1);
12-180
elevation
x 10
Terrain
Visible
Obscured
Observer
7
0
See Also
3
4
5
Horizontal Distance from Observer
8
6
x 10
12-181
ellipse1
Purpose
Syntax
[lat,lon]
[lat,lon]
[lat,lon]
[lat,lon]
[lat,lon]
=
=
=
=
=
ellipse1(lat0,lon0,ellipse)
ellipse1(lat0,lon0,ellipse,offset)
ellipse1(lat0,lon0,ellipse,offset,az)
ellipse1(lat0,lon0,ellipse,offset,az,ellipsoid)
ellipse1(lat0,lon0,ellipse,offset,units)
[lat,lon] = ellipse1(lat0,lon0,ellipse,offset,az,
[lat,lon] = ellipse1(lat0,lon0,ellipse,offset,az,ellipsoid,
[lat,lon] = ellipse1(lat0,lon0,ellipse,offset,az,ellipsoid,
units,npts)
[lat,lon] = ellipse1(track,...)
mat = ellipse1(...)
Description
ellipse(s) where the major axis is rotated from due north by an azimuth
offset. The offset angle is measured clockwise from due north. If
offset = [], then no offset is assumed.
[lat,lon] = ellipse1(lat0,lon0,ellipse,offset,az) uses the
input az to define the ellipse arcs computed. The arc azimuths are
measured clockwise from due north. If az is a column vector, then the
arc length is computed from due north. If az is a two-column matrix,
then the ellipse arcs are computed starting at the azimuth in the first
column and ending at the azimuth in the second column. If az = [],
then a complete ellipse is computed.
12-182
ellipse1
[lat,lon] = ellipse1(lat0,lon0,ellipse,offset,az,ellipsoid)
computes the ellipse on the ellipsoid defined by the input ellipsoid
vector, of the form [semimajor axis,eccentricity]. If omitted, the
unit sphere, ellipsoid = [1 0], is assumed. When an ellipsoid is
supplied, the input semimajor axis must be in the same units as the
ellipsoid semimajor axes. In this calling form, the units of the ellipse
semimajor axis are not assumed to be in degrees.
[lat,lon] = ellipse1(lat0,lon0,ellipse,offset,units),
[lat,lon] = ellipse1(lat0,lon0,ellipse,offset,az,units), and
[lat,lon] =
ellipse1(lat0,lon0,ellipse,offset,az,ellipsoid,units) are
all valid calling forms, which use the input units to define
the angle units of the inputs and outputs. If the units string
is omitted, 'degrees' is assumed.
[lat,lon] =
ellipse1(lat0,lon0,ellipse,offset,az,ellipsoid,units,npts)
uses the scalar npts to determine the number of points per ellipse
computed. If npts is omitted, 100 points are used.
[lat,lon] = ellipse1(track,...) uses the track string to define
either great circle or rhumb line distances from the ellipse center. If
track = 'gc', then great circle distances are computed (the default). If
track = 'rh', then rhumb line distances are computed.
mat = ellipse1(...) returns a single output argument where mat =
[lat lon]. This is useful if only one ellipse is computed.
Examples
Create and plot the small ellipse centered at (0,0), with a semimajor
axis of 10 and a semiminor axis of 5.
axesm mercator
ecc = axes2ecc(10,5);
plotm(0,0,'r+')
[elat,elon] = ellipse1(0,0,[10 ecc],45);
12-183
ellipse1
plotm(elat,elon)
12-184
ellipse1
See Also
12-185
encodem
Purpose
Syntax
newgrid = encodem(Z,seedmat)
newgrid = encodem(Z,seedmat,stopvals)
Description
and the values associated with them, are specified by the three-column
matrix seedmat, the rows of which have the form [row column value].
newgrid = encodem(Z,seedmat,stopvals) allows you to specify a
vector, stopvals, of stopping values. Any value that is an element of
stopvals will act as a boundary.
Examples
For this imaginary map, fill in the upper right region with 7s and the
lower left region with 3s:
Z = eye(4)
Z =
1
0
0
0
0
1
0
0
0
0
1
0
0
0
0
1
12-186
encodem
3
3
3
See Also
1
3
3
7
1
3
7
7
1
getseeds, imbedm
12-187
epsm
Purpose
Syntax
epsm
epsm(units)
Description
Examples
% kilometers
See Also
12-188
roundn
eqa2grn
Purpose
Syntax
[lat,lon] = eqa2grn(x,y)
[lat,lon] = eqa2grn(x,y,origin)
[lat,lon] = eqa2grn(x,y,origin,ellipsoid)
[lat,lon] = eqa2grn(x,y,origin,units)
mat = eqa2grn(x,y,origin...)
Description
variable.
This function converts data from equal-area x-y coordinates to
geographic (latitude-longitude) coordinates. The opposite conversion
can be performed with grn2eqa.
Examples
[lat,lon] = eqa2grn(.5,.5)
lat =
30.0000
lon =
28.6479
12-189
eqa2grn
See Also
12-190
grn2eqa, hista
etopo
Purpose
Syntax
[Z,
[Z,
[Z,
[Z,
[Z,
Description
[Z, refvec] = etopo reads the ETOPO data for the entire world
from the ETOPO data in the current directory. The current directory
is searched first for ETOPO2 binary data, followed by ETOPO5
binary data, followed by ETOPO5 ASCII data from the file names
etopo5.northern.bat and etopo5.southern.bat. Once a match is
found the data is read. The data grid, Z, is returned as an array of
elevations. Data values are in whole meters, representing the elevation
of the center of each cell. refvec is the associated three-element
referencing vector that geolocates Z.
refvec]
refvec]
refvec]
refvec]
refvec]
=
=
=
=
=
etopo
etopo(samplefactor)
etopo(samplefactor, latlim, lonlim)
etopo(directory, ...)
etopo(file, ...)
scalar integer, which when equal to 1 gives the data at its full resolution
(1080 by 4320 values for ETOPO5 data and 5400 by 10800 values for
ETOPO2 data). When samplefactor is an integer n greater than one,
every nth point is returned. samplefactor must divide evenly into
the number of rows and columns of the data file. If samplefactor is
omitted or empty, it defaults to 1.
[Z, refvec] = etopo(samplefactor, latlim, lonlim) reads the
data for the part of the world within the specified latitude and longitude
limits. The limits of the desired data are specified as two-element
vectors of latitude, latlim, and longitude, lonlim, in degrees. The
elements of latlim and lonlim must be in ascending order. lonlim
must be specified in the range [0 360] for ETOPO5 data and [-180
180] for ETOPO2 data. If latlim is empty the latitude limits are [-90
90]. If lonlim is empty, the longitude limits are determined by the
file type.
12-191
etopo
Background
Remarks
Examples
Example 1
% Read and display the ETOPO5 data from the directory 'etopo5'
% downsampled by a factor of 10.
12-192
etopo
Size
216x432
1x3
Bytes
746496
24
Class
double array
double array
Example 2
% From the current directory, read and display the
% ETOPO2 binary data downsampled by a factor of 10.
cd etopo2
[Z, refvec] = etopo('ETOPO2.dos.bin', 10);
whos
Name
Z
refvec
Size
540x1080
1x3
Bytes
4665600
24
Class
double array
double array
12-193
etopo
colormap(demcmap(Z));
See Also
12-194
etopo5
Purpose
Syntax
Description
[Z, refvec] = etopo5 reads the topography data for the entire world
for the data in the current directory. The current directory is searched
first for ETOPO2 binary data, followed by ETOPO5 binary data, followed
by ETOPO5 ASCII data from the file names etopo5.northern.bat
and etopo5.southern.bat. Once a match is found the data is read.
The data grid, Z, is returned as an array of elevations. Data values
are in whole meters, representing the elevation of the center of each
cell. refvec is the associated three-element referencing vector that
geolocates Z.
[Z, refvec] = etopo5(samplefactor) reads the data for the entire
world, downsampling the data by samplefactor. samplefactor is a
scalar integer, which when equal to 1 gives the data at its full resolution
(1080 by 4320 values). When samplefactor is an integer n greater than
one, every nth point is returned. samplefactor must divide evenly into
the number of rows and columns of the data file. If samplefactor is
omitted or empty, it defaults to 1.
[[Z, refvec] = etopo5(samplefactor, latlim, lonlim) reads the
data for the part of the world within the specified latitude and longitude
limits. The limits of the desired data are specified as two-element
vectors of latitude, latlim, and longitude, lonlim, in degrees. The
elements of latlim and lonlim must be in ascending order. If latlim is
empty the latitude limits are [-90 90]. lonlim must be specified in the
range [0 360]. If lonlim is empty, the longitude limits are [0 360].
12-195
etopo5
[Z, refvec] = etopo5(directory, ...) allows the path for the data
file to be specified by directory rather than the current directory.
[Z, refvec] = etopo5(file, ...) reads the data from file, where
file is a string or a cell array of strings containing the name or names
Examples
Example 1
Read every tenth point in the data set:
% Read and display the ETOPO5 data from the directory 'etopo5'
% downsampled by a factor of 10.
[Z, refvec] = etopo5('etopo5',10);
axesm merc
geoshow(Z, refvec, 'DisplayType', 'surface');
colormap(demcmap(Z));
Example 2
Read in data for Korea and Japan at the full resolution:
samplefactor = 1; latlim = [30 45]; lonlim = [115 145];
[Z,refvec] = etopo5(samplefactor,latlim,lonlim);
whos Z
Name
Z
See Also
12-196
Size
180x360
Bytes
518400
Class
double array
extractfield
Purpose
Syntax
a = extractfield(s, name)
Description
field name contain a string or if the field values are not uniform in
type; otherwise a is the same type as the field values. The shape of the
input field is not preserved in a.
Examples
a
=
=
=
12-197
extractfield
See Also
12-198
struct, shaperead
extractm
Purpose
Syntax
[lat,lon] = extractm(display_struct,object_str)
[lat,lon] = extractm(display_struct,object_strings)
[lat,lon] = extractm(display_struct,object_strings,
searchmethod)
[lat,lon] = extractm(display_struct)
[lat,lon,indx] = extractm(...)
mat = extractm(...)
Description
12-199
extractm
'strmatch'
'findstr'
'exact'
criteria.
mat = extractm(...) returns the vector data in a single matrix,
where mat = [lat lon].
Example
12-200
extractm
Remarks
See Also
12-201
fill3m
Purpose
Syntax
h = fill3m(lat,lon,z,cdata)
h = fill3m(lat,lon,z,PropertyName,PropertyValue,...)
Description
Examples
12-202
fill3m
See Also
12-203
fillm
Purpose
Syntax
h = fillm(lat,lon,cdata)
h = fillm(lat,lon,'PropertyName',PropertyValue,...)
Description
Examples
12-204
fillm
See Also
12-205
filterm
Purpose
Syntax
[latout,lonout] = filterm(lat,lon,Z,R,allowed)
[latout,lonout,indx] = filterm(lat,lon,Z,R,allowed)
Description
latitudes and longitudes to include only those data points which have a
corresponding value in Z equal to allowed. R is either a 1-by-3 vector
containing elements:
[cells/degree northern_latitude_limit western_longitude_limit]
Examples
Filter a random set of 100 geographic points. Use the topo map for
starters:
load topo
12-206
filterm
ans =
15
See Also
12-207
findm
Purpose
Syntax
[lat,lon] = findm(Z,R)
[lat,lon] = findm(latz,lonz,Z)
[lat,lon,val] = findm(...)
mat = findm(...)
Description
This function works in two modes: with a regular data grid and with a
geolocated data grid.
Example
12-208
The data grid can be the result of a logical operation. For instance, you
can find all locations with elevations greater than 5500 meters.
findm
load topo
[lat, lon] = findm((topo>5500),topolegend);
[lat lon]
ans =
34.5000
34.5000
30.5000
28.5000
79.5000
80.5000
84.5000
86.5000
These points are in the Himalayas. Find the grid values at these
locations with setpostn:
heights = topo(setpostn(topo,topolegend,lat,lon))
heights =
5559
5515
5523
5731
See Also
12-209
fipsname
Purpose
Syntax
struc = fipsname
struc = fipsname(filename)
Description
struc = fipsname opens a file selection window to pick the file, reads
Background
The TIGER thinned boundary files provided by the U.S. Census use
FIPS codes to identify geographic entities. This function reads the FIPS
files as provided with the TIGER files. These files generally have names
of the format _name.dat.
Remarks
The FIPS name files, along with TIGER thinned boundary files, are
available over the Internet.
Note For details on locating map data for download over the
Internet, see the following documentation at the MathWorks Web site:
http://www.mathworks.com/support/tech-notes/2100/2101.html.
Example
struc = fipsname('st_name.dat')
struc =
1x57 struct array with fields:
name
id
s(1)
ans =
name: 'Alabama'
id: 1
12-210
flat2ecc
Purpose
Syntax
eccentricity = flat2ecc(flattening)
Description
Example
e = flat2ecc(0.003353)
e =
0.08182149712026
See Also
12-211
flatearthpoly
Purpose
Syntax
[latf,lonf] = flatearthpoly(lat,lon)
[latf,lonf] = flatearthpoly(lat,lon,longitudeOrigin)
Description
Remarks
The polygon topology for the input vectors must be valid. This means
that vertices for outer rings (main polygon or island polygons) must
be in clockwise order, and any inner rings (lakes) must run in
counterclockwise order for the function to work properly. You can use
the ispolycw function to check whether or not your lat, lon vectors
meet this criterion, and the poly2cw and poly2ccw functions to correct
any that run in the wrong direction.
Example
Vector data for geographic objects that encompass a pole will inevitably
encounter or cross the date line. While the toolbox properly displays
such polygons, they can cause problems for functions like the polygon
intersection and Boolean operations that work with Cartesian
coordinates. When these polygons are treated as Cartesian coordinates,
the date line crossing results in a spurious line segment, and the
polygon displayed as a patch does not have the interior filled correctly.
antarctica = shaperead('landareas', 'UseGeoCoords', true,...
'Selector', {@(name) strcmp(name,'Antarctica'), 'Name'});
figure; plot(antarctica.Lon, antarctica.Lat); ylim([-100 -60])
12-212
flatearthpoly
12-213
flatearthpoly
See Also
12-214
framem
Purpose
Syntax
framem
framem('on')
framem('off')
framem('reset')
framem(linespec)
framem(PropertyName,PropertyValue,...)
Description
framem toggles the visibility of the map frame by setting the map axes
property Frame to 'on' or 'off'. The default setting for map axes is
'off'.
framem('on') sets the map axes property Frame to 'on'.
framem('off') sets the map axes property Frame to 'off'.
When called with the string argument 'off', the map axes property
Frame is set to 'off'.
framem('reset') resets the entire frame using the current properties.
This is essentially a refresh option.
framem(linespec) sets the map axes FEdgeColor property to the color
component of any linespec string recognized by the MATLAB line
function.
framem(PropertyName,PropertyValue,...) sets the appropriate map
axes properties to the desired values. These property names and values
are described on the axesm reference page.
Remarks
You can also create or alter map frame properties using the axesm or
setm functions.
See Also
axesm, setm
12-215
fromDegrees
Purpose
Syntax
Description
See Also
12-216
fromRadians
Purpose
Syntax
Description
See Also
12-217
gc2sc
Purpose
Syntax
[centerlat,centerlong,radius] = gc2sc(lat,long,az)
[centerlat,centerlong,radius] = gc2sc(lat,long,az,units)
mat = gc2sc(...)
Description
Definitions
Examples
12-218
gc2sc
See Also
12-219
gcm
Purpose
Syntax
mstruct = gcm
mstruct = gcm(hndl)
Description
mstruct = gcm returns the map axes map structure, which contains the
settings for all the current map axes properties.
mstruct = gcm(hndl) specifies the map axes by axes handle.
Examples
Establish a map axes with default values, then look at the structure:
axesm mercator
mstruct = gcm
mstruct =
mapprojection:
zone:
angleunits:
aspect:
falsenorthing:
falseeasting:
fixedorient:
geoid:
maplatlimit:
maplonlimit:
mapparallels:
nparallels:
origin:
scalefactor:
trimlat:
trimlon:
frame:
ffill:
fedgecolor:
ffacecolor:
flatlimit:
12-220
'mercator'
[]
'degrees'
'normal'
0
0
[]
[1 0]
[-86 86]
[-180 180]
0
1
[0 0 0]
1
[-86 86]
[-180 180]
'off'
100
[0 0 0]
'none'
[-86 86]
gcm
flinewidth:
flonlimit:
grid:
galtitude:
gcolor:
glinestyle:
glinewidth:
mlineexception:
mlinefill:
mlinelimit:
mlinelocation:
mlinevisible:
plineexception:
plinefill:
plinelimit:
plinelocation:
plinevisible:
fontangle:
fontcolor:
fontname:
fontsize:
fontunits:
fontweight:
labelformat:
labelrotation:
labelunits:
meridianlabel:
mlabellocation:
mlabelparallel:
mlabelround:
parallellabel:
plabellocation:
plabelmeridian:
plabelround:
2
[-180 180]
'off'
Inf
[0 0 0]
':'
0.5000
[]
100
[]
30
'on'
[]
100
[]
15
'on'
'normal'
[0 0 0]
'Helvetica'
10
'points'
'normal'
'compass'
'off'
'degrees'
'off'
30
86
0
'off'
15
-180
0
12-221
gcm
Remarks
You create map structure properties with the axesm function. You can
query them with the getm function and modify them with the setm
function.
See Also
12-222
gcpmap
Purpose
Syntax
pt = gcpmap
pt = gcpmap(hndl)
Description
Remarks
Example
-69.967
-69.967
2
0
whos
12-223
gcpmap
Name
pt
See Also
12-224
Size
2x3
Bytes
48
Class
double array
Attributes
gcwaypts
Purpose
Syntax
[lat,lon] = gcwaypts(lat1,lon1,lat2,lon2)
[lat,lon] = gcwaypts(lat1,lon1,lat2,lon2,nlegs)
pts = gcwaypts(lat1,lon1,lat2,lon2...)
Description
Background
Examples
Imagine you own a sailing yacht and are planning a voyage from North
Point, Barbados (13.33 N,59.62W), to Brest, France (48.36N,4.49W).
To divide the track into three equal-length segments,
figure('color','w');
ha = axesm('mapproj','mercator',...
12-225
gcwaypts
See Also
12-226
gcxgc
Purpose
Syntax
[newlat,newlong] = gcxgc(lat1,long1,az1,lat2,long2,az2)
[newlat,newlong] =
gcxgc(lat1,long1,az1,lat2,long2,az2,units)
Description
[newlat,newlong] = gcxgc(lat1,long1,az1,lat2,long2,az2)
For any pair of great circles, there are two possible intersection
conditions: the circles are identical or they intersect exactly twice on
the sphere.
Great circle notation consists of a point on the great circle and the
azimuth at that point along which the great circle proceeds.
Examples
-14.3105
-166.2162
Note that the two intersection points are always antipodes of each
other. As a simple example, consider the intersection points of two
meridians, which are just great circles with azimuths of 0 or 180:
12-227
gcxgc
[newlat,newlong] = gcxgc(10,13,0,0,20,180)
newlat =
-90
90
newlong =
-174.4504
12.5094
The two meridians intersect at the North and South Poles, which is
exactly correct.
See Also
12-228
gcxsc
Purpose
Syntax
[newlat,newlong] = gcxsc(gclat,gclong,gcaz,sclat,sclong,
scrange)
[newlat,newlong] = gcxsc(...,units)
Description
[newlat,newlong] =
gcxsc(gclat,gclong,gcaz,sclat,sclong,scrange) returns the
For a pairing of a great circle with a small circle, there are four possible
intersection conditions: the circles are identical (possible because great
circles are a subset of small circles), they do not intersect, they are
tangent to each other (the small circle interior to the great circle) and
hence they intersect once, or they intersect twice.
Great circle notation consists of a point on the great circle and the
azimuth at that point along which the great circle proceeds.
Small circle notation consists of a center point and a radius in units of
angular arc length.
Examples
58.9143
12-229
gcxsc
-1.6159
See Also
12-230
5.4039
geocentric2geodeticLat
Purpose
Syntax
Description
See Also
12-231
geodetic2ecef
Purpose
Syntax
[x,y,z] = geodetic2ecef(phi,lambda,h,ellipsoid)
Description
Definitions
Latitude where
axis intersects
surface
Longitude where
axis intersects
surface
Description
Equator/Prime
Meridian
90 E
Equator/90 E
meridian
90 N
NA
North Pole
See Also
12-232
geodetic2geocentricLat
Purpose
Syntax
Description
See Also
12-233
geoloc2grid
Purpose
Syntax
Description
and height of data cells in the regular data grid, using the same angular
units as lat and lon. Data cells in Z falling outside the area covered
by A are set to NaN.
Remarks
Example
12-234
geoloc2grid
'Grid','on','MeridianLabel','on','ParallelLabel','on');
set(ax,'Visible','off')
geoshow(lt1, lg1, map1, 'DisplayType', 'texturemap');
% Display 'Z' as a regular data grid in subplot 2
subplot(1,2,2)
ax =
axesm('mercator','MapLatLimit',latlim,'MapLonLimit',lonlim,...
'Grid','on','MeridianLabel','on','ParallelLabel','on');
set(ax,'Visible','off')
geoshow(Z, refvec, 'DisplayType', 'texturemap');
12-235
geoshow
Purpose
Syntax
geoshow(lat,lon)
geoshow(lat,lon, ..., 'DisplayType', displaytype, ...)
geoshow(lat,lon,Z, ..., 'DisplayType', displaytype, ...)
geoshow(Z,R, ..., 'DisplayType', displaytype,...),
geoshow(lat,lon,I),geoshow(lat,lon,BW),geoshow(lat,lon,X,
cmap), geoshow(lat,lon,RGB),
geoshow(...'DisplayType', ...)
geoshow(I,R),geoshow(BW,R),geoshow(RGB,R),geoshow(A,CMAP,R),
geoshow(... `DisplayType', ...)
geoshow(s)
geoshow(s, ..., `SymbolSpec', symspec)
geoshow(filename)
geoshow(ax, ...)
geoshow(..., 'Parent', ax, ...)
h = geoshow(...)
geoshow(..., param1, val1, param2, val2, ...)
Description
12-236
geoshow
12-237
geoshow
DisplayType
Shape file
GeoTIFF
'image'
TIFF/JPEG/PNG with
a world file
'image'
SDTS raster
Parameters
12-238
geoshow
Value(s)
Vector
Image
'image'
Grid
Graphics
Properties
Properties
'line'
12-239
geoshow
DisplayType
Properties
'point'
'polygon'
Remarks
When projecting data onto a map axes, geoshow uses the projection
stored with the map axes. When displaying on a regular axes, it
constructs a default Plate Carre projection with a scale factor of
180/pi, enabling direct readout of coordinates in degrees.
Note When you display vector data in a map axes using geoshow, you
should not subsequently change the map projection using setm. You
can, however, change the projection with setm for raster data. For more
information, see Changing Map Projections when Using geoshow on
page 4-40.
geoshow adds graphics to the current map axes (it does not clear it
first), enabling you to create multiple raster and vector map layers. If
you do not want geoshow to draw on top of an existing map, create a
new figure or subplot before calling it.
12-240
geoshow
Examples
Example 1
Display world land areas using a default Plate Carree projection:
figure
geoshow('landareas.shp', 'FaceColor', [0.5 1.0 0.5]);
Example 2
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'}, ...
12-241
geoshow
Example 3
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');
colormap(demcmap(map))
% Display the land area boundary as black lines.
12-242
geoshow
S = shaperead('landareas','UseGeoCoords',true);
geoshow([S.Lat], [S.Lon],'Color','black');
Example 4
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.
12-243
geoshow
hcb = colorbar('horiz');
set(get(hcb,'Xlabel'),'String','EGM96 Geoid Heights in Meters.')
% Mask out all the land.
geoshow('landareas.shp', 'FaceColor', 'black');
Example 5
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.
12-244
geoshow
Example 6
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)
12-245
geoshow
% Orthographic projection
figure
axesm ortho
geoshow(moonalb, moonalbrefvec, 'DisplayType', 'texturemap')
colormap(gray(256))
axis off
12-246
geoshow
Example 7
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(:))];
12-247
geoshow
12-248
geoshow
daspectm('m',1)
view(3)
See Also
12-249
geotiff2mstruct
Purpose
Syntax
mstruct = geotiff2mstruct(proj)
Description
Example
ans =
12-250
geotiff2mstruct
See Also
12-251
geotiffinfo
Purpose
Syntax
info = geotiffinfo(filename)
info = geotiffinfo(url)
Description
Field
Description
12-252
FileModDate
FileSize
Format
FormatVersion
geotiffinfo
Height
Width
BitDepth
ColorType
ModelType
PCS
Projection
MapSys
Zone
CTProjection
ProjParm
12-253
geotiffinfo
ProjParmId
GCS
Datum
12-254
Ellipsoid
SemiMajor
SemiMinor
geotiffinfo
PM
PixelScale
12-255
geotiffinfo
RefMatrix
BoundingBox
CornerCoords
12-256
geotiffinfo
GeoTIFFCodes
Model
PCS
GCS
UOMLength
UOMAngle
Datum
PM
Ellipsoid
ProjCode
Projection
CTProjection
ProjParmId
MapSys
Each is scalar, except for ProjParmId, which
is a column vector.
ImageDescription
Example
info = geotiffinfo('boston.tif')
info =
Filename: [1x78 char]
12-257
geotiffinfo
FileModDate:
FileSize:
Format:
FormatVersion:
Height:
Width:
BitDepth:
ColorType:
ModelType:
PCS:
Projection:
MapSys:
Zone:
CTProjection:
ProjParm:
ProjParmId:
GCS:
Datum:
Ellipsoid:
SemiMajor:
SemiMinor:
PM:
PMLongToGreenwich:
UOMLength:
UOMLengthInMeters:
UOMAngle:
UOMAngleInDegrees:
TiePoints:
PixelScale:
RefMatrix:
BoundingBox:
CornerCoords:
GeoTIFFCodes:
ImageDescription:
See Also
12-258
'31-May-2007 03:25:30'
38729900
'tif'
[]
2881
4481
24
'truecolor'
'ModelTypeProjected'
'NAD83 / Massachusetts Mainland'
'SPCS83 Massachusetts Mainland zone (m)'
'STATE_PLANE_83'
2001
'CT_LambertConfConic_2SP'
[7x1 double]
{7x1 cell}
'NAD83'
'North American Datum 1983'
'GRS 1980'
6378137
6.3568e+006
'Greenwich'
0
'US survey foot'
0.3048
'degree'
1.0000
[1x1 struct]
[3x1 double]
[3x2 double]
[2x2 double]
[1x1 struct]
[1x1 struct]
'"GeoEye"'
geotiffread
Purpose
Syntax
A = geotiffread(filename)
[X, cmap] = geotiffread(filename)
[X, cmap, R, bbox] = geotiffread(filename)
[A, R, bbox] = geotiffread(filename)
[...] = geotiffread(filename, idx)
[...] = geotiffread(url, ...)
Description
12-259
geotiffread
Example
12-260
geotiffread
See Also
12-261
getm
Purpose
Syntax
mat = getm(h)
mat = getm(h,MapPropertyName)
getm('MapProjection')
getm('axes')
getm('units')
Description
mat = getm(h) returns the map structure of the map axes specified by
its handle. If the handle of a child of the map axes is specified, only
its properties are returned.
mat = getm(h,MapPropertyName) returns the specified property value.
getm('MapProjection') lists all available projections.
getm('axes') lists the map axes properties by property name.
getm('units') lists the available units.
Examples
See Also
12-262
axesm, setm
getseeds
Purpose
Syntax
[row,col,val] = getseeds(map,R,nseeds)
[row,col,val] = getseeds(map,R,nseeds,seedval)
mat = getseeds(...)
Description
Examples
12-263
getseeds
seedmat = getseeds(topo,topolegend,3)
When you have selected three points, you are prompted for their values.
The regular data grid need not be displayed to execute getseeds on it.
See Also
12-264
encodem
getworldfilename
Purpose
Syntax
worldfilename = getworldfilename(imagefilename)
Description
Examples
See Also
Worldfile Name
myimage.tif
myimage.tfw
myimage.jpeg
myimage.jpegw
myimage
myimage.wld
12-265
globedem
Purpose
Syntax
[Z,refvec] = globedem(filename,scalefactor)
[Z,refvec] = globedem(filename,scalefactor,latlim,lonlim)
[Z,refvec] = globedem(dirname,scalefactor,latlim,lonlim)
Description
allows a subset of the map data to be read. The limits of the desired
data are specified as vectors of latitude and longitude in degrees. The
elements of latlim and lonlim must be in ascending order.
[Z,refvec] = globedem(dirname,scalefactor,latlim,lonlim)
Background
12-266
GLOBE, the Global Land One-km Base Elevation data, was compiled
by the National Geophysical Data Center from more than 10 different
sources of gridded elevation data. GLOBE can be considered a higher
resolution successor to TerrainBase. The data set consists of 16 tiles,
each covering 50 by 90 degrees. Tiles require as much as 60 MB of
storage. Uncompressed tiles take between 100 and 130 MB.
globedem
Remarks
The globedem function reads data from GLOBE Version 1.0. The data
is for elevations only. Elevations are given in meters above mean sea
level using WGS 84 as a horizontal datum. Areas with no data, such as
the oceans, are coded with NaNs.
The data set and documentation are available over the Internet.
Note For details on locating map data for download over the
Internet, see the following documentation at the MathWorks Web site:
http://www.mathworks.com/support/tech-notes/2100/2101.html.
Examples
Determine the file that contains the area around Cape Cod.
latlim = [41 42.5]; lonlim = [-73 -69.9];
globedems(latlim,lonlim)
ans =
'f10g'
Extract every 20th point from the tile covering the northeastern United
States and eastern Canada. Provide an empty file name, and select
the file interactively.
[Z,refvec] = globedem([],20);
size(Z)
ans =
300
540
12-267
globedem
181 373
Extract some data for southern Louisiana in an area that straddles two
tiles. Provide the name of the directory containing the data files, and let
globedem determine which files are required, read from the files, and
concatenate the data into a single regular data grid.
latlim =[28.61 31.31]; lonlim = [-91.24 -88.62];
globedems(latlim,lonlim)
ans =
'e10g'
'f10g'
[Z,refvec] =
globedem('d:\externalData\globe\elev',1,latlim,lonlim);
size(Z)
ans =
325.00
315.00
References
See Web site for the National Oceanic and Atmospheric Administration,
National Geophysical Data Center
See Also
12-268
globedems
Purpose
Syntax
fname = globedems(latlim,lonlim)
Description
Background
GLOBE, the Global Land One-km Base Elevation data, was compiled
by the National Geophysical Data Center from more than 10 different
sources of gridded elevation data. The data set consists of 16 tiles, each
covering 50 by 90 degrees. Determining which files are needed to cover
a particular region generally requires consulting an index map. This
function takes the place of such a reference by returning the filenames
for a given geographic region.
Remarks
The globedems function reads data from GLOBE Version 1.0. GLOBE
DEM first reads the corresponding ESRI header file found in the
subdirectory '/esri/hdr/' and then the binary data file (with no
extension).
Examples
References
See Web site for the National Oceanic and Atmospheric Administration,
National Geophysical Data Center
See Also
globedem
12-269
gradientm
Purpose
Syntax
Description
gradE] = gradientm(Z, R)
lon, Z)
ellipsoid)
lon, Z, ellipsoid, units)
[...]
12-270
gradientm
Remarks
Example
Compute and display the slope for the 30 arc-second (10 km) Korea
elevation data. Slopes in the Sea of Japan are up to 8 degrees at this
grid resolution.
load korea
[aspect, slope, gradN, gradE] = gradientm(map, refvec);
worldmap(slope, refvec)
geoshow(slope, refvec, 'DisplayType', 'texturemap')
cmap = cool(10);
demcmap('inc', slope, 1, [], cmap)
colorbar
latlim = getm(gca,'maplatlimit');
lonlim = getm(gca,'maplonlimit');
land = shaperead('landareas',...
'UseGeoCoords', true, 'BoundingBox', [lonlim' latlim']);
geoshow(land, 'FaceColor', 'none')
set(gca, 'Visible', 'off')
12-271
gradientm
See Also
12-272
viewshed
grepfields
Purpose
Syntax
grepfields(filename,searchstring)
grepfields(filename,searchstring,casesens)
grepfields(filename,searchstring,casesens,startcol)
grepfields(filename,searchstring,casesens,startfield,fields)
grepfields(filename,searchstring,casesens,startfield,fields,
machineformat)
indx = grepfields(...)
Description
1 and the bytes per record in the file. In this calling form, the file is
regarded as a text file with line endings.
grepfields(filename,searchstring,casesens,startfield,fields)
searches within the specified field. startfield is an integer between 1
and the number of fields per record. The format of the file is described
by the fields structure. See readfields for recognized fields structure
entries. In this calling form, the file can be binary and lack line endings.
The search is within startfield, which must be a character field.
grepfields(filename,searchstring,casesens,startfield,fields,
machineformat) opens the file with the specified machine format.
machineformat must be recognized by fopen.
indx = grepfields(...) returns the record numbers of matched
12-273
grepfields
Example
=
=
=
=
=
Find the record matching the string 'character2'. The record contains
binary data, which cannot be properly displayed.
grepfields('testbin','character2','none',1,fs)
character2? ? ?
?@
indx = grepfields('testbin','character2','none',1,fs)
indx =
2
12-274
grepfields
fs(1).length
fs(2).length
fs(3).length
fs(4).length
fs(5).length
=
=
=
=
=
Find the records that match, starting the search in column 11.
grepfields('testfile1','data 2','none',11)
character data 2 11 22 33 2e6 20D6
Limitations
Remarks
See Also
readfields, fopen
12-275
gridm
Purpose
Syntax
gridm
gridm('on')
gridm('off')
gridm('reset')
gridm(linespec)
gridm(MapAxesPropertyName, PropertyValue,...)
h = gridm(...)
Description
visible.
gridm('off') makes the graticule invisible.
gridm('reset') redraws the graticule using the current map axes
properties.
gridm(linespec) uses any valid linespec string to control the
Remarks
You can also create or alter map grid properties using the axesm or
setm functions.
See Also
axesm, setm
12-276
grid2image
Purpose
Syntax
grid2image(Z,R)
grid2image(Z,R,'PropertyName',PropertyValue,...)
h = grid2image(...)
Description
See Also
12-277
grn2eqa
Purpose
Syntax
[x,y]
[x,y]
[x,y]
[x,y]
mat =
Description
= grn2eqa(lat,lon)
= grn2eqa(lat,lon,origin)
= grn2eqa(lat,lon,origin,ellipsoid)
= grn2eqa(lat,lon,origin,units)
grn2eqa(lat,lon,origin...)
variable.
The grn2eqa function converts data from Greenwich-based
latitude-longitude coordinates to equal-area x-y coordinates. The
opposite conversion can be performed with eqa2grn.
Examples
0.4014
0.8290
0.5592
y =
12-278
grn2eqa
See Also
eqa2grn, hista
12-279
gshhs
Purpose
Syntax
S = gshhs(filename)
S = gshhs(filename, latlim, lonlim)
indexfilename = gshhs(filename, 'createindex')
Description
Output
Structure
12-280
Field Name
Field Contents
Geometry
'Polygon'
gshhs
(Continued)
Remarks
Field Name
Field Contents
BoundingBox
Lon
Coordinate vector
Lat
Coordinate vector
South
North
West
East
Area
Level
LevelString
NumPoints
FormatVersion
Source
CrossGreenwich
GSHHS_ID
If you are extracting data within specified geographic limits and using
data other than coarse resolution, consider creating an index file first.
Also, to speed rendering when mapping very large amounts of data, you
might want to plot the data as NaN-clipped lines rather than as patches.
Note that when you specify latitude-longitude limits, polygons that
completely fall outside those limits are excluded, but no trimming of
features that partially traverse the region is performed. If you want to
12-281
gshhs
Background
Examples
Example 1
Read the entire coarse data set (located on the MATLAB path in
matlabroot/toolbox/map/mapdemos) and display as a coastline:
filename = gunzip('gshhs_c.b.gz', tempdir);
world = gshhs(filename{1});
delete(filename{1})
figure
worldmap world
geoshow([world.Lat], [world.Lon])
12-282
gshhs
After creating an index file, read and display Africa as a green polygon;
note that gshhs detects and uses the index file automatically:
filename = gunzip('gshhs_c.b.gz', tempdir);
indexname = gshhs(filename{1}, 'createindex');
figure
worldmap Africa
projection = gcm;
latlim = projection.maplatlimit;
lonlim = projection.maplonlimit;
africa = gshhs(filename{1}, latlim, lonlim);
delete(filename{1})
delete(indexname)
geoshow(africa, 'FaceColor', 'green')
setm(gca, 'FFaceColor', 'cyan')
12-283
gshhs
Example 2
Read all of the lowest resolution database:
s = gshhs('gshhs_c.b')
Example 3
Read the intermediate resolution database for South America:
s = gshhs('gshhs_i.b',[-60 -15],[-90 -30])
Example 4
Read the full-resolution file for East and West Falkland Islands (Islas
Malvinas):
12-284
gshhs
Example 5
Create the index file for the high-resolution database:
gshhs('gshhs_h.b','createindex')
See Also
12-285
gtextm
Purpose
Syntax
h = gtextm(string)
h = gtextm(string,PropertyName,PropertyValue,...)
Description
selected by mouse input. When this function is called, the current map
axes are brought up and the cursor is activated for mouse-click position
entry. The text objects handle is returned.
h = gtextm(string,PropertyName,PropertyValue,...) allows the
specification of any properties supported by the MATLAB text function.
Example
See Also
12-286
axesm, textm
gtopo30
Purpose
Syntax
[Z,refvec]
[Z,refvec]
[Z,refvec]
[Z,refvec]
Description
=
=
=
=
gtopo30(tilename)
gtopo30(tilename,samplefactor)
gtopo30(tilename,samplefactor,latlim,lonlim)
gtopo30(dirname,samplefactor,latlim,lonlim)
which when equal to 1 reads the data at its full resolution. When
samplefactor is an integer n greater than one, every nth point is read.
If samplefactor is omitted or empty, it defaults to 1.
[Z,refvec] = gtopo30(tilename,samplefactor,latlim,lonlim)
reads a subset of the elevation data from tilename. The limits of the
desired data are specified as two-element vectors of latitude, latlim,
and longitude, lonlim, in degrees. The elements of latlim and lonlim
must be in ascending order. Longitude limits range from [-180 180].
If latlim and lonlim are omitted, the coordinate limits are determined
from the file. The latitude and longitude limits are snapped outward
to define the smallest possible rectangular grid of GTOPO30 cells that
fully encloses the area defined by the input limits. Any cells in this grid
that fall outside the extent of the tile are filled with NaN.
[Z,refvec] = gtopo30(dirname,samplefactor,latlim,lonlim)
12-287
gtopo30
Examples
Example 1
Extract and display full resolution data for the state of Massachusetts:
% Read the stateline polygon boundary and calculate boundary limits.
Massachusetts = shaperead('usastatehi','UseGeoCoords',true, ...
'Selector',{@(name) strcmpi(name,'Massachusetts'),'Name'});
latlim = [min(Massachusetts.Lat(:)) max(Massachusetts.Lat(:))];
lonlim = [min(Massachusetts.Lon(:)) max(Massachusetts.Lon(:))];
% Read the GTOPO30 data at full resolution.
[Z,refvec] = gtopo30('W100N90',1,latlim,lonlim);
% Display the data grid and overlay the stateline boundary.
12-288
gtopo30
figure
usamap(Z,refvec);
geoshow(Z,refvec,'DisplayType','surface')
colormap(demcmap(Z))
geoshow(Massachusetts,'DisplayType','polygon',...
'facecolor','none','edgecolor','y')
Example 2
% Extract every 20th point from a tile.
% Provide an empty filename and select the file interactively.
[Z,refvec] = gtopo30([],20);
Example 3
% Extract data for Thailand, an area which straddles two tiles.
% The data is on CD number 3 distributed by the USGS.
% The CD-device is 'F:\'
latlim = [5.22 20.90];
lonlim = [96.72 106.38];
gtopo30s(latlim,lonlim)
% Extract every fifth data point for Thailand.
% Specify actual directory or mapped drive if not "F:\'
[Z,refvec] = gtopo30('F:\',5,latlim,lonlim);
worldmap(Z,refvec);
12-289
gtopo30
geoshow(Z,refvec,'DisplayType','surface')
colormap(demcmap(Z))
Example 4
% Extract every 10th point from a column of data 5 degrees around
% the prime meridian. The current directory contains GTOPO30 data.
[Z,refvec] = gtopo30(pwd,10,[],[-5 5]);
See Also
12-290
gtopo30s
Purpose
Syntax
fname = gtopo30s(latlim,lonlim)
Description
Remarks
The data and documentation are available over the Internet via http
and anonymous ftp.
Note For details on locating map data for download over the
Internet, see the following documentation at the MathWorks Web site:
http://www.mathworks.com/support/tech-notes/2100/2101.html.
See Also
gtopo30
12-291
handlem
Purpose
Syntax
handlem or handlem('taglist')
h = handlem('prompt')
h = handlem(object)
handlem('object',axesh)
handlem('object',axesh,'searchmethod')
h = handlem(handles)
Description
12-292
'all'
'clabels'
'contour'
'contour3d'
'cpatches'
'frame'
Map frame
'grid'
'hggroup'
'hidden'
'image'
'light'
'line'
handlem
'map'
'meridian'
'mlabel'
Longitude labels
'parallel'
'patch'
'plabel'
Latitude labels
'scaleruler'
Scaleruler objects
'surface'
'text'
'tissot'
'visible'
12-293
handlem
See Also
12-294
hidem
Purpose
Syntax
hidem
hidem(handle)
hidem(object)
Description
hidem brings up a dialog box for selecting the objects to hide (set their
Visible property to 'off').
hidem(handle) hides the objects specified by a vector of handles.
hidem(object) hides those objects specified by the object string,
which can be any string recognized by the handlem function.
See Also
12-295
hista
Purpose
Syntax
[lat,lon,num]
[lat,lon,num]
[lat,lon,num]
[lat,lon,num]
Description
=
=
=
=
hista(lats,lons)
hista(lats,lons,binarea)
hista(lats,lons,binarea,ellipsoid)
hista(lats,lons,binarea,units)
Examples
0.8462
0.5252
0.2026
0.6721
0.8381
0.0196
0.6813
0.3795
0.8318
0.5028
0.7095
0.4289
0.3784
0.8600
0.8537
0.4966
0.8998
0.8216
longs = rand(4)
longs =
0.3046
0.1897
0.1934
12-296
0.3028
0.5417
0.1509
hista
0.6822
0.6979
0.5936
0.6449
See Also
0.3757
0.3757
0.8253
0.8253
0.8254
4.0000
5.0000
1.0000
2.0000
4.0000
12-297
histr
Purpose
Syntax
[lat,lon,num,wnum] = histr(lats,lons)
[lat,lon,num,wnum] = histr(lats,lons,units)
[lat,lon,num,wnum] = histr(lats,lons,bindensty)
Description
The histr function sorts geographic data into equirectangular bins for
histogram purposes. Equirectangular in this context means that each
bin has the same angular measurement on each side (e.g., 1-by-1).
Consequently, the result is not an equal-area histogram. The hista
function provides that capability. However, the results of histr can be
weighted by their area bias to correct for this, in some sense.
Examples
12-298
0.8462
0.5252
0.2026
0.6721
0.8381
0.0196
0.6813
0.3795
0.8318
0.5028
0.7095
0.4289
histr
longs = rand(4)
longs =
0.3046
0.1897
0.1934
0.6822
0.3028
0.5417
0.1509
0.6979
0.3784
0.8600
0.8537
0.5936
0.4966
0.8998
0.8216
0.6449
Bin the data in 0.5-by-0.5 degree cells (two bins per degree):
[lat,lon,num,wnum] = histr(lats,longs,2);
[lat,lon,num,wnum]
ans =
0.2500
0.7500
0.2500
0.7500
0.2500
0.2500
0.7500
0.7500
3.0000
4.0000
4.0000
5.0000
3.0000
4.0003
4.0000
5.0004
The bins centered at 0.75N are slightly smaller in area than the others.
wnum reflects the relative count per normalized unit area.
See Also
filterm, hista
12-299
imbedm
Purpose
Syntax
Description
Examples
12-300
imbedm
1
1
1
1
1
1
1
1
1
1
1
1
refvec = [1/60 90 -180]
refvec =
0.0167
1
1
1
1
1
1
90.0000 -180.0000
See Also
1
1
1
1
5
1
1
5
1
1
1
1
1
1
1
ltln2val, setpostn
12-301
ind2rgb8
Purpose
Syntax
RGB = ind2rgb8(X,cmap)
Description
colormap.
Example
See Also
12-302
ingeoquad
Purpose
Syntax
Description
of degrees.
Example
Korean Peninsula:
korea = load('korea');
[latlim, lonlim] = limitm(korea.map, korea.refvec);
figure('Color','white')
worldmap([20 50],[90 150])
geoshow(korea.map, korea.refvec, 'DisplayType', 'texturemap');
colormap(demcmap(korea.map))
2 Generate a track that crosses the DEM:
12-303
ingeoquad
See Also
12-304
inpolygon, intersectgeoquad
intersectgeoquad
Purpose
Syntax
Description
All input and output angles are in units of degrees. The intersection
results are given in the output arrays latlim and lonlim. Given an
arbitrary pair of input quadrangles, there are three possible results:
1 The quadrangles fail to intersect. In this case, both latlim and
(like latlim1 and latlim2) is a two-element vector that has the form
[southern-limit northern-limit], where southern-limit and
northern-limit represent scalar values. lonlim (like lonlim1 and
lonlim2), is a two-element vector that has the form [western-limit
eastern-limit], with a pair of scalar limits.
3 The intersection consists of a pair of quadrangles. This can happen
when longitudes wrap around such that the eastern end of one
quadrangle overlaps the western end of the other and vice versa. For
example, if lonlim1 = [-90 90] and lonlim2 = [45 -45], there
are two intervals of overlap: [-90 -45] and [45 90]. These limits
are returned in lonlim in separate rows, forming a 2-by-2 array.
In our example (assuming that the latitude limits overlap), lonlim
would equal [-90 -45; 45 90]. It still has the form [western-limit
eastern-limit], but western-limit and eastern-limit are 2-by-1
rather than scalar. The two output quadrangles have the same
latitude limits, but these are replicated so that latlim is also 2-by-2.
12-305
intersectgeoquad
Remarks
12-306
intersectgeoquad
Examples
Example 1
Nonintersecting quadrangles:
[latlim, lonlim] = intersectgeoquad( ...
[-40 -60], [-180 180], [40 60], [-180 180])
latlim =
[]
lonlim =
[]
Example 2
Intersection is a single quadrangle:
[latlim, lonlim] = intersectgeoquad( ...
[-40 60], [-120 45], [-60 40], [160 -75])
latlim =
-40
40
lonlim =
-120
-75
Example 3
Intersection is a pair of quadrangles:
[latlim, lonlim] = intersectgeoquad( ...
[-30 90],[-10 -170],[-90 30],[170 10])
latlim =
-30
-30
30
30
12-307
intersectgeoquad
lonlim =
-10
10
170 -170
Example 4
Inputs and output fully encircle the planet:
[latlim, lonlim] = intersectgeoquad( ...
[-30 90],[-180 180],[-90 30],[0 360])
latlim =
-30
30
lonlim =
-180
180
Example 5
Find and map the intersection of the bounding boxes of adjoining U.S.
states:
usamap({'Minnesota','Wisconsin'})
S = shaperead('usastatehi','UseGeoCoords',true,'Selector',...
{@(name) any(strcmp(name,{'Minnesota','Wisconsin'})), 'Name'});
geoshow(S, 'FaceColor', 'y')
textm([S.LabelLat], [S.LabelLon], {S.Name},...
'HorizontalAlignment', 'center')
latlimMN = S(1).BoundingBox(:,2)'
latlimMN =
43.4995
49.3844
lonlimMN = S(1).BoundingBox(:,1)'
lonlimMN =
-97.2385
12-308
-89.5612
intersectgeoquad
latlimWI = S(2).BoundingBox(:,2)'
latlimWI =
42.4918
47.0773
lonlimWI = S(2).BoundingBox(:,1)'
lonlimWI =
-92.8892
-86.8059
47.0773
lonlim =
-92.8892
-89.5612
12-309
intersectgeoquad
See Also
12-310
ingeoquad, outlinegeoquad
inputm
Purpose
Syntax
[lat,
[lat,
[lat,
[lat,
MAT =
Description
lon] = inputm
lon] = inputm(n)
lon] = inputm(n,h)
lon, button] = inputm(n)
imputm(...)
Remarks
inputm works much like the standard MATLAB ginput, except that
the returned values are latitudes and longitudes extracted from the
projection, rather than axes x-y coordinates. If you click outside of the
projection bounds (beyond the map frame in the corners of a Robinson
projection, for example), no coordinates are returned for that location.
inputm cannot be used with a 3-D display, including those created using
globe.
See Also
12-311
interpm
Purpose
Syntax
[latout,lonout] = interpm(lat,lon,maxdiff)
[latout,lonout] = interpm(lat,lon,maxdiff,method)
[latout,lonout] = interpm(lat,lon,maxdiff,method,units)
Description
Examples
See Also
12-312
7.0000
8.0000
8.5000
9.0000
10.0000
11.0000
intrplat, intrplon
intrplat
Purpose
Syntax
newlat = intrplat(long,lat,newlong)
newlat = intrplat(long,lat,newlong,method)
newlat = intrplat(long,lat,newlong,method,units)
Description
Examples
12-313
intrplat
newlat = intrplat(longs,lats,45,'rh')
newlat =
35.6213
newlat = intrplat(longs,lats,45,'gc')
newlat =
37.1991
Remarks
See Also
interpm, intrplon
12-314
intrplon
Purpose
Syntax
newlon = intrplon(lat,lon,newlat)
newlon = intrplon(lat,lon,newlat,method)
newlon = intrplon(lat,lon,newlat,method,units)
Description
Examples
12-315
intrplon
newlon =
33.6515
newlon = intrplon(lat,long,45,'gc')
newlon =
32.0526
Remarks
See Also
interpm, intrplat
12-316
ismap
Purpose
Syntax
mflag = ismap
mflag = ismap(hndl)
[mflag,msg] = ismap(hndl)
Description
otherwise.
mflag = ismap(hndl) specifies the handle of the axes to be tested.
[mflag,msg] = ismap(hndl) returns a string message if the axes is
See Also
gcm, ismapped
12-317
ismapped
Purpose
Syntax
mflag = ismapped
mflag = ismapped(hndl)
[mflag,msg] = ismapped(hndl)
Description
See Also
12-318
gcm, ismap
ispolycw
Purpose
Syntax
tf = ispolycw(x, y)
Description
Class
Support
Example
Orientation of a square:
x = [0 1 1 0 0];
y = [0 0 1 1 0];
ispolycw(x, y)
ispolycw(fliplr(x), fliplr(y))
See Also
% Returns 0
% Returns 1
12-319
isShapeMultipart
Purpose
Syntax
tf = isShapeMultipart(xdata, ydata)
Description
Examples
12-320
isShapeMultipart
See Also
polysplit
12-321
Purpose
Syntax
deg
deg
deg
deg
deg
deg
deg
deg
deg
Description
=
=
=
=
=
=
=
=
=
km2deg(km)
nm2deg(nm)
sm2deg(sm)
km2deg(km,radius)
nm2deg(nm,radius)
sm2deg(sm,radius)
km2deg(km,sphere)
nm2deg(nm,sphere)
sm2deg(sm,sphere)
measured along a great circle on a sphere with a radius of 6371 km, the
mean radius of the Earth.
deg = nm2deg(nm) converts distances from nautical miles to degrees
as measured along a great circle on a sphere with a radius of 6371 km
(3440.065 nm), the mean radius of the Earth.
deg = sm2deg(sm) converts distances from statute miles to degrees as
measured along a great circle on a sphere with a radius of 6371 km
(3958.748 sm), the mean radius of the Earth.
deg = km2deg(km,radius) converts distances from kilometers to
degrees as measured along a great circle on a sphere having the
specified radius. radius must be in units of kilometers.
deg = nm2deg(nm,radius) and deg = sm2deg(sm,radius) work
identically, except that both the input distance and radius must be in
nautical miles and statute miles, respectively.
deg = km2deg(km,sphere) converts distances from kilometers to
degrees, as measured along a great circle on a sphere approximating an
object in the Solar System. sphere may be one of the following strings:
'sun', 'moon', 'mercury', 'venus', 'earth', 'mars', 'jupiter',
'saturn', 'uranus', 'neptune', or 'pluto', and is case-insensitive.
12-322
identically, except that the input units are nautical miles and statute
miles, respectively.
Examples
Two cities are 340 km apart. How many degrees of arc is that? How
many degrees would it be if the cities were on Mars?
deg = km2deg(340)
deg =
3.0577
deg = km2deg(340,'mars')
deg =
5.7465
See Also
12-323
Purpose
Syntax
rad
rad
rad
rad
rad
rad
rad
rad
rad
Description
=
=
=
=
=
=
=
=
=
km2rad(km)
nm2rad(nm)
sm2rad(sm)
km2rad(km,radius)
nm2rad(nm,radius)
sm2rad(sm,radius)
km2rad(km,sphere)
nm2rad(nm,sphere)
sm2rad(sm,sphere)
that the input units are nautical miles and statute miles, respectively.
rad = km2rad(km,radius) converts distances from kilometers to
radians as measured along a great circle on a sphere having the
specified radius. radius must be in units of kilometers.
rad = nm2rad(nm,radius) and rad = sm2rad(sm,radius) work
identically, except that both the input distance and radius must be in
nautical miles and statute miles, respectively.
rad = km2rad(km,sphere) converts distances from kilometers to
radians , as measured along a great circle on a sphere approximating an
object in the Solar System. sphere may be one of the following strings:
'sun', 'moon', 'mercury', 'venus', 'earth', 'mars', 'jupiter',
'saturn', 'uranus', 'neptune', or 'pluto', and is case-insensitive.
rad = nm2rad(nm,sphere) and rad = sm2rad(sm,sphere) work
identically, except that the input units must be nautical miles and
statute miles, respectively.
12-324
Examples
How many radians does 1,000 km span on the Earth and on the Moon?
rad = km2rad(1000)
rad =
0.1570
rad = km2rad(1000,'moon')
rad =
0.5754
See Also
12-325
Purpose
Syntax
nm
sm
km
sm
km
nm
Description
=
=
=
=
=
=
km2nm(km)
km2sm(km)
nm2km(nm)
nm2sm(nm)
sm2km(sm)
sm2nm(sm)
statute miles.
km = nm2km(nm) converts distances from nautical miles to kilometers.
sm = nm2sm(nm) works identically, except that the output units are
statute miles.
km = sm2km(sm) converts distances from statute miles to kilometers.
nm = sm2nm(sm) works identically, except that the output units are
nautical miles.
Examples
See Also
12-326
kmlwrite
Purpose
Syntax
Description
12-327
kmlwrite
string, the name is applied to all objects. If the value is a cell array,
it must match in size to lat and lon, S, or address.
Description A string, cell array of strings, or an attribute spec,
that specifies the contents to be displayed in the features description
tag(s). The description appears in the description balloon when the
user clicks either the feature name in the Google Earth application
Places panel or clicks the placemark icon in the viewer window. If
the value is a string, the description is applied to all objects. If the
value is a cell array, it must match the size of lat and lon, S, or
address. Use a cell array to customize descriptive tags for different
placemarks.
Description elements can be either plain text or marked up with
HTML. When it is plain text, the Google Earth application applies
basic formatting, replacing each newline with <br> and giving
anchor tags to all valid URLs for the World Wide Web. The URL
strings are converted to hyperlinks. This means that you do not
need to surround a URL with <A HREF> tags in order to create a
simple link. Examples of HTML tags recognized by the Google Earth
application are provided on its Web site, http://earth.google.com.
Icon A string or cell array of strings that specifies a custom icon
filename. If the value is a string, the value is applied to all objects. If
the value is a cell array, it must have the same size as lat and lon,
S, or address. If the icon filename is not in the current directory, or
in a directory on the MATLAB path, specify a full or relative path
name. The string can be an Internet URL. The URL must include
the protocol prefix (e.g., http://).
IconScale A positive numeric scalar or array that specifies a
scaling factor for the icon. If the value is a scalar, the value is applied
to all objects. If the value is an array, it must have the same size
as lat and lon, S, or address.
Remarks
12-328
kmlwrite
it, each field name you want to display has two fields, Format and
AttributeLabel.
When you provide geostruct, S, to kmlwrite, then the Description
parameter can be an attribute spec. In this case, the attribute fields of S
are displayed as a table in the description tag of the placemark for each
element of S. (If you specify an attribute spec with lat and lon input
syntax, the attribute spec is ignored.) The attribute spec can control:
Which attributes are included in the table
The name for the attribute
The order in which attributes appear
The formatting of attributes
The easiest way to construct an attribute spec is to call makeattribspec,
and then modify the output to remove attributes or change the Format
field for one or more attributes. The lat and lon fields of S are never
treated as attributes.
For Unix and MAC users, display the KML file with:
cmd = 'googleearth ';
fullfilename = fullfile(pwd, filename);
system([cmd fullfilename])
12-329
kmlwrite
A private intranet server will not suffice, because the Google Maps
server must be able to access the URL that you provide to it. Here is
a template for viewing your KML in a browser window via the Google
Maps mapping service:
GMAPS_URL = 'http://maps.google.com/maps?q=';
KML_URL = 'http://<your web server and path to your KML file>';
web([GMAPS KML_URL])
Examples
42.299827;
lon = -71.350273;
description = sprintf('%s<br>%s</br><br>%s</br>', ...
'3 Apple Hill Drive', 'Natick, MA. 01760', ...
'http://www.mathworks.com');
name = 'The MathWorks, Inc.';
filename = 'The_MathWorks.kml';
kmlwrite(filename, lat, lon, ...
'Description', description, 'Name', name, 'Icon', ...
'http://www.mathworks.com/products/product_listing/images/ml_icon.gif');
12-330
kmlwrite
12-331
kmlwrite
y = surveyFeetPerMeter * S(k).Y;
[S(k).Lat, S(k).Lon] = projinv(proj, x, y);
end
filename = 'Boston_Placenames.kml';
kmlwrite(filename, S, 'Name', {S.NAME});
If you have the Google Earth application installed, you can view the file
on Microsoft Windows as follows:
winopen(filename)
12-332
kmlwrite
For a different view of this location and placename data, see Tour
Boston with the Map Viewer on page 1-9.
See Also
12-333
latlon2pix
Purpose
Syntax
Description
Example
% Find the pixel coordinates of the upper left and lower right
% outer corners of a 2-by-2 degree gridded data set.
R = makerefmat(1, 89, 2, 2);
[UL_row, UL_col] = latlon2pix(R,
90, 0)
% Upper left
% Lower right
% Lower left
% Note that the in both the 2nd case and 3rd case we get a column
% value of 0.5, because the left and right edges are on the same
% meridian and (-90, 360) is the same point as (-90, 0).
See Also
12-334
lcolorbar
Purpose
Syntax
lcolorbar(labels)
lcolorbar(labels,'property',value,...)
hcb = lcolorbar(...)
Description
controls whether the colorbar labels are centered on the color bands or
the color breaks. Valid values for ColorAlignment are 'center' and
'ends'.
Other valid property-value pairs are any properties and values that can
be applied to the title and labels of the colorbar axes.
hcb = lcolorbar(...) returns a handle to the colorbar axes.
Example
See Also
figure; colormap(jet(5))
labels = {'apples','oranges','grapes','peachs','melons'};
lcolorbar(labels,'fontweight','bold');
contourcmap, colormapeditor (MATLAB function)
12-335
legs
Purpose
Syntax
[course,dist] = legs(lat,lon)
[course,dist] = legs(lat,lon,method)
[course,dist] = legs(pts) and [course,dist] = legs(pts,
method)
mat = legs(lat,...)
Description
matrix, mat.
This is a navigation function. All angles are in degrees, and all distances
are in nautical miles. Track legs are the courses and distances traveled
between navigational waypoints.
Examples
12-336
legs
course =
268.6365
251.2724
dist =
1.0e+003 *
0.7569
1.4960
Upon takeoff, the plane should proceed on a heading of about 269 for
756 nautical miles, then alter course to 251 for another 1495 miles.
How much farther is it traveling by not following a great circle path
between waypoints? Using rhumb lines, it is traveling
totalrh = sum(dist)
totalrh =
2.2530e+003
The great circle path is less than one-half of one percent shorter.
See Also
12-337
lightm
Purpose
Syntax
h = lightm(lat,lon)
h = lightm(lat,lon,PropertyName,PropertyValue,...)
h = lightm(lat,lon,alt)
Description
Examples
12-338
load topo
axesm globe; view(120,30)
meshm(topo,topolegend); demcmap(topo)
lightm(0,90,'color','yellow')
material([.5 .5 1]); lighting phong
lightm
See Also
12-339
limitm
Purpose
Syntax
Description
Examples
12-340
limitm
See Also
makerefmat
12-341
linecirc
Purpose
Syntax
[xout,yout] = linecirc(slope,intercpt,centerx,centery,radius)
Description
[xout,yout] =
linecirc(slope,intercpt,centerx,centery,radius) finds the
See Also
12-342
circcirc
linem
Purpose
Syntax
h
h
h
h
Description
=
=
=
=
linem(lat,lon)
linem(lat,lon,linetype)
linem(lat,lon,PropertyName,PropertyValue,...)
linem(lat,lon,z)
12-343
linem
Examples
See Also
12-344
los2
Purpose
Syntax
vis = los2(Z,R,lat1,lon1,lat2,lon2)
vis = los2(Z,R,lat1,lon1,lat2,lon2,alt1)
vis = los2(Z,R,lat1,lon1,lat2,lon2,alt1,alt2)
vis = los2(Z,R,lat1,lon1,lat2,lon2,alt1,alt2,alt1opt)
vis = los2(Z,R,lat1,lon1,lat2,lon2,alt1,alt2,alt1opt,alt2opt)
vis = los2(Z,R,lat1,lon1,lat2,lon2,alt1,alt2,alt1opt, ...
alt2opt,actualradius)
vis = los2(Z,R,lat1,lon1,lat2,lon2,alt1,alt2,alt1opt, ...
alt2opt,actualradius,effectiveradius)
[vis,visprofile,dist,H,lattrk,lontrk] = los2(...)
los2(...)
Description
data grid, or the first regular data grid found on the current axes.
The grids zdata is used for the profile. The color data is used in the
absence of data in z. The two points are selected by clicking on the map.
The result is displayed in a new figure. Markers indicate visible and
obscured points along the profile. The profile is shown in a Cartesian
coordinate system with the origin at the observers location. The
displayed z coordinate accounts for the elevation of the terrain and
the curvature of the body.
vis = los2(Z,R,lat1,lon1,lat2,lon2) computes the mutual
visibility between pairs of points on a digital elevation map. The
elevations are provided as a regular data grid Z containing elevations in
units of meters. The two points are provided as vectors of latitudes and
longitudes in units of degrees. The resulting logical variable vis is equal
to one when the two points are visible to each other, and zero when the
line of sight is obscured by terrain. If any of the input arguments are
empty, los2 attempts to gather the data from the current axes. With
one or more output arguments, no figures are created and only the data
is returned. R is either a 1-by-3 vector containing elements:
[cells/degree northern_latitude_limit western_longitude_limit]
12-345
los2
at the specified altitude in meters above the surface (on a tower, for
instance). This is equivalent to putting the point on a tower. If omitted,
point 1 is assumed to be on the surface. alt1 may be either a scalar or a
vector with the same length as lat1, lon1, lat2, and lon2.
vis = los2(Z,R,lat1,lon1,lat2,lon2,alt1,alt2) places both
points at a specified altitudes in meters above the surface. alt2 may be
either a scalar or a vector with the same length as lat1, lon1, lat2,
and lon2. If alt2 is omitted, point 2 is assumed to be on the surface.
vis = los2(Z,R,lat1,lon1,lat2,lon2,alt1,alt2,alt1opt)
controls the interpretation of alt1 as either a relative altitude (alt1opt
equals 'AGL', the default) or an absolute altitude (alt1opt equals
'MSL'). If the altitude option is 'AGL', alt1 is interpreted as the
with the specified radius. If omitted, the radius of the earth in meters
is assumed. The altitudes, elevations and the radius should be in the
same units. This calling form is most useful for computations on bodies
other than the earth.
12-346
los2
for propagation of the line of sight. This can account for the curvature
of the signal path due to refraction in the atmosphere. For example,
radio propagation in the atmosphere is commonly treated as straight
line propagation on a sphere with 4/3 the radius of the earth. In that
case the last two arguments would be R_e and 4/3*R_e, where R_e is
the radius of the earth. Use Inf as the effective radius for flat earth
visibility calculations. The altitudes, elevations and radii should be in
the same units.
[vis,visprofile,dist,H,lattrk,lontrk] = los2(...), for scalar
inputs (lat1, lon1, etc.), returns vectors of points along the path
between the two points. visprofile is a logical vector containing
true (logical(1)) where the intermediate points are visible and false
(logical(0)) otherwise. dist is the distance along the path (in meters
or the units of the radius). H contains the terrain profile relative to the
vertical datum along the path. lattrk and lontrk are the latitudes and
longitudes of the points along the path. For vector inputs los2 returns
visprofile, dist, H, lattrk, and lontrk as cell arrays, with one cell
per element of lat1,lon1, etc.
los2(...), with no output arguments, displays the visibility profile
between the two points in a new figure.
Example
Z = 500*peaks(100);
refvec = [1000 0 0];
[lat1, lon1, lat2, lon2] = deal(-0.027, 0.05, -0.093, 0.042);
los2(Z,refvec,lat1,lon1,lat2,lon2,100);
figure;
axesm('globe','geoid',almanac('earth','sphere','meters'))
meshm(Z, refvec, size(Z), Z); axis tight
camposm(-10,-10,1e6); camupm(0,0)
demcmap('inc', Z, 1000); shading interp; camlight
[vis,visprofile,dist,h,lattrk,lontrk] = ...
los2(Z,refvec,lat1,lon1,lat2,lon2,100);
plot3m(lattrk([1;end]),lontrk([1; end]),...
12-347
los2
See Also
12-348
viewshed, mapprofile
ltln2val
Purpose
Syntax
Description
elements:
[cells/degree northern_latitude_limit western_longitude_limit]
interpolation.
Examples
12-349
ltln2val
elevations =
313
1660
297
See Also
12-350
findm, imbedm
lv2ecef
Purpose
Syntax
[x,y,z] = lv2ecef(xl,yl,zl,phi0,lambda0,h0,ellipsoid)
Description
[x,y,z] = lv2ecef(xl,yl,zl,phi0,lambda0,h0,ellipsoid)
converts arrays xl, yl, and zl in the local vertical coordinate system
to arrays x, y, and z in the geocentric coordinate system. The origin of
the local vertical system is at geodetic latitude phi0, geodetic longitude
lambda0, and ellipsoidal height h0. The arrays xl, yl, and zl may have
any shape, as long as they are all the same size. They are measured
in the same length units as the semimajor axis. phi0 and lambda0
are scalars measured in radians; h0 is a scalar with the same length
units as the semimajor axis; and ellipsoid is a row vector with the
form [semimajor axis,eccentricity]. The coordinates x, y, and z
also have the same units as the semimajor axis.
Definitions
See Also
12-351
majaxis
Purpose
Syntax
semimajor = majaxis(semiminor,eccentricity)
semimajor = majaxis([semiminor eccentricity])
Description
Examples
See Also
almanac, axes2ecc, minaxis
12-352
makeattribspec
Purpose
Syntax
attribspec = makeattribspec(S)
Description
table that consists of a label for the attribute in the first column and
the string value of the attribute in the second column. You can modify
attribspec, and then pass it to kmlwrite to exert control over which
geostruct attribute fields are written to the HTML table and the format
of the string conversion.
attribspec is a scalar MATLAB structure with two levels. The top
Example
AttributeLabel
Format
12-353
makeattribspec
attribspec = makeattribspec(s)
attribspec =
Year:
Month:
Day:
Hour:
Minute:
Second:
Val_Code:
Validity:
Cause_Code:
Cause:
Eq_Mag:
Country:
Location:
Max_Height:
Iida_Mag:
Intensity:
Num_Deaths:
Desc_Deaths:
[1x1
[1x1
[1x1
[1x1
[1x1
[1x1
[1x1
[1x1
[1x1
[1x1
[1x1
[1x1
[1x1
[1x1
[1x1
[1x1
[1x1
[1x1
struct]
struct]
struct]
struct]
struct]
struct]
struct]
struct]
struct]
struct]
struct]
struct]
struct]
struct]
struct]
struct]
struct]
struct]
12-354
makeattribspec
12-355
makeattribspec
See also
12-356
makedbfspec
Purpose
Syntax
dbfspec = makedbfspec(S)
Description
over which geostruct attribute fields are written to the DBF component
of the shapefile, the field-widths, and the precision used for numerical
values.
dbfspec is a scalar MATLAB structure with two levels. The top level
consists of a field for each attribute in S. Each of these fields, in turn,
Contents
FieldName
FieldType
FieldLength
Example
12-357
makedbfspec
s = shaperead('concord_roads')
s =
609x1 struct array with fields:
Geometry
BoundingBox
X
Y
STREETNAME
RT_NUMBER
CLASS
ADMIN_TYPE
LENGTH
dbfspec = makedbfspec(s)
dbfspec =
STREETNAME:
RT_NUMBER:
CLASS:
ADMIN_TYPE:
LENGTH:
[1x1
[1x1
[1x1
[1x1
[1x1
struct]
struct]
struct]
struct]
struct]
Modify the DBF spec to (a) eliminate the 'ADMIN_TYPE' attribute, (b)
rename the 'STREETNAME' field to 'Street Name', and (c) reduce the
number of decimal places used to store road lengths.
dbfspec = rmfield(dbfspec,'ADMIN_TYPE')
dbfspec =
STREETNAME:
RT_NUMBER:
CLASS:
LENGTH:
[1x1
[1x1
[1x1
[1x1
struct]
struct]
struct]
struct]
12-358
makedbfspec
'RT_NUMBER'
'CLASS'
'LENGTH'
r = shaperead('concord_roads_modified')
r =
609x1 struct array with fields:
Geometry
BoundingBox
X
Y
StreetName
RT_NUMBER
CLASS
LENGTH
s(33).LENGTH
12-359
makedbfspec
ans =
3.492817400000000e+002
r(33).LENGTH
ans =
3.493000000000000e+002
See also
12-360
shapeinfo, shapewrite
makemapped
Purpose
Syntax
makemapped(h)
Description
Example
12-361
makemapped
Remarks
Objects should first be trimmed to the map frame using trimcart. This
avoids problems in taking inverse map projections with out-of-range
data.
See Also
12-362
makerefmat
Purpose
Syntax
Description
12-363
makerefmat
is equivalent to
R = makerefmat(x11, y11, dx, dy)
R = makerefmat(lon11, lat11, dlon, dlat), with longitude
for vector dlat and dlon. Images or data grids aligned with latitude
and longitude might already have referencing vectors. In this case you
can use function refvec2mat to convert to a referencing matrix.
R = makerefmat(param1, val1, param2, val2, ...) uses
12-364
makerefmat
fall along a meridian, and each row must fall along a parallel. Each
parameter name must be specified exactly as shown, including case.
Parameter Name
Data Type
Value
RasterSize
Two-element size
vector [M N]
Two-element row
vector of the form:
[southern_limit,
northern_limit], in
units of degrees.
Lonlim
Two-element row
vector of the form:
[western_limit,
eastern_limit], in
units of degrees.
12-365
makerefmat
Parameter Name
Data Type
Value
ColumnsStartFrom
String
RowsStartFrom
String
Definition
12-366
makerefmat
Examples
12-367
makerefmat
geoid(round(row),round(col))
See Also
Tutorials
How To
12-368
makesymbolspec
Purpose
Syntax
symbolspec = makesymbolspec(geometry,rule1,rule2,...ruleN)
Description
symbolspec = makesymbolspec(geometry,rule1,rule2,...ruleN)
constructs a symbol specification structure (symbolspec) for symbolizing
a (vector) shape layer in the Map Viewer or when using mapshow.
geometry is one of 'Point', 'Line', 'PolyLine', 'Polygon', or
'Patch'. Rules, defined in detail below, specify the graphics properties
for each feature of the layer. A rule can be a default rule that is applied
to all features in the layer or it may limit the symbolization to only
those features that have a particular value for a specified attribute.
Features that do not match any rules are displayed using the default
graphics properties.
To create a rule that applies to all features, a default rule, use the
following syntax:
{'Default',Property1,Value1,Property2,Value2,...
PropertyN,ValueN}
To create a rule that applies only to features that have a particular value
or range of values for a specified attribute, use the following syntax:
{AttributeName,AttributeValue,
Property1,Value1,Property2,Value2,...,PropertyN,ValueN}
AttributeValue and ValueN can each be a two-element vector, [low
high], specifying a range. If AttributeValue is a range, ValueN might
12-369
makesymbolspec
Examples
12-370
makesymbolspec
{'Default','Color','k'});
mapshow(roads,'SymbolSpec',roadColors);
12-371
makesymbolspec
12-372
makesymbolspec
See Also
12-373
map2pix
Purpose
Syntax
[row,col] = map2pix(R,x,y)
p = map2pix(R,x,y)
[...] = map2pix(R,s)
Description
Example
See Also
12-374
mapbbox
Purpose
Syntax
Description
See Also
'RefMatrix'
'Height'
Scalar number
'Width'
Scalar number
12-375
maplist
Purpose
Syntax
list = maplist
[list,defproj] = maplist
Description
projection.
list.Classification defines the projection classification that is used
in the command-line table display.
list.ClassCode defines the character string that is used to label the
classes of projections in the Projection Control Box. The eight class
codes are
Azim Azimuthal
Coni Conic
Cyln Cylindrical
Mazi Modified azimuthal
Pazi Pseudoazimuthal
Pcon Pseudoconic
Pcy Pseudocylindrical
Poly Polyconic
12-376
maplist
When map projections are added to the toolbox, the list structure needs
to be extended. For example, if a new projection is added to the default
list, then a new entry in the list structure would be
list.Name(61)
list.IdString(61)
list.Classification(61)
list.ClassCode(61)
See Also
=
=
=
=
'My Projection'
'newprojection';
'New Projection Type';
'Code';
maps, axesmui
12-377
mapoutline
Purpose
Syntax
Description
'Height'
Scalar number
'Width'
Scalar number
longitude and latitude rather than map coordinates, returns the outline
in geographic coordinates. Longitude must precede latitude in the
output argument list.
outline = mapoutline(...) returns the corner coordinates in a
12-378
mapoutline
Example
12-379
mapoutline
See Also
12-380
mapprofile
Purpose
Syntax
[zi,rng,lat,lon] = mapprofile
[zi,rng,lat,lon] = mapprofile(Z,R,lat,lon)
[zi,rng,lat,lon] = mapprofile(Z,R,lat,lon,rngunits)
[zi,rng,lat,lon] = mapprofile(Z,R,lat,lon,ellipsoid)
[zi,rng,lat,lon] = ...
mapprofile(Z,R,lat,lon,rngunits,
trackmethod,interpmethod)
[zi,rng,lat,lon] = ...
mapprofile(Z,R,lat,lon,ellipsoid,
trackmethod,interpmethod)
Description
12-381
mapprofile
the units of the output ranges along the profile. Valid range units
inputs are any distance string recognized by unitsratio. Surface
distances are computed using the default radius of the grid. If omitted,
'degrees' is assumed.
[zi,rng,lat,lon] = mapprofile(Z,R,lat,lon,ellipsoid) uses the
Examples
Example 1
Create a map axes for the Korean peninsula. Specify an elevation
profile across the sample Korean digital elevation data and plot it,
combined with a coastline and city markers:
load korea
h = worldmap(map, refvec); % The figure has no map content
plat = [ 43 43 41 38];
plon = [116 120 126 128];
mapprofile(map, refvec, plat, plon)
12-382
mapprofile
load coast
plotm(lat, long)
geoshow('worldcities.shp', 'Marker', '.', 'Color', 'red')
When you select more than two waypoints, the automatically generated
figure displays the result in three dimensions. The following example
shows the relative sizes of the mountains in northern China compared
to the depths of the Sea of Japan. The call to mapprofile without input
arguments requires you to interactively pick waypoints on the figure
using the mouse, and press Enter after you select the final point:
axes(h);
meshm(map, refvec, size(map))
demcmap(map)
[z,rng,lat,lon] = mapprofile;
12-383
mapprofile
figure
plot(deg2km(rng),z/1000)
daspect([ 1 1/20 1 ]);
xlabel 'Range (km)'
ylabel 'Elevation (km)'
Naturally, the profile you get depends on the transect locations you pick.
Example 2
You can compute values along a path without reference to an existing
figure by providing a regular data grid and vectors of waypoint
coordinates. Optional arguments allow control over the units of the
range output and interpolation methods between waypoints and data
grid elements.
12-384
mapprofile
Show what land and ocean areas lie under a great circle track from
Frankfurt to Seattle:
cities = shaperead('worldcities.shp', 'UseGeoCoords', true);
Seattle = strmatch('Seattle', {cities(:).Name});
Frankfurt = strmatch('Frankfurt', {cities(:).Name});
lat = [cities(Seattle).Lat cities(Frankfurt).Lat]
lon = [cities(Seattle).Lon cities(Frankfurt).Lon]
load topo
[valp,rngp,latp,lonp] = ...
mapprofile(double(topo),topolegend, ...
lat,lon,'km','gc','nearest');
figure
worldmap([40 80],[-135 20])
land = shaperead('landareas.shp', 'UseGeoCoords', true);
faceColors = makesymbolspec('Polygon',...
{'INDEX', [1 numel(land)], 'FaceColor', ...
polcmap(numel(land))});
geoshow(land,'SymbolSpec',faceColors)
plotm(latp,lonp,'r')
plotm(lat,lon,'ro')
axis off
See Also
ltln2val, los2
12-385
maps
Purpose
Syntax
strmat = maps('namelist')
strmat = maps('idlist')
stdstr = maps(id_string)
Description
Examples
12-386
maps
These are the strings used, for example, when setting the axesm
property MapProjection.
The functions setm and axesm recognize unique abbreviations
(truncations) of these strings. The maps function can be used to convert
such an abbreviation to the standard ID string:
stdstr = maps('merc')
stdstr =
mercator
NAME
ID STRING
Cylindrical
Balthasart Cylindrical
balthsrt
Cylindrical
Behrmann Cylindrical
behrmann
Cylindrical
bsam
Cylindrical
braun
Cylindrical
Cassini Cylindrical
cassini
Cylindrical
Central Cylindrical*
ccylin
Cylindrical
eqacylin
Cylindrical
Equidistant Cylindrical
eqdcylin
Cylindrical
Gall Isographic
giso...
See Also
axesm, setm
12-387
mapshow
Purpose
Syntax
mapshow(x,y)
mapshow(x,y, ..., 'DisplayType', displaytype, ...)
mapshow(x,y,z, ..., 'DisplayType', displaytype, ...)
mapshow(Z,R, ..., 'DisplayType', displaytype,...)
mapshow(x,y,I)
mapshow(x,y,BW)
mapshow(x,y,A,cmap)
mapshow(x,y,RGB)
mapshow(I,R)
mapshow(BW,R)
mapshow(RGB,R)
mapshow(A,cmap,R)
mapshow(s)
mapshow(s,...,'SymbolSpec',symspec, ...)
mapshow(filename)
mapshow(..., param1, val1, param2, val2, ...)
mapshow(ax, ...)
mapshow(..., 'Parent', ax, ...)
h = mapshow(...)
Description
12-388
mapshow
instead, the coordinates are projected using the Plate Carree projection
and a warning is issued. symspec specifies the symbolization rules used
for the vector data through a structure returned by makesymbolspec.
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.
mapshow(filename) displays data from filename, according to the
type of file format. The DisplayType parameter is automatically set
12-389
mapshow
Format
DisplayType
Shapefile
GeoTIFF
'image'
TIFF/JPEG/PNG with a
world file
'image'
SDTS raster
Parameters
12-390
Data Type
Value
vector
mapshow
Data Type
Value
image
'image'
grid
Graphics
Properties
Properties
'line'
'point'
'polygon'
12-391
mapshow
See the MATLAB Graphics documentation for line, patch, image, and
surface properties for complete descriptions of these properties and
their values.
Remarks
You can use mapshow to display vector data in an axesm figure. However,
you should not subsequently change the map projection using setm.
mapshow adds graphics to the current axes (it does not clear it first),
enabling you to create multiple raster and vector map layers. If you
do not want mapshow to draw on top of an existing map, create a new
figure or subplot before calling it.
Examples
Example 1
Overlay Boston roads on an orthophoto. You need to 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, 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)
12-392
mapshow
Example 2
Display Boston roads and change the line style:
roads = shaperead('boston_roads.shp');
figure
mapshow(roads,'LineStyle',':');
12-393
mapshow
Example 3
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);
12-394
mapshow
Example 4
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);
12-395
mapshow
Example 5
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);
12-396
mapshow
Example 6
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');
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')
12-397
mapshow
Example 7
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');
colormap(demcmap(Z))
12-398
mapshow
12-399
mapshow
12-400
mapshow
Example 8
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 texture map.
figure
hold on
h1 = mapshow(Z_W, R_W, 'DisplayType', 'texturemap');
h2 = mapshow(Z_D, R_D, 'DisplayType', 'texturemap');
set([h1, h2],'FaceColor','flat');
12-401
mapshow
12-402
mapshow
See Also
12-403
maptriml
Purpose
Syntax
[lat,lon] = maptriml(lat0,lon0,latlim,lonlim)
Description
the desired latitude and longitude limits have been discarded. These
limits are specified by the two-element vectors latlim and lonlim,
which have the form [south-limit north-limit] and [west-limit
east-limit], respectively.
Examples
NaN
-28
-27
-26
-25
-24
NaN
-18
-17
-16
-15
-14
NaN
Notice that trimmed line segment ends have NaNs inserted at trim
points.
See Also
12-404
maptrimp, maptrims
maptrimp
Purpose
Syntax
[latTrimmed,lonTrimmed] = maptrimp(lat,lon,latlim,lonlim)
Description
[latTrimmed,lonTrimmed] = maptrimp(lat,lon,latlim,lonlim)
trims the polygons in lat and lon to the quadrangle specified by latlim
and lonlim. latlim and lonlim are two-element vectors, defining the
latitude and longitude limits respectively. lat and lon must be vectors
Remarks
Example
12-405
maptrimp
Original Map
See Also
12-406
maptriml, maptrims
maptrims
Purpose
Syntax
[Z_trimmed] = maptrims(Z,R,latlim,lonlim)
[Z_trimmed] = maptrims(Z,R,latlim,lonlim,cellDensity)
[Z_trimmed, R_trimmed] = maptrims(...)
Description
referencing matrix, then the inverse of each element in the first two
rows (containing "deltaLat" and "deltaLon") must be evenly divisible
by cellDensity.
[Z_trimmed, R_trimmed] = maptrims(...) returns a referencing
vector or matrix for the trimmed data grid. If R is a referencing vector,
then R_trimmed is a referencing vector. Likewise, if R is a referencing
matrix, then R_trimmed is a referencing matrix.
Examples
load topo
[subgrid,subrefvec] = maptrims(topo,topolegend,...
12-407
maptrims
-2810
-2913
-3186
-3324
-2802
-2905
-3165
-3273
-2793
-2884
-3122
-3214
166
The upper left corner of the grid might differ slightly from that of the
requested region. maptrims uses the corner coordinates of the first
cell inside the limits.
See Also
12-408
mapview
Purpose
Syntax
mapview
Description
Use the Map Viewer to work with vector, image, and raster data grids in
a map coordinate system: load data, pan and zoom on the map, control
the map scale of your screen display, control the order, visibility, and
symbolization of map layers, annotate your map, and click to learn more
about individual vector features. mapview complements mapshow and
geoshow, which are for constructing maps in ordinary figure windows in
a less interactive, script-oriented way.
mapview (with no arguments) starts a new Map Viewer in an empty
Importing
Data
The Map Viewer opens with no data loaded and an empty map display
window. The first step is to import a data set. Use the options in the
File menu to select data from a file or from the MATLAB workspace:
12-409
mapview
Working
in Map
Coordinates
As you move any of the Map Viewer cursors across the map display
area, the coordinate readout in the lower left corners shows you the
cursor position in map X and Y coordinates.
The Map Viewer requires that all currently viewed data sets possess
the same coordinate system and length units. This is likely to be the
case for data sets that originated from a common source. If it is not the
case, you will need to adjust coordinates before importing data into
the Map Viewer.
If some or all of your data is in geographic coordinates, use projfwd
or mfwdtran to project latitudes and longitudes to your desired map
12-410
mapview
coordinate system before you import it. When starting from a different
projection, you must first unproject to latitude and longitude using
projinv or minvtran, then reproject with projfwd or mfwdtran.
You might also need to adjust the horizontal datum of your data
using, for example, the free GEOTRANS (Geographic Translator)
application from the Geospatial Sciences Division of the U.S. National
Geospatial-Intelligence Agency (NGA). If you simply need a change
of units, multiply by the appropriate conversion factor obtained from
unitsratio.
mapview can also display data in unprojected geographic coordinates, if
you consistently substitute longitude for map X and latitude for map Y.
Geographic coordinates must be consistently expressed in either degrees
or radians (not both at once). When using geographic coordinates, do
not specify the viewers map units (see below); you can only use the Map
Viewers map scale display when working in linear units of length.
Setting
Map Units
and Scale
If you tell the Map Viewer which length unit you are using, it can
calculate an approximate map scale for your onscreen display. Set the
map units with either the drop-down menu at the bottom of the display
or the Set Map Units item in the Tools menu.
The scale computed by the Map Viewer is displayed in the window just
above the map units drop-down. To change your display scale while
keeping the center of the map display fixed, simply edit this text box.
Make sure to format your text in the standard way (1:N, where N is a
positive number such that a distance on the ground is N times the same
distance on your screen, e.g., 1:24000).
The scale is approximate because it depends on the MATLAB estimate
of the size of your screen pixels. It is also approximate if your projection
introduces significant distortion. If your data falls in a fairly small area
and you use a conformal projection (e.g., UTM with all data in a single
zone), the scale will be very consistent across your entire map.
Navigating
Your Map
By default, the Map Viewer sets the limits of your map window to match
the extent of the first data set that you load. You will probably want to
adjust this to see some areas in greater detail.
12-411
mapview
The Map Viewer provides several tools to control the limits of your map
window and the map scale of the data display. Some are familiar from
standard MATLAB figure windows.
Zoom in: Drag a box to zoom in on a specific area or click a point to
zoom in with that point centered in the map display.
Zoom out: Click a point to zoom out with that point centered in
the map display.
Pan tool: Click, hold, and drag to reposition the selected point in the
display window, while holding the map scale fixed. Release when you
are satisfied with new display limits.
Fit to window: Set the map display to enclose all currently loaded
data layers. This is equivalent to selecting Fit to Window in the
View menu.
Back to previous view: Click this button once to return the map
scale and display center to their values prior to the most recent zoom,
pan, or scale change. Click repeatedly to undo earlier changes. This
is equivalent to selecting Previous View in the View menu.
Another way to zoom in or out while keeping the center of the view
fixed at the same map coordinates is to directly edit the map scale box
at the bottom of the screen.
Managing
Map
Layers
Each time you import a set of vectors, an image, or a data grid into the
Map Viewer, the new data is stored in a new map layer. The layers form
an ordered stack. Each layer is listed as an item in the Layers menu,
with its position in the menu indicating its position in the stack.
When you import a new layer, the Map Viewer automatically places it
at the top of the layer stack. To reposition a layer in the stack, select it
in the Layers menu, slide right, and select To Top, To Bottom, Move
Up, or Move Down from the pop-up submenu.
The vector features or raster in a given layer obscure coincident
elements of any underlying layers. To control layers that are obscuring
one another, you can also toggle layer visibility on and off. Use the item
12-412
mapview
Visible in the slide-right menu. Or, simply remove a layer from the
Map Viewer via the Remove item in the slide-right menu. Remember
that even if a layers visibility is on, the layer does not appear if its
contents are located completely outside the current display limits or are
obscured by another layer.
Symbolizing
Vector
Features
When point, line, and polygon layers are loaded, the Map Viewer
initializes their graphics properties as follows:
Geometry
Properties
LineStyle = 'none
Marker = 'x'
MarkerEdgeColor = <randomly generated
value>
MarkerFaceColor = 'none
EdgeColor = [0 0 0] FaceColor =
12-413
mapview
which opens a dialog box. Use the dialog box to select the symbolspec
from your workspace.
Getting
Information
About
Vector
Features
The Datatip tool and the Info tool provide different ways to check the
attributes of vector features that you select graphically. Before using
either tool you must designate one of your vector layers as active. (The
default active layer is the first one that you imported.) Either use the
Active Layer drop-down menu at the bottom of your screen or select
the layer in the Layers menu, slide right, and select Active. Having a
designated active layer ensures that when you click a feature you dont
inadvertently select an overlapping feature from a different layer.
Datatip tool: The Datatip tool displays a feature attribute in a text
label each time you click a vector feature. By default the attribute is
the first one in the layers attribute list. To change which attribute
is used, select the layer in the Layers menu, slide right, and click
Set Layer Attribute. In the dialog that follows, select a different
attribute, or Index. If you choose Index, the Map Viewer displays
the one-based index value corresponding to a given featurebased
on its position in the input file or workspace array. To remove a text
label, right-click it and choose Delete datatip from the context
menu. Or choose Delete all datatips from the context menu or the
Tools menu.
Info tool: The Info tool opens a separate text window each time
you click a vector feature. The window displays all the attribute
names and values for that feature, in contrast to the Datatip tool,
which displays only the value of a single attribute. If you need to
compare two or more features, simply click each one and view the
info windows together. Use its close button to close an info window
when youre done with it, or choose Close All Info Windows from
the Tools menu.
Annotating
Your Map
12-414
Use the text, line, or arrow annotation tools to mark and highlight
points of interest on your map, or select the corresponding items in the
Insert menu. Note that to insert an additional object of the same type,
you must reselect the appropriate tool. In addition, the Insert menu
mapview
allows you to insert axis labels and a title. Use the Select annotations
tool and Edit menu to modify or remove your annotations. The Map
Viewer manages annotations separately from data layers; annotations
always stay on top. Note that annotations cannot be saved as graphic
objects, although you can export maps containing annotations to an
image format as described below.
Creating
and Using
Additional
Views
Use New View on the File menu to create an additional Map Viewer
window linked to an existing window. Consider using an additional
window when you want to see your map at different scales at the same
time (e.g., a detailed view plus an overview), or when you want to
simultaneously see different areas of the map at large scale. You can
create as many additional windows as you need, and close them when
you want. Your mapview session ends when you close the last window.
Options for creating a new viewer window include: Duplicate Current
View, Full Extent, Full Extent of Active Layer, and Selected Area.
Click and drag with the Select area tool to define a selected area.
A new viewer window differs from existing windows mainly in terms
of the visible map extent and scale (it also omits annotations and any
labels you added with the datatip tool). You will see the same layers
in the same order with the same settings (including the active layer).
Updates to layers (insertion/removal, order, visibility, label attribute,
and symbolization) in one viewer window are propagated automatically
to all the windows with which it is linked. Updates to annotations and
datatip labels are not propagated between viewers. If you need two
different layer configurations in different windows, launch a second
mapview from the command line instead of creating an additional
window. The views it contains will not be linked to previous ones.
Exporting
Your Map
The Map Viewer allows you to export all or part of your map for use in
a publication or on a Web page. Use File > Save As Raster Map to
export an image of either the current display extent or an area outlined
with the Select area tool. Select a format (PNG, TIFF, JPEG) from the
drop-down menu in the export dialog. For maps including vector layers,
PNG (Portable Network Graphics) is often the best choice. This format
provides excellent quality, good compression, and is well supported
12-415
mapview
See Also
12-416
mdistort
Purpose
Syntax
mdistort
mdistort off
mdistort(parameter)
mdistort parameter
mdistort(parameter,levels)
mdistort(parameter,levels,gsize)
[h,ht] = mdistort(...)
Description
objects.
12-417
mdistort
Background
projection is encountered.
Examples
Example 1
Note the extreme area distortion of the Mercator projection. This makes
it ill-suited for global displays.
figure
axesm mercator
load coast
framem;plotm(lat, long,'color',.5*[1 1 1])
mdistort area
12-418
mdistort
Example 2
The lines of zero distortion for the Bonne projection follow the central
meridian and the standard parallel.
figure
axesm bonne
load coast
framem;plotm(lat, long,'color',.5*[1 1 1])
mdistort angles
parallelui
12-419
mdistort
Example 3
An equidistant conic projection with properly chosen parallels can map
the conterminous United States with less than 1.5% distortion.
figure
usamap conus
load conus
patchm(uslat, uslon, [1 0.7 0])
plotm(statelat, statelon)
patchm(gtlakelat, gtlakelon, 'cyan')
framem off; gridm off; mlabel off; plabel off
mdistort('parscale', -2:.2:2)
parallelui
12-420
mdistort
Remarks
See Also
12-421
meanm
Purpose
Syntax
[latmean,lonmean] = meanm(lat,lon)
[latmean,lonmean] = meanm(lat,lon,units)
[latmean,lonmean] = meanm(lat,lon,ellipsoid)
Description
Background
Examples
12-422
0.4860
0.8913
0.7621
0.4565
0.0185
0.8214
meanm
lon =
0.4447
0.6154
0.7919
0.9218
0.7382
0.1763
0.4057
0.9355
0.9169
[latmean,lonmean] = meanm(lat,lon,'radians')
latmean =
0.6004
lonmean =
0.6347
See Also
0.7395
0.4448
0.6324
0.7478
12-423
meridianarc
Purpose
Syntax
s = meridianarc(phi1,phi2,ellipsoid)
Description
See Also
meridianfwd
12-424
meridianfwd
Purpose
Syntax
phi2 = meridianfwd(phi1,s,ellipsoid)
Description
See Also
meridianarc
12-425
meshgrat
Purpose
Syntax
Description
then the graticule returned has the default size 50-by-100. (But if
gratsize is omitted, a graticule of the same size as Z is returned.) A
finer graticule uses larger arrays and takes more memory and time
but produces a higher fidelity map.
12-426
meshgrat
Examples
-90.0000
0
90.0000
-90.0000
0
90.0000
-90.0000
0
90.0000
-90.0000
0
90.0000
-36.0000
-36.0000
-36.0000
36.0000
36.0000
36.0000
108.0000
108.0000
108.0000
180.0000
180.0000
180.0000
12-427
meshgrat
These paired coordinates are the graticule vertices, which are projected
according to the requirements of the desired map projection. Then a
surface object like the topo map can be warped to the grid.
See Also
12-428
meshlsrm
Purpose
Syntax
meshlsrm(Z,R)
meshlsrm(Z,R,[azim elev])
meshlsrm(Z,R,[azim elev],cmap)
meshlsrm(Z,R,[azim elev],cmap,clim)
h = meshlsrm(...)
Description
12-429
meshlsrm
Remarks
This function effectively multiplies two colormaps, one with color based
on elevation, the other with a grayscale based on the slope of the
surface, to create a new colormap. This produces an effect similar to
using a light on a surface, but with all of the visible colors actually in the
colormap. Lighting calculations are performed on the unprojected data.
Examples
Create a new colormap using demcmap, with white colors for the sea and
default colors for land. Use this colormap for a lighted shaded relief
map of the world.
load topo
[cmap,clim] = demcmap(topo,[],[1 1 1],[]);
axesm loximuth
meshlsrm(topo,topolegend,[],cmap,clim)
See Also
12-430
meshm
Purpose
Syntax
meshm(Z, R)
meshm(Z, R, gratsize)
meshm(Z, R, gratsize, alt)
meshm(..., param1, val1, param2, val2, ...)
H = meshm(...)
Description
meshm(Z, R) will display the regular data grid Z warped to the default
projection graticule. R is either a 1-by-3 vector containing elements:
[cells/degree northern_latitude_limit western_longitude_limit]
12-431
meshm
of the surface, then the projection of this object can not be altered once
displayed.)
H = meshm(...) returns the handle to the surface drawn.
Example
See Also
12-432
load topo
axesm miller
meshm(topo,topolegend,[90 180])
demcmap(topo)
tightmap
mfwdtran
Purpose
Syntax
[x,y] = mfwdtran(lat,lon)
[x,y,z] = mfwdtran(lat,lon,alt)
[...] = mfwdtran(mstruct,...)
Description
Examples
The following latitude and longitude data for the District of Columbia is
obtained from the usastatelo demo shapefile:
dc = shaperead('usastatelo', 'UseGeoCoords', true,...
'Selector',{@(name) strcmpi(name,'District of Columbia'),...
'Name'});
lat = [dc.Lat]';
lon = [dc.Lon]';
[lat lon]
ans =
38.9000
38.9500
39.0000
38.9000
38.7800
38.8000
38.8700
38.9000
38.9000
-77.0700
-77.1200
-77.0300
-76.9000
-77.0300
-77.0200
-77.0200
-77.0700
-77.0500
12-433
mfwdtran
38.9000
NaN
-77.0700
NaN
Now that the projection parameters have been set, transform the
District of Columbia data into map coordinates using the Mercator
projection:
[x,y] = mfwdtran(mstruct,lat,lon);
[x y]
ans =
-0.0004
-0.0011
0.0001
0.0019
0.0001
0.0003
0.0003
-0.0004
-0.0001
-0.0004
NaN
See Also
12-434
0.0002
0.0010
0.0019
0.0002
-0.0019
-0.0016
-0.0003
0.0002
0.0002
0.0002
NaN
minaxis
Purpose
Syntax
semiminor = minaxis(semimajor,eccentricity)
semiminor = minaxis([semimajor,eccentricity])
Description
The semiminor axis can be determined given both the semimajor axis
and the eccentricity, the two elements of a standard Mapping Toolbox
ellipsoid vector.
Examples
See Also
12-435
minvtran
Purpose
Syntax
[lat,lon] = minvtran(x,y)
[lat,lon,alt] = minvtran(x,y,z)
[...] = minvtran(mstruct,...)
Description
Examples
The following latitude and longitude data for the District of Columbia is
obtained from the usastatelo shapefile:
dc = shaperead('usastatelo', 'UseGeoCoords', true,...
'Selector',{@(name) strcmpi(name,'District of Columbia'),...
'Name'});
lat = [dc.Lat]';
lon = [dc.Lon]';
[lat lon]
ans =
38.9000
12-436
-77.0700
minvtran
38.9500
39.0000
38.9000
38.7800
38.8000
38.8700
38.9000
38.9000
38.9000
NaN
-77.1200
-77.0300
-76.9000
-77.0300
-77.0200
-77.0200
-77.0700
-77.0500
-77.0700
NaN
0.0002
0.0010
0.0019
0.0002
-0.0019
-0.0016
-0.0003
0.0002
0.0002
0.0002
NaN
To transform the projected x-y data back into the unprojected geographic
system, use the minvtran function:
[lat2,lon2] = minvtran(mstruct,x,y);
[lat2 lon2]
ans =
38.9000
-77.0700
12-437
minvtran
38.9500
39.0000
38.9000
38.7800
38.8000
38.8700
38.9000
38.9000
38.9000
NaN
See Also
12-438
-77.1200
-77.0300
-76.9000
-77.0300
-77.0200
-77.0200
-77.0700
-77.0500
-77.0700
NaN
mlabel
Purpose
Syntax
mlabel
mlabel('on')
mlabel('off')
mlabel('reset')
mlabel(parallel)
mlabel(MapAxesPropertyName,PropertyValue,...)
Description
axes.
mlabel('on') sets the visibility of meridian labels to 'on'.
mlabel('off') sets the visibility of meridian labels to 'off'.
mlabel('reset') resets the displayed meridian labels using the
map axes property names and property values to be passed in. For a
complete description of map axes properties, see the axesm reference
page in this guide.
Meridian label handles can be returned in h if desired.
See Also
12-439
mlabelzero22pi
Purpose
Syntax
mlabelzero22pi
Description
Example
12-440
mlabelzero22pi
See Also
mlabel
12-441
n2ecc
Purpose
Syntax
eccentricity = n2ecc(n)
Description
Example
ecc = n2ecc(0.00167922039463)
ecc =
0.08181919104285
See Also
12-442
namem
Purpose
Syntax
objects = namem
objects = namem(handles)
Description
objects = namem returns the object names for all objects on the current
axes. The object name is defined as its tag, if the object Tag property is
supplied. Otherwise, it is the object Type. Duplicate object names are
removed from the output string matrix.
objects = namem(handles) returns the object names for the objects
specified by the input handles.
The names returned are either set at object creation or defined by the
user with the tagm function.
See Also
12-443
nanclip
Purpose
Syntax
dataout = nanclip(datain)
dataout = nanclip(datain,pendowncmd)
Description
Examples
45
23
28
47
56
67
54
97
89
12
dataout = nanclip(datain)
dataout =
45
67
23
54
28
97
NaN
NaN
47
89
12-444
nanclip
56
NaN
See Also
12
NaN
spcread
12-445
nanm
Purpose
Syntax
[Z,refvec] = nanm(latlim,lonlim,scale)
Description
Example
[Z,refvec] = nanm([46,51],[-79,-75],1)
Z =
NaN
NaN
NaN
NaN
NaN
refvec =
1
See Also
12-446
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
51
-79
NaN
NaN
NaN
NaN
NaN
navfix
Purpose
Syntax
[latfix,lonfix]
[latfix,lonfix]
[latfix,lonfix]
[latfix,lonfix]
drlon)
Description
=
=
=
=
navfix(lat,long,az)
navfix(lat,long,range,casetype)
navfix(lat,long,az_range,casetype)
navfix(lat,long,az_range,casetype,drlat,
these points. One bearing is required for each landmark. Each possible
pairing of the n landmarks generates one intersection, so the total
number of resulting intersection points is the combinatorial n choose 2.
The calculation time therefore grows rapidly with n.
[latfix,lonfix] = navfix(lat,long,range,casetype) returns the
12-447
navfix
Background
Remarks
The outputs of this function are matrices providing the locations of the
intersections for all possible pairings of the n entered lines of bearing
and range arcs. These matrices therefore have n-choose-2 rows. In order
to allow for two intersections per combination, these matrices have two
columns. Whenever there are fewer than two intersections for that
combination, one or two NaNs are returned in that row.
When a dead reckoning position is included, these matrices are column
vectors.
Examples
12-448
navfix
14.9591
14.9680
14.9879
lonfix =
-30.1599
-30.2121
-30.1708
NaN
14.9208
NaN
NaN
-29.9352
NaN
Limitations
See Also
12-449
neworig
Purpose
Syntax
[Z,lat,lon] = neworig(Z0,R,origin)
[Z,lat,lon] = neworig(Z0,R,origin,'forward')
[Z,lat,lon] = neworig(Z0,R,origin,'inverse')
Description
In other words, the oblique map origin is not necessarily at (0,0) in the
Greenwich coordinate frame. This allows operations to be performed
on the matrix representing the oblique map. For example, azimuthal
calculations for a point in a data grid become row and column operations
if the data grid is transformed so that the north pole of the oblique map
represents the desired point on the globe. R is either a 1-by-3 vector
containing elements:
[cells/degree northern_latitude_limit western_longitude_limit]
The neworig function transforms a regular data grid into a new matrix
in an altered coordinate system. An analytical use of the new matrix
can be realized in conjunction with the newpole function. If a selected
point is made the north pole of the new system, then when a new matrix
is created with neworig, each row of the new matrix is a constant
12-450
neworig
distance from the selected point, and each column is a constant azimuth
from that point.
Limitations
neworig only supports data grids that cover the entire globe.
Example
This is the topo map transformed to put Sri Lanka at the North Pole:
load topo
origin = newpole(7,80)
origin =
83.0000 -100.0000
0
[Z,lat,lon] = neworig(topo,topolegend,origin);
axesm miller
latlim = [ -90 90];
lonlim = [-180 180];
gratsize = [90 180];
[lat,lon] = meshgrat(latlim,lonlim,gratsize);
surfm(lat,lon,Z)
demcmap(topo)
tightmap
12-451
neworig
See Also
12-452
newpole
Purpose
Syntax
origin = newpole(polelat,polelon)
origin = newpole(polelat,polelon,units)
Description
orientation is the azimuth of the true North Pole from the new origin
point. For the newpole calculation, this orientation is constrained to
be always 0.
origin = newpole(polelat,polelon,units) specifies the units of
the inputs and output, where units is any valid angle units string.
The default is 'degrees'.
Examples
This makes sense: as a point 30 beyond the true North Pole on the
original origins meridian is pulled up to become the pole, the point
originally 30 above the origin is pulled down into the origin spot.
See Also
12-453
northarrow
Purpose
Syntax
northarrow
northarrow('property',value,...)
Description
Examples
Create a map of the South Pole and then add the north arrow in the
upper left of the map.
Antarctica = shaperead('landareas', 'UseGeoCoords', true, ...
'Selector',{@(name) strcmpi(name,{'Antarctica'}), 'Name'});
figure;
worldmap('south pole')
geoshow(Antarctica,'FaceColor',[.9 .9 .9])
northarrow('latitude', -57, 'longitude', 135);
12-454
northarrow
Right-click the north arrow icon to activate the input dialog box.
Increase the size of the north arrow symbol by changing the
'ScaleRatio' property.
12-455
northarrow
Create a map of Texas and add the north arrow in the lower left of
the map.
figure; usamap('texas')
states = shaperead('usastatelo.shp','UseGeoCoords',true);
faceColors = makesymbolspec('Polygon',...
{'INDEX', [1 numel(states)], 'FaceColor', ...
polcmap(numel(states))});
geoshow(states, 'DisplayType', 'polygon', ...
'SymbolSpec', faceColors)
northarrow('latitude',25,'longitude',-105,'linewidth',1.5);
12-456
northarrow
12-457
northarrow
Limitations
You can draw multiple north arrows on the map. However, the
callbacks will only work with the most recently created north arrow.
In addition, since it can be displayed outside the map frame limits, the
north arrow is not converted into a mapped object. Hence, the location
and orientation of the north arrow have to be updated manually if the
map origin or projection changes.
See Also
scaleruler
12-458
npi2pi
Purpose
Syntax
anglout = npi2pi(anglin)
anglout = npi2pi(anglin,units)
anglout = npi2pi(anglin,units,method)
Description
Examples
npi2pi(315)
ans =
-45
npi2pi(181)
ans =
-179
12-459
npi2pi
See Also
12-460
wrapToPi, wrapTo180
onem
Purpose
Syntax
[Z,refvec] = onem(latlim,lonlim,scale)
Description
Examples
[Z,refvec] = onem([46,51],[-79,-75],1)
Z =
1
1
1
1
1
refvec =
1
See Also
1
1
1
1
1
1
1
1
1
1
51
-79
1
1
1
1
1
12-461
org2pol
Purpose
Syntax
pole = org2pol(origin)
pole = org2pol(origin,units)
Description
Examples
Perhaps you want to make (30N,0) the new origin. Where does the
North Pole end up in terms of the original coordinate system?
pole = org2pol([30 0 0])
pole =
60.0000
This makes sense: pull a point 30 down to the origin, and the North
Pole is pulled down 30. A little less obvious example is the following:
12-462
org2pol
See Also
80.0750
40.0000
neworig, putpole
12-463
outlinegeoquad
Purpose
Syntax
Description
Remarks
Special Cases
The insertion of additional vertices is suppressed at the poles (that is,
if latlim(1) == -90 or latlim(2) == 90). If lonlim corresponds to
a quadrangle width of exactly 360 degrees (lonlim == [-180 180],
for example), then it covers a full latitudinal zone and includes two
separate, NaN-separated parts, unless either
latlim(1) == -90 or latlim(2) == 90, so that only one part is
neededa polygon that follows a parallel clockwise around one of
the poles.
12-464
outlinegeoquad
Example
12-465
outlinegeoquad
See Also
12-466
ingeoquad, intersectgeoquad
paperscale
Purpose
Syntax
paperscale(paperdist,punits,surfdist,sunits)
paperscale(paperdist,punits,surfdist,sunits,lat,long)
paperscale(paperdist,punits,surfdist,sunits,lat,long,az)
paperscale(paperdist,punits,surfdist,sunits,lat,long,az,
gunits)
paperscale(paperdist,punits,surfdist,sunits,lat,long,az,gunits,
radius)
paperscale(scale,...)
[paperXdim,paperYdim] = paperscale(...)
Description
also specifies the units in which the geographic position and direction
are given. If omitted, 'degrees is assumed.
paperscale(paperdist,punits,surfdist,sunits,lat,long,az,gunits,
radius) uses the last input to determine the radius of the sphere. If
radius is a string, then it is evaluated as an almanac body to determine
12-467
paperscale
paper dimensions. The dimensions are in the paper units specified. For
the scale calling form, the returned dimensions are in centimeters.
Background
Examples
12.509
set(gca,'pos', [ 0 0 1 1])
[x,y] = paperscale(1,'centimeter',1,'km'); [x y]
ans =
10.195
Limitations
12-468
10.195
paperscale
properties of the map axes, or adding elements to the display that cause
MATLAB to modify the axes autoscaling. To be sure that the scale is
correct, execute paperscale just before printing.
See Also
12-469
patchesm
Purpose
Syntax
patchesm(lat,lon,cdata)
patchesm(lat,lon,z,cdata)
patchesm(...,'PropertyName',PropertyValue,...)
h = patchesm(...)
Description
map axes. The input latitude and longitude data must be in the same
units as specified in the current map axes. The input cdata defines the
patch face color. If the input vectors are NaN clipped, then multiple
patches are drawn each with a single face. Unlike fillm and fill3m,
patchesm will always add the patches to the current map regardless
of the current hold state.
patchesm(lat,lon,z,cdata) projects 3-D planar patches at the
uniform elevation given by scalar z.
patchesm(...,'PropertyName',PropertyValue,...) uses the patch
properties supplied to display the patch. Except for xdata, ydata, and
zdata, all patch properties available through patch are supported by
patchesm.
h = patchesm(...) returns the handles to the patch objects drawn.
Remarks
12-470
patchesm
Examples
load coast
axesm sinusoid; framem
h = patchesm(lat,long,'b');
length(h)
ans =
238
See Also
12-471
patchm
Purpose
Syntax
h
h
h
h
h
Description
h = patchm(lat,lon,cdata) and h =
patchm(lat,lon,cdata,PropertyName,PropertyValue,...) project
=
=
=
=
=
patchm(lat,lon,cdata)
patchm(lat,lon,cdata,PropertyName,PropertyValue,...)
patchm(lat,lon,PropertyName,PropertyValue,...)
patchm(lat,lon,z,cdata)
patchm(lat,lon,z,cdata, PropertyName,PropertyValue,...)
Remarks
12-472
patchm
Examples
load coast
axesm sinusoid; framem
h = patchm(lat,long,'b');
length(h)
ans =
1
See Also
12-473
pcolorm
Purpose
Syntax
pcolorm(lat,lon,Z)
pcolorm(latlim,lonlim,Z)
pcolorm(...,prop1,val1,prop2,val2,...)
h = pcolorm(...)
Description
Remarks
12-474
pcolorm
resolution, of this grid determines the quality of the projection and the
speed of plotting it. There is no hard and fast rule for sufficient graticule
resolution, but in general, cylindrical projections need fewer graticule
points in the longitudinal direction than do complex curve-generating
projections.
Example
See Also
12-475
pix2latlon
Purpose
Syntax
Description
Example
% Find the lat and lon of the upper left and lower right
% outer corners of a 2-by-2 degree gridded data set.
R = makerefmat(1, 89, 2, 2);
[UL_lat, UL_lon] = pix2latlon(R, .5, .5)
UL_lat =
88
UL_lon =
0
[LR_lat, LR_lon] = pix2latlon(R, 90.5, 180.5)
LR_lat =
268
LR_lon =
360
See Also
12-476
pix2map
Purpose
Syntax
[x,y] = pix2map(R,row,col)
s = pix2map(R,row,col)
[...] = pix2map(R,p)
Description
point.
Example
See Also
12-477
pixcenters
Purpose
Syntax
Description
'Height'
Scalar number
'Width'
Scalar number
Remarks
coordinate transformations.
Example
12-478
[Z,R] = arcgridread('MtWashington-ft.grd');
[x,y] = pixcenters(R, size(Z));
pixcenters
See Also
12-479
plabel
Purpose
Syntax
plabel
plabel('on')
plabel('off')
plabel(meridian)
plabel(MapAxesPropertyName,PropertyValue,...)
Description
plabel toggles the visibility of parallel labeling on the current map axes.
plabel('on') sets the visibility of parallel labels to 'on'.
plabel('off') sets the visibility of parallel labels to 'off'.
plabel('reset') resets the displayed parallel labels using the
map axes property names and property values to be passed in. For a
complete description of map axes properties, see the axesm reference
page.
Parallel label handles can be returned in h if desired.
See Also
12-480
plot3m
Purpose
Syntax
h = plot3m(lat,lon,z)
h = plot3m(lat,lon,linetype)
h = plot3m(lat,lon,PropertyName,PropertyValue,...)
Description
The units of z are arbitrary, except when using the globe projection.
In the case of globe, z should have the same units as the radius of the
earth or semimajor axis specified in the 'geoid' (reference ellipsoid)
property of the map axes. This implies that for a reference ellipsoid
vector of [1 0] (a unit sphere), the units of z are earth radii.
h = plot3m(lat,lon,linetype) allows the specification of the line
style, where linetype is any string recognized by the MATLAB line
function.
h = plot3m(lat,lon,PropertyName,PropertyValue,...) allows the
specification of any number of property name/property value pairs for
any properties recognized by the MATLAB line function except for
XData, YData, and ZData.
Remarks
Example
12-481
plot3m
See Also
12-482
plotm
Purpose
Syntax
h
h
h
h
Description
=
=
=
=
plotm(lat,lon)
plotm(lat,lon,linetype)
plotm(lat,lon,PropertyName,PropertyValue,...)
plotm([lat lon],...)
Example
load coast
axesm sinusoid; framem
plotm(lat,long,'g')
12-483
plotm
See Also
12-484
polcmap
Purpose
Syntax
polcmap
polcmap(ncolors)
polcmap(ncolors,maxsat)
polcmap(ncolors,huelimits,saturationlimits,valuelimits)
cmap = polcmap(...)
Description
colors.
polcmap(ncolors,maxsat) controls the maximum saturation of the
colors. Larger maximum saturation values produce brighter, more
saturated colors. If omitted, the default is 0.5.
polcmap(ncolors,huelimits,saturationlimits,valuelimits)
controls the colors. Hue, saturation, and value are randomly selected
values within the limit vectors. These are two-element vectors of the
form [min max]. Valid values range from 0 to 1. As the hue varies from
0 to 1, the resulting color varies from red, through yellow, green, cyan,
blue, and magenta, back to red. When the saturation is 0, the colors are
unsaturated; they are simply shades of gray. When the saturation is 1,
the colors are fully saturated; they contain no white component. As the
value varies from 0 to 1, the brightness increases.
cmap = polcmap(...) returns the colormap without applying it to
the figure.
Remarks
You cannot use polcmap to alter the colors of displayed patches drawn
by geoshow or mapshow. The patches must have been rendered by
displaym. However, you can color patches using polcmap when you call
geoshow or mapshow, as shown below.
Example
Draw a map of Texas and surrounding states. Color the patches with a
symbolspec constructed using polcmap:
12-485
polcmap
figure; usamap('texas')
states = shaperead('usastatelo.shp','UseGeoCoords',true);
faceColors = makesymbolspec('Polygon',...
{'INDEX', [1 numel(states)], 'FaceColor', ...
polcmap(numel(states))});
geoshow(states, 'DisplayType', 'polygon', ...
'SymbolSpec', faceColors)
Note that the colors you obtain for this example can vary from what you
see above because polcmap computes them randomly.
See Also
12-486
demcmap, colormap
poly2ccw
Purpose
Syntax
Description
Example
See also
12-487
poly2cw
Purpose
Syntax
Description
Example
See also
12-488
poly2fv
Purpose
Syntax
[F, V] = poly2fv(x, y)
Description
Example
Display a rectangular region with two holes using a single patch object.
% External contour, rectangle, clockwise ordered.
x1 = [0 0 6 6 0];
y1 = [0 3 3 0 0];
% First hole contour, square, counterclockwise ordered.
x2 = [1 2 2 1 1];
y2 = [1 1 2 2 1];
% Second hole contour, triangle, counterclockwise ordered.
x3 = [4 5 4 4];
y3 = [1 1 2 1];
% Compute face and vertex matrices.
[f, v] = poly2fv({x1, x2, x3}, {y1, y2, y3});
% Display the patch.
patch('Faces', f, 'Vertices', v, 'FaceColor', 'r', ...
'EdgeColor', 'none');
axis off, axis equal
12-489
poly2fv
See also
12-490
polybool
Purpose
Syntax
[x,y] = polybool(flag,x1,y1,x2,y2)
Description
following alternatives:
Region intersection: 'intersection', 'and', '&'
Region union: 'union', 'or', '|', '+', 'plus'
Region subtraction: 'subtraction', 'minus', '-'
Region exclusive or: 'exclusiveor' , 'xor'
The polygon inputs are NaN-delimited vectors, or cell arrays containing
individual polygonal contours. The result is output using the same
format as the input.
polybool assumes that individual contours whose vertices are clockwise
ordered are external contours, and that contours whose vertices are
counterclockwise ordered are internal contours. You can use poly2cw to
convert a polygonal contour to clockwise ordering.
Limitations
Examples
Example 1
Set operations on two overlapping circular regions:
theta = linspace(0, 2*pi, 100);
x1 = cos(theta) - 0.5;
y1 = -sin(theta);
x2 = x1 + 1;
y2 = y1;
12-491
polybool
% face-vertex form.
% to face-vertex form.
[f, v] = poly2fv(xc, yc);
patch('Faces', f, 'Vertices', v, 'FaceColor', 'r', ...
'EdgeColor', 'none')
axis equal, axis off, hold on
plot(x1, y1, x2, y2, 'Color', 'k')
title('Exclusive Or')
subplot(2, 2, 4)
patch(xd, yd, 1, 'FaceColor', 'r')
axis equal, axis off, hold on
plot(x1, y1, x2, y2, 'Color', 'k')
title('Subtraction')
12-492
polybool
Example 2
Set operations on regions with holes
Ax = {[1 1 6 6 1], [2 5 5 2 2], [2 5 5 2 2]};
Ay = {[1 6 6 1 1], [2 2 3 3 2], [4 4 5 5 4]};
subplot(2, 3, 1)
[f, v] = poly2fv(Ax, Ay);
patch('Faces', f, 'Vertices', v, 'FaceColor', 'r', ...
'EdgeColor', 'none')
axis equal, axis off, axis([0 7 0 7]), hold on
for k = 1:numel(Ax), plot(Ax{k}, Ay{k}, 'Color', 'k'), end
title('A')
Bx = {[0 0 7 7 0], [1 3 3 1 1], [4 6 6 4 4]};
By = {[0 7 7 0 0], [1 1 6 6 1], [1 1 6 6 1]};
subplot(2, 3, 4);
[f, v] = poly2fv(Bx, By);
patch('Faces', f, 'Vertices', v, 'FaceColor', 'r', ...
'EdgeColor', 'none')
axis equal, axis off, axis([0 7 0 7]), hold on
for k = 1:numel(Bx), plot(Bx{k}, By{k}, 'Color', 'k'), end
12-493
polybool
title('B')
subplot(2, 3, 2)
[Cx, Cy] = polybool('union', Ax, Ay, Bx, By);
[f, v] = poly2fv(Cx, Cy);
patch('Faces', f, 'Vertices', v, 'FaceColor', 'r', ...
'EdgeColor', 'none')
axis equal, axis off, axis([0 7 0 7]), hold on
for k = 1:numel(Cx), plot(Cx{k}, Cy{k}, 'Color', 'k'), end
title('A \cup B')
subplot(2, 3, 3)
[Dx, Dy] = polybool('intersection', Ax, Ay, Bx, By);
[f, v] = poly2fv(Dx, Dy);
patch('Faces', f, 'Vertices', v, 'FaceColor', 'r', ...
'EdgeColor', 'none')
axis equal, axis off, axis([0 7 0 7]), hold on
for k = 1:numel(Dx), plot(Dx{k}, Dy{k}, 'Color', 'k'), end
title('A \cap B')
subplot(2, 3, 5)
[Ex, Ey] = polybool('subtraction', Ax, Ay, Bx, By);
[f, v] = poly2fv(Ex, Ey);
patch('Faces', f, 'Vertices', v, 'FaceColor', 'r', ...
'EdgeColor', 'none')
axis equal, axis off, axis([0 7 0 7]), hold on
for k = 1:numel(Ex), plot(Ex{k}, Ey{k}, 'Color', 'k'), end
title('A - B')
subplot(2, 3, 6)
[Fx, Fy] = polybool('xor', Ax, Ay, Bx, By);
[f, v] = poly2fv(Fx, Fy);
patch('Faces', f, 'Vertices', v, 'FaceColor', 'r', ...
'EdgeColor', 'none')
axis equal, axis off, axis([0 7 0 7]), hold on
for k = 1:numel(Fx), plot(Fx{k}, Fy{k}, 'Color', 'k'), end
title('XOR(A, B)')
12-494
polybool
See Also
12-495
polycut
Purpose
Syntax
[lat2,long2] = polycut(lat,long)
Description
See Also
12-496
polyjoin
Purpose
Syntax
[lat,lon] = polyjoin(latcells,loncells)
Description
Remarks
Example
cell array format to column vector format. In cell array format, each
element of the cell array is a vector that defines a separate polygon.
See Also
9
8
7
NaN
6
NaN
5
4
3
2
NaN
1
12-497
polymerge
Purpose
Syntax
Description
The inputs lat and lon can be column or row vectors with
NaN-separated parts (and identical NaN locations in each array), or
they can be cell arrays with each part in a separate cell. The form of
the output arrays, latMerged and lonMerged, matches the inputs in
this regard.
[latMerged, lonMerged] = polymerge(lat, lon, tol) combines
line segments whose endpoints are separated by less than the circular
tolerance, tol. tol has the same units as the polygon input.
[latMerged, lonMerged] = polymerge(lat, lon, tol,
outputFormat) allows you to request either the NaN-separated vector
form for the output (set outputFormat to 'vector'), or the cell array
form (set outputFormat to 'cell').
12-498
polymerge
Example
See Also
1
2
3
4
5
6
7
8
9
10
11
12
13
14
NaN
polyjoin, polysplit
12-499
polysplit
Purpose
Syntax
[latcells,loncells] = polysplit(lat,lon)
Description
Example
See Also
12-500
[3x1 double]
[
6]
[5x1 double]
polyxpoly
Purpose
Syntax
[xi,yi] = polyxpoly(x1,y1,x2,y2)
[xi,yi] = polyxpoly(...,'unique')
[xi,yi,ii] = polyxpoly(...)
Description
intersections.
[xi,yi,ii] = polyxpoly(...) also returns a two-column index of line
segment numbers corresponding to the intersection points.
Example
california = shaperead('usastatehi',...
'UseGeoCoords', true,...
'Selector',{@(name) strcmpi(name,'California'), 'Name'});
usamap('california')
geoshow(california, 'FaceColor', 'none')
lat0 = 37; lon0 = -122; rad = 500;
[latc, lonc] = scircle1(lat0, lon0, km2deg(rad));
plotm(lat0, lon0, 'r*')
plotm(latc, lonc, 'r')
[lat, lon] = reducem(california.Lat', california.Lon');
[loni, lati] = polyxpoly(lon, lat, lonc, latc);
plotm(lati, loni, 'bo')
12-501
polyxpoly
See Also
12-502
previewmap
Purpose
Description
The appearance of a map onscreen can differ from the final printed
output. This results from the difference in the size and shape of the
figure window and the area the figure occupies on the printed page.
A map that appears readable on screen might be cluttered when the
printed output is smaller. Likewise, the relative position of multiple
axes can appear different when printed. This function resizes the figure
to the printed size.
Remarks
previewmap changes the size of the current figure to match the printed
output. If the resulting figure size exceeds the screen size, the figure
is enlarged as much as possible.
Examples
12-503
previewmap
Limitations
See Also
12-504
project
Purpose
Syntax
project(h)
project(h,'xy')
project(h,'yx')
Description
Example
12-505
project
project(h)
12-506
project
The line is straight in x-y space, but when converted to a projected map
object, it bends with the projection.
See Also
12-507
projfwd
Purpose
Syntax
Description
For a complete list of GeoTIFF info and map projection structures that
you can use with projfwd, see the reference page for projlist.
Example
Obtain the projection structure for the orthophoto and project the state
boundary vectors to it (Massachusetts State Plane coordinate system,
U.S. Survey Feet):
proj = geotiffinfo('boston.tif');
lat = [S.Lat];
lon = [S.Lon];
[x, y] = projfwd(proj, lat, lon);
12-508
projfwd
Overlay the state boundary and set map limits to show a little more
detail:
hold on
mapshow(gca, x, y,'Color','black','LineWidth',2.0)
set(gca,'XLim', [ 645000, 895000], ...
'YLIm', [2865000, 3040000]);
12-509
projfwd
See Also
12-510
projinv
Purpose
Syntax
Description
Example
12-511
projinv
RGB = imread('boston_ovr.jpg');
R = worldfileread(getworldfilename('boston_ovr.jpg'));
4 Read state boundary vectors for Massachusetts from the usastatehi
limits, and the eastern limit of the state boandary within the image
latitude bounding box:
[lon, lat] = mapoutline(R, size(RGB(:,:,1)));
ltvals = find((S.Lat>=min(lat(:))) & (S.Lat<=max(lat(:))));
setm(gca,'maplonlimit',[min(lon(:)) max(S.Lon(ltvals))], ...
'maplatlimit',[min(lat(:)) max(lat(:))])
tightmap
12-512
projinv
See Also
12-513
projlist
Purpose
Syntax
projlist(listmode)
S = projlist(listmode)
Description
mapprojection Lists the map projection IDs that are available for
use with projfwd and projinv. The output structure contains the
fields
geotiff Lists the GeoTIFF projection IDs that are available for
use with projfwd and projinv. The output structure contains the
fields
all Lists the map and GeoTIFF projection IDs that are available
for use with projfwd and projinv. The output structure contains
the fields
12-514
projlist
Remarks
Examples
See Also
12-515
putpole
Purpose
Syntax
origin = putpole(pole)
origin = putpole(pole,units)
Description
Remarks
Examples
Pull the North Pole down the 0 meridian by 30 to 60N. What is the
resulting origin vector?
origin = putpole([60 0])
origin =
30.0000
12-516
putpole
This makes sense: when the pole slid down 30, the point that was 30
north of the origin slid down to become the origin. Following is a less
obvious transformation:
origin = putpole([60 80 0])
origin =
4.9809
29.6217
See Also
40.0000
29.6217
neworig, org2pol
12-517
quiver3m
Purpose
Syntax
h
h
h
h
h
h
Description
=
=
=
=
=
=
quiver3m(lat,lon,alt,u,v,w)
quiver3m(lat,lon,alt,u,v,w,linespec)
quiver3m(lat,lon,alt,u,v,w,linespec,'filled')
quiver3m(lat,lon,alt,u,v,w,scale)
quiver3m(lat,lon,alt,u,v,w,linespec,scale)
quiver3m(lat,lon,alt,u,v,w,linespec,scale,'filled')
Examples
12-518
Plot 3-D quiver vectors from London (51.5N,0) and New Delhi
(29N,77.5E), both at an altitude of 0. Suppress the automatic scaling.
quiver3m
See Also
quiverm, quiver3
12-519
quiverm
Purpose
Syntax
h
h
h
h
h
Description
=
=
=
=
=
quiverm(lat,lon,u,v)
quiverm(lat,lon,u,v,linespec)
quiverm(lat,lon,u,v,linespec,'filled')
quiverm(lat,lon,u,v,scale)
quiverm(lat,lon,u,v,...linespec,scale,'filled')
Example
12-520
quiverm
load coast
axesm('eqaconic','MapLatLimit',[30 60],'MapLonLimit',[-10 10])
framem; plotm(lat,long)
lat0 = [50 39.7]; lon0 = [-5.4 2.9];
u = [5 5]; v = [3 3];
quiverm(lat0,lon0,u,v,'r')
See Also
quiver3m, quiver
12-521
Purpose
Syntax
km
nm
sm
km
nm
sm
km
nm
sm
Description
=
=
=
=
=
=
=
=
=
rad2km(rad)
rad2nm(rad)
rad2sm(rad)
rad2km(rad,radius)
rad2nm(rad,radius)
rad2sm(rad,radius)
rad2km(rad,sphere)
rad2nm(rad,sphere)
rad2sm(rad,sphere)
measured along a great circle on a sphere with a radius of 6371 km, the
mean radius of the Earth.
nm = rad2nm(rad) and sm = rad2sm(rad) work identically, except
that the output units are nautical miles and statute miles, respectively.
km = rad2km(rad,radius) converts distances from radians to
identically, except that the output units are nautical miles and statute
miles, respectively.
12-522
Examples
See Also
12-523
radtodeg
Purpose
Syntax
angleInDegrees = radtodeg(angleInRadians)
Description
Examples
anglout = radtodeg(pi)
anglout =
180
See Also
12-524
rcurve
Purpose
Syntax
r
r
r
r
r
Description
r = rcurve(ellipsoid,lat) and r =
rcurve('parallel',ellipsoid,lat) return the parallel radius of
curvature at the latitude lat for a given elliptical definition, where
ellipsoid is a two-element ellipsoid vector. This is the radius of the
=
=
=
=
=
rcurve(ellipsoid,lat)
rcurve('parallel',ellipsoid,lat)
rcurve(ellipsoid,lat,units)
rcurve('meridian',ellipsoid,lat,units)
rcurve('transverse',ellipsoid,lat,units)
Examples
12-525
rcurve
45,'degrees')
r =
6.3674e+03
r = rcurve('parallel',almanac('earth','ellipsoid','km'),...
45,'degrees')
r =
4.5024e+03
See Also
12-526
rsphere
readfields
Purpose
Syntax
struc = readfields(fname,fstruc)
struc = readfields(fname,fstruc,recordIDs)
struc = readfields(fname,fstruc,fieldIDs)
struc = readfields(fname,fstruc,recordIDs,mformat)
struc = readfields(fname,fstruc,recordIDs,mformat,fid)
struc = readfields(fname,fstruc,recordIDs,mformat,fid,
'sparse')
Description
file.
struc =
readfields(fname,fstruc,recordIDs,mformat,fid,'sparse')
disables error messages when the number of elements read does not
agree with the stated format of the file. This is useful for formatted files
12-527
readfields
with empty fields. Use fid = [] for files that are not already open.
This option is only compatible with reading selected records.
Background
Examples
12-528
readfields
Limitations
Formatted numbers must stay within the width specified for them.
Files must have a size that is an integer multiple of the computed
record length. This is potentially a problem for formatted files on DOS
platforms that use a carriage return/linefeed line ending everywhere
except the last record. File sizes are not checked when an open file
is provided.
Remarks
fstruc(2).type = 'int16';
fstruc(3).length = 1;
fstruc(3).name = 'float Field';
fstruc(3).type = 'real*4';
The type can also be a fscanf and sscanf-style format string of the form
'%nX', where n is the number of characters within which the formatted
data is found, and X is the conversion character such as 'g' or 'd'. For
formatted fields, the length entry in fstruc is the number of elements,
each of which has the width specified in the type string. Fortran-style
12-529
readfields
See Also
12-530
readfk5
Purpose
Syntax
struc = readfk5(filename)
struc = readfk5(filename,struc)
Description
Background
Remarks
Examples
FK5 = readfk5('FK5.dat');
FK5e = readfk5('FK5_ext.dat');
whos
12-531
readfk5
Name
FK5
FK5e
FK5e(1)
Size
1x1535
1x3117
ans =
FK5:
RAh:
RAm:
RAs:
pmRA:
DEd:
DEm:
DEs:
pmDE:
RAh1950:
RAm1950:
RAs1950:
pmRA1950:
DEd1950:
DEm1950:
DEs1950:
pmDE1950:
EpRA1900:
e_RAs:
e_pmRA:
EpDE1900:
e_DEs:
e_pmDE:
Vmag:
n_Vmag:
SpType:
plx:
RV:
AGK3R:
SRS:
12-532
2003
0
5
1.1940
0.6230
27
40
29.0100
-1.1100
0
2
26.5900
0.6210
27
23
47.4400
-1.1100
51.7200
2
9
46.8200
3.4000
14
6.4700
''
'G5'
[]
12
'38'
''
Bytes
5042752
10226424
Class
struct array
struct array
readfk5
HD: '225292'
DM: 'BD+26 4744'
GC: '48'
References
See references [5] and [6] in the Bibliography located at the end of
this chapter.
See Also
dms2degrees, scatterm
12-533
readmtx
Purpose
Syntax
mtx = readmtx(fname,nrows,ncols,precision)
mtx =
readmtx(fname,nrows,ncols,precision,readrows,readcols)
mtx = readmtx(fname,nrows,ncols,precision,... readrows,
readcols,mformat)
mtx = readmtx(fname,nrows,ncols,precision,... readrows,
readcols,mformat,nheadbytes)
mtx = readmtx(fname,nrows,ncols,precision,... readrows,
readcols,mformat,nheadbytes,nRowHeadBytes)
mtx = readmtx(fname,nrows,ncols,precision,... readrows,
readcols,mformat,nheadbytes,nRowHeadBytes,nRowTrailBytes)
mtx = readmtx(fname,nrows,ncols,precision,... readrows,
readcols,mformat,nheadbytes,nRowHeadBytes,
... nRowTrailBytes,nFileTrailBytes)
mtx = readmtx(fname,nrows,ncols,precision,... readrows,
readcols,mformat,nheadbytes,nRowHeadBytes,
... nRowTrailBytes,nFileTrailBytes,recordlen)
Description
stored in a file. The file contains only a matrix of numbers with the
dimensions nrows by ncols stored with the specified precision.
Recognized precision strings are described below.
mtx =
readmtx(fname,nrows,ncols,precision,readrows,readcols) reads
a subset of the matrix. readrows and readcols specify which rows and
12-534
readmtx
a header that precedes every row of the matrix. The length of the
header is specified in bytes.
mtx = readmtx(fname,nrows,ncols,precision,...
readrows,readcols,mformat,nheadbytes,nRowHeadBytes,nRowTrailBytes)
also skips a trailer that follows every row of the matrix. The
length of the trailer is specified in bytes.
mtx = readmtx(fname,nrows,ncols,precision,...
readrows,readcols,mformat,nheadbytes,nRowHeadBytes,...
nRowTrailBytes,nFileTrailBytes) accounts for the length of data
following the matrix. The sizes of the components of the matrix are
used to compute an expected file size, which is compared to the actual
file size.
mtx = readmtx(fname,nrows,ncols,precision,...
readrows,readcols,mformat,nheadbytes,nRowHeadBytes,...
nRowTrailBytes,nFileTrailBytes,recordlen) overrides the record
Background
12-535
readmtx
Examples
2
12
22
32
42
52
62
72
82
92
3
13
23
33
43
53
63
73
83
93
4
14
24
34
44
54
64
74
84
94
5
15
25
35
45
55
65
75
85
95
6
16
26
36
46
56
66
76
86
96
7
17
27
37
47
57
67
77
87
97
8
18
28
38
48
58
68
78
88
98
9
19
29
39
49
59
69
79
89
99
15
25
35
45
17
27
37
47
19
29
39
49
Limitations
Every row of the matrix must have the same number of elements.
Remarks
12-536
10
20
30
40
50
60
70
80
90
100
readmtx
the form '%nX', where n is the number of characters within which the
formatted data is found, and X is the conversion character such as 'g'
or 'd'. Fortran-style double-precision output such as '0.0D00' can be
read using a precision string such as '%nD', where n is the number
of characters per element. This is an extension to the C-style format
strings accepted by sscanf. Users unfamiliar with C should note that
'%d' is preferred over '%i' for formatted integers. MATLAB syntax
follows C in interpreting '%i' integers with leading zeros as octal.
Formatted files with line endings need to provide the number of trailing
bytes per row, which can be 1 for platforms with carriage returns or
linefeed (Macintosh, UNIX), or 2 for platforms with carriage returns
and linefeeds (DOS).
See Also
12-537
reckon
Purpose
Syntax
[latout,lonout]
[latout,lonout]
[latout,lonout]
[latout,lonout]
[latout,lonout]
Description
=
=
=
=
=
reckon(lat,lon,rng,az)
reckon(lat,lon,rng,az,units)
reckon(lat,lon,rng,az,ellipsoid)
reckon(lat,lon,rng,az,ellipsoid,units)
reckon(track,...)
Examples
12-538
reckon
-12.3699
How far apart are the points above (distance in great circle sense)?
separation = distance('gc',pt1,pt2)
separation =
0.8430
% convert answer to nautical miles
nmsep = deg2nm(separation)
nmsep =
50.6156
See Also
12-539
reducem
Purpose
Syntax
[latout,lonout] = reducem(latin,lonin)
[latout,lonout] = reducem(latin,lonin,tol)
[latout,lonout,cerr] = reducem(...)
[latout,lonout,cerr,tol] = reducem(...)
Description
tolerance. The units of the tolerance are degrees of arc on the surface
of a sphere.
[latout,lonout,cerr] = reducem(...) in addition returns a
measure of the error introduced by the simplification. The output cerr
is the difference in the arc length of the original and reduced data,
normalized by the original length.
[latout,lonout,cerr,tol] = reducem(...) also returns the
Example
12-540
reducem
subplot(1,2,1)
usamap(latlim, lonlim); axis off
geoshow(lat, lon,...
'DisplayType', 'polygon', 'FaceColor', 'blue')
subplot(1,2,2)
usamap(latlim, lonlim); axis off
geoshow(latreduced, lonreduced,...
'DisplayType', 'polygon', 'FaceColor', 'yellow')
Remarks
12-541
reducem
See Also
12-542
interpm
resizem
refmat2vec
Purpose
Syntax
refvec = refmat2vec(R,s)
Description
Example
See Also
12-543
refvec2mat
Purpose
Syntax
R = refvec2mat(refvec,s)
Description
Example
See Also
12-544
removeExtraNanSeparators
Purpose
Syntax
Description
Examples
xin = [NaN NaN 1:3 NaN 4:5 NaN NaN NaN 6:9 NaN NaN];
yin = xin;
[xout, yout] = removeExtraNanSeparators(xin, yin);
xout
xout =
1 2
NaN
5 NaN
NaN
xin = [NaN 1:3 NaN NaN 4:5 NaN NaN NaN 6:9]'
yin = xin;
zin = xin;
[xout, yout, zout] = removeExtraNanSeparators(xin, yin, zin);
xout
xout =
1
2
3
12-545
removeExtraNanSeparators
NaN
4
5
NaN
6
7
8
9
12-546
resizem
Purpose
Syntax
Z = resizem(Z1, scale)
Z = resizem(Z1, [numrows numcols])
[Z, R] = resizem(Z1, scale, R1)
[Z, R] = resizem(Z1, [numrows numcols], R1)
[...] = resizem(..., method)
Description
neighbor interpolation.
Z = resizem(Z1, [numrows numcols]) resizes Z1 to have numrows
rows and numcols columns. numrows and numcols must be positive
whole numbers.
[Z, R] = resizem(Z1, scale, R1) or [Z, R] = resizem(Z1,
[numrows numcols], R1) resizes a regular data grid with a referencing
vector or matrix, R1, and returns a new grid and its referencing vector
or matrix, R. R1 is either a 1-by-3 vector containing elements:
[cells/degree northern_latitude_limit western_longitude_limit]
12-547
resizem
vector, then scale must be a scalar resizing factor; the form [numrows
numcols] is supported only for referencing matrices.
[...] = resizem(..., method) resizes a regular data grid using one
of the following three interpolation methods:
Method
Description
'nearest'
'bilinear'
bilinear interpolation
'bicubic'
bicubic interpolation
Example
12-548
2
4
resizem
neargrid = resizem(Z,2)
neargrid
1
1
3
3
=
1
1
3
3
2
2
4
4
2
2
4
4
bilingrid = resizem(Z,2,'bilinear')
bilingrid =
1.0000
1.6667
2.3333
3.0000
1.3333
2.0000
2.6667
3.3333
1.6667
2.3333
3.0000
3.6667
2.0000
2.6667
3.3333
4.0000
See Also
1.2994
2.3462
2.5306
12-549
restack
Purpose
Syntax
restack(h,position)
Description
Examples
Remarks
See Also
mobjects
12-550
rhxrh
Purpose
Syntax
[newlat,newlong] = rhxrh(lat1,lon1,az1,lat2,lon2,az2)
[newlat,newlon] = rhxrh(lat1,lon1,az1,lat2,lon2,az2,units)
Description
of rhumb lines input in rhumb line notation. For example, the first line
in the pair passes through the point (lat1,lon1) and has a constant
azimuth of az1. When the two rhumb lines are identical or do not
intersect (conditions that are not, in general, apparent by inspection),
two NaNs are returned instead and a warning is displayed. The inputs
must be column vectors.
[newlat,newlon] = rhxrh(lat1,lon1,az1,lat2,lon2,az2,units)
specifies the units used, where units is any valid units string. The
default units are 'degrees'.
For any pair of rhumb lines, there are three possible intersection
conditions: the lines are identical, they intersect once, or they do not
intersect at all (except at the poles, where all nonequatorial rhumb lines
meetthis is not considered an intersection). rhxrh does not allow
multiple rhumb line intersections, although it is possible to construct
cases in which such a condition occurs. See the following discussion
of Limitations.
Rhumb line notation consists of a point on the line and the constant
azimuth of the line.
Examples
12-551
rhxrh
newlong =
-43.4088
Limitations
See Also
12-552
rootlayr
Purpose
Syntax
rootlayr
Description
Examples
Size
1x1
2345x1
2345x1
1x1
1x51
rootlayr
ans
ans =
[1x1 struct]
[1x1 struct]
[1x51 struct]
Bytes
38390
18760
18760
70224
254970
Class
struct
double
double
struct
struct
array
array
array
array
array
'borders'
'nation'
'states'
See Also
mlayers
12-553
rotatem
Purpose
Syntax
[lat1,lon1]
[lat1,lon1]
[lat1,lon1]
[lat1,lon1]
Description
=
=
=
=
rotatem(lat,lon,origin,'forward')
rotatem(lat,lon,origin,'inverse')
rotatem(lat,lon,origin,'forward',units)
rotatem(lat,lon,origin,'forward',units)
latitude and longitude are the coordinates of the point in the original
system, which is the center of the output system. The orientation is the
azimuth from the new origin point to the original North Pole in the new
system. If origin has only two elements, the orientation is assumed to
be 0. This origin vector might be the output of putpole or newpole.
[lat1,lon1] = rotatem(lat,lon,origin,'inverse') transforms
latitude and longitude data (lat and lon) in a coordinate system that
has been transformed by Euler angle rotations specified by origin to
their coordinates (lat1 and lon1) in the coordinate system from which
they were originally transformed. In a sense, this undoes the 'forward'
12-554
rotatem
the new system, then when new vector data is created with rotatem,
the distance of every data point from this new north pole is its new
colatitude (90 minus latitude). The absolute difference in the great
circle azimuths between every pair of points from their new pole is the
same as the difference in their new longitudes.
Examples
What does this mean? For one thing, the colatitude of Rio in this new
system is its distance from New York. Compare the distance between
the original points and the new colatitude:
dist = distance(nylat,nylon,riolat,riolon)
dist =
70.1753
90-riolat1
ans =
70.1753
See Also
12-555
rotatetext
Purpose
Syntax
rotatetext
rotatetext(objects)
rotatetext(objects,'inverse')
Description
text objects.
rotatetext(objects,'inverse') removes the rotation added by an
earlier use of rotatetext. If omitted, 'forward' is assumed.
Examples
12-556
rotatetext
Remarks
See Also
vfwdtran, vinvtran
12-557
roundn
Purpose
Syntax
roundn(x,n)
Description
Examples
See Also
12-558
round
rsphere
Purpose
Syntax
r
r
r
r
r
r
r
r
r
Description
=
=
=
=
=
=
=
=
=
rsphere('biaxial',ellipsoid)
rsphere('biaxial',ellipsoid,method)
rsphere('triaxial',ellipsoid)
rsphere('eqavol',ellipsoid)
rsphere('authalic',ellipsoid)
rsphere('rectifying',ellipsoid)
rsphere('curve',ellipsoid,lat,method,units)
rsphere('euler',lat1,lon1,lat2,lon2,ellipsoid)
rsphere('euler',lat1,lon1,lat2,lon2,ellipsoid,units)
12-559
rsphere
lat can be specified by the valid angle units string units. The default
units are 'degrees', the default averaging method is 'mean', and the
Examples
See Also
12-560
rcurve
satbath
Purpose
Syntax
[latgrat,longrat,z]
[latgrat,longrat,z]
[latgrat,longrat,z]
[latgrat,longrat,z]
gsize)
Description
=
=
=
=
satbath
satbath(scalefactor)
satbath(scalefactor,latlim,lonlim)
satbath(scalefactor,latlim,lonlim,
returns data for the specified region. The returned data extends slightly
beyond the requested area. If omitted, the entire area covered by the
data file is returned. The limits are two-element vectors in units of
degrees, with latlim in the range [-90 90] and lonlim in the range
[-180 180].
[latgrat,longrat,z] =
satbath(scalefactor,latlim,lonlim,gsize) controls the size of
the graticule matrices. gsize is a two-element vector containing the
Background
12-561
satbath
surface. The computational procedure uses the ship track line data to
calibrate the scaling between the observed surface undulations and the
inferred bathymetry. Land elevations are reduced-resolution versions
of GTOPO30 data.
Remarks
Land elevations are given in meters above mean sea level. The data is
stored in a Mercator projection grid. As a result, spatial resolution
varies with latitude. The grid spacing is 2 minutes (about 4 kilometers)
at the equator.
This data is available over the Internet, but subject to copyright. The
data file is binary, and should be transferred with no line-ending
conversion or byte swapping. This function carries out any byte
swapping that might be required. The data requires about 133 MB
uncompressed.
The data and documentation are available over the Internet via http
and anonymous ftp. Download the latest version of file topo_x.2.img,
where x is the version number, and rename it topo_8.w.img for
compatibility with the satbath function.
satbath returns a geolocated data grid rather than a regular data grid
and a referencing vector or matrix. This is because the data is in a
Mercator projection, with columns evenly spaced in longitude, but with
decreasing spacing for rows at higher latitudes. Referencing vectors and
matrices assume that the number of cells per degrees of latitude and
longitude are both constant across a data grid.
Note For details on locating map data for download over the
Internet, see the following documentation at the MathWorks Web site:
http://www.mathworks.com/support/tech-notes/2100/2101.html.
Examples
Read the data for the Falklands Islands (Islas Malvinas) at full
resolution.
[latgrat,longrat,mat] = satbath(1,[-55 -50],[-65 -55]);
12-562
satbath
whos
Name
latgrat
longrat
mat
See Also
Size
247x301
247x301
247x301
Bytes
594776
594776
594776
Class
double array
double array
double array
12-563
scaleruler
Purpose
Syntax
scaleruler
scaleruler on
scaleruler off
scaleruler(property,value,...)
h = scaleruler(...)
Description
scale object.
Background
Examples
Create a map, add a graphic scale with the default settings, and shift
it up a bit. Add a second scale showing nautical miles, and change the
tick marks and direction.
figure
usamap('Texas')
12-564
scaleruler
Remarks
You can reposition graphic scale objects by dragging them with the
mouse. You can also change their positions by modifying the XLoc and
YLoc properties using setm.
Modifying the properties of the graphic scale results in the replacement
of the original object (dragging a scaleruler, however, does not replace
it). For this reason, handles to the graphic scale object will change.
12-565
scaleruler
Object
Properties
Font family name for all graphic scale labels Sets the font for
all displayed graphic scale labels. To display and print properly
FontName must be a font that your system supports.
FontSize
scalar in units specified in FontUnits {9}
12-566
scaleruler
Font size Specifies the font size to use for all displayed graphic
scale labels, in units specified by the FontUnits property. The
default point size is 9.
FontUnits
inches | centimeters | normalized | {points} | pixels
Label text for the graphic scale Contains a string used to label
the graphic scale. The text is displayed centered on the scale. The
label is often used to indicate the scale of the map, for example
1:50,000,000.
LineWidth
scalar {0.5}
Graphic scale line width Sets the line width of the displayed
scale. The value is a scalar representing points, which is 0.5 by
default.
MajorTick
vector
12-567
scaleruler
Graphic scale major tick locations Sets the major tick locations
for the graphic scale. The default values are chosen to give a
reasonably sized scale. You can specify the locations of the tick
marks by providing a vector of locations. These are usually
equally spaced values as generated by start:step:end. The
values are distances in the units of the Units property.
MajorTickLabel
Cell array of strings
Graphic scale major tick labels Sets the text labels associated
with the major tick locations. By default, the labels are identical to
the major tick locations. You can override these by providing a cell
array of strings. There must be as many strings as tick locations.
MajorTickLength
scalar
Length of the major tick lines Controls the length of the major
tick lines. The length is a distance in the units of the Units
property.
MinorTick
vector
Graphic scale minor tick locations Sets the minor tick locations
for the graphic scale. The default values are chosen to give a
reasonably sized scale. You can specify the locations of the tick
marks by providing a vector of locations. These are usually
equally spaced values as generated by start:step:end. The
values are distances in the units of the Units property.
MinorTickLabel
strings
Graphic scale minor tick labels Sets the text labels associated
with the minor tick locations. By default, the label is identical to
the last minor tick location. You can override this by providing
a string label.
12-568
scaleruler
MinorTickLength
scalar
Length of the minor tick lines Controls the length of the minor
tick lines. The length is a distance in the units of the Units
property.
RulerStyle
{ruler} | lines | patches
12-569
scaleruler
XLoc
scalar
12-570
scaleruler
latitude is given in the current angle units of the map axes. The
default location is the center of the displayed map.
Long
scalar
Other Properties
Children
(read-only)
12-571
scaleruler
See Also
12-572
scatterm
Purpose
Syntax
scatterm(lat,lon,s,c)
scatterm(lat,lon)
scatterm(lat,lon,s)
scatterm(...,m)
scatterm(...,'filled')
h = scatterm(...)
Description
When c is a vector the same length as lat and lon, the values in c
are linearly mapped to the colors in the current colormap. When c is
a length(lat)-by-3 matrix, the values in c specify the colors of the
markers as RGB values. c can also be a color string.
scatterm(lat,lon) draws the markers in the default size and color.
scatterm(lat,lon,s) draws the markers with a single color.
scatterm(...,m) uses the marker m instead of 'o'.
scatterm(...,'filled') fills the markers.
h = scatterm(...) returns handles of patches created.
Examples
Plot the seamount MATLAB demo data as symbols with the color
proportional to the height.
load seamount
worldmap([-49 -47.5],[-150 -147.5])
scatterm(y,x,5,z)
scaleruler
set(gca,'Visible','off')
12-573
scatterm
See Also
12-574
stem3m
scircle1
Purpose
Syntax
[lat,lon]
[lat,lon]
[lat,lon]
[lat,lon]
[lat,lon]
[lat,lon]
[lat,lon]
[lat,lon]
Description
=
=
=
=
=
=
=
=
scircle1(lat0,lon0,rad)
scircle1(lat0,lon0,rad,az)
scircle1(lat0,lon0,rad,az,geoid)
scircle1(lat0,lon0,rad,units)
scircle1(lat0,lon0,rad,az,units)
scircle1(lat0,lon0,rad,az,geoid,units)
scircle1(lat0,lon0,rad,az,geoid,units,npts)
scircle1(track,...)
define the small circle arcs computed. The arc azimuths are measured
clockwise from due north. If az is a column vector, then the arc length is
computed from due north. If az is a two-column matrix, then the small
circle arcs are computed starting at the azimuth in the first column
and ending at the azimuth in the second column. If az = [], then a
complete small circle is computed.
[lat,lon] = scircle1(lat0,lon0,rad,az,geoid) computes small
circles on the ellipsoid defined by the input geoid, rather than by
assuming a sphere. The geoid vector is of the form [semimajor axis,
eccentricity]. If the semimajor axis is non-zero, rad is assumed to be
in distance units matching the units of the semimajor axis. However,
if geoid = [], or if the semimajor axis is zero, then rad is interpreted
as an angle and the small circles are computed on a sphere as in the
preceding syntax.
[lat,lon] = scircle1(lat0,lon0,rad,units),
[lat,lon] = scircle1(lat0,lon0,rad,az,units), and
[lat,lon] = scircle1(lat0,lon0,rad,az,geoid,units)
are all valid calling forms, which use the input string units to define
12-575
scircle1
the angle units of the inputs and outputs. If the units string is omitted,
'degrees' is assumed.
[lat,lon] = scircle1(lat0,lon0,rad,az,geoid,units,npts) uses
the scalar input npts to determine the number of points per small circle
computed. The default value of npts is 100.
[lat,lon] = scircle1(track,...) uses the track string to define
either a great circle or rhumb line radius. If track = 'gc', then small
circles are computed. If track = 'rh', then the circles with radii of
constant rhumb line distance are computed. If the track string is
omitted, 'gc' is assumed.
mat = scircle1(...) returns a single output argument where mat =
[lat lon]. This is useful if a single small circle is computed.
Definitions
A small circle is the locus of all points an equal surface distance from a
given center. For true small circles, this distance is always calculated in
a great circle sense; however, the scircle1 function allows a locus to be
calculated using distances in a rhumb line sense as well. An example
of a small circle is all points exactly 100 miles from the Washington
Monument. Parallels on the globe are all small circles. Great circles
are a subset of small circles, specifically those with a radius of 90 or
its angular equivalent, so all meridians on the globe are small circles
as well.
Small circle notation consists of a center point and a radius in units of
angular arc length.
Examples
Create and plot a small circle centered at (0,0) with a radius of 10.
axesm('mercator','MapLatLimit',[30 -30],'MapLonLimit',[-30 30]);
[latc,longc] = scircle1(0,0,10);
plotm(latc,longc,'g')
12-576
scircle1
Mercator projection
See Also
12-577
scircle2
Purpose
Syntax
[lat,lon] = scircle2(lat1,lon1,lat2,lon2)
[lat,lon] = scircle2(lat1,lon1,lat2,lon2,geoid)
[lat,lon] = scircle2(lat1,lon1,lat2,lon2,units)
[lat,lon] = scircle2(lat1,lon1,lat2,lon2,geoid,units)
[lat,lon] = scircle2(lat1,lon1,lat2,lon2,geoid,units,npts)
[lat,lon] = scircle2(track,...)
mat = scircle2(...)
mat = [lat lon]
Description
12-578
scircle2
Definitions
A small circle is the locus of all points an equal surface distance from a
given center. For true small circles, this distance is always calculated in
a great circle sense. However, the scircle2 function allows a locus to
be calculated using distances in a rhumb line sense as well. An example
of a small circle is all points exactly 100 miles from the Washington
Monument.
Examples
Plot the locus of all points the same distance from New Delhi as
Kathmandu:
axesm('mercator','MapLatlimit',[0 40],'MapLonLimit',[60 110]);
load coast
% For reference
plotm(lat,long,'k');
% New Delhi
lat1 = 29; lon1 = 77.5;
% Kathmandu
lat2 = 27.6; lon2 = 85.5;
% Plot the cities
plotm([lat1 lat2],[lon1 lon2],'b*')
[latc,lonc] = scircle2(lat1,lon1,lat2,lon2);
plotm(latc,lonc,'b')
12-579
scircle2
New Delhi
Kathmandu
See Also
12-580
scircleg
Purpose
Syntax
h = scircleg(ncirc)
h = scircleg(ncirc,npts)
h = scircleg(ncirc,linestyle)
h = scircleg(ncirc,PropertyName,PropertyValue,...)
[lat,lon] = scircleg(ncirc,npts,...)
h = scircleg(track,ncirc,...)
Description
This function is used to define small circles for display using mouse
clicks. For each circle, two clicks are required: one to mark the center
of the circle and one to mark any point on the circle itself, thereby
defining the radius.
Background
A small circle is the locus of all points an equal surface distance from a
given center. For true small circles, this distance is always calculated
12-581
scircleg
See Also
12-582
scircle1, scircle2
scxsc
Purpose
Syntax
[newlat,newlon] = scxsc(lat1,lon1,range1,lat2,lon2,range2)
[newlat,newlon]=scxsc(lat1,lon1,range1,lat2,lon2,range2,
units)
Description
[newlat,newlon] = scxsc(lat1,lon1,range1,lat2,lon2,range2)
returns in newlat and newlon the locations of the points of intersection
of two small circles in small circle notation. For example, the first
small circle in a pair would be centered on the point (lat1,lon1) with a
radius of range1 (in angle units). The inputs must be column vectors.
If the circles do not intersect, or are identical, two NaNs are returned
and a warning is displayed. If the two circles are tangent, the single
intersection point is returned twice.
[newlat,newlon]=scxsc(lat1,lon1,range1,lat2,lon2,range2,units)
specifies the angle units used for all inputs, where units is any valid
angle units string. The default units are degrees.
For any pair of small circles, there are four possible intersection
conditions: the circles are identical, they do not intersect, they are
tangent to each other and hence they intersect once, or they intersect
twice.
Small circle notation consists of a center point and a radius in units of
angular arc length.
Examples
12-583
scxsc
Note that in this example, the two small circles cross the date line.
Remarks
Great circles are a subset of small circlesa great circle is just a small
circle with a radius of 90. This provides two methods of notation for
defining great circles. Great circle notation consists of a point on the
circle and an azimuth at that point. Small circle notation for a great
circle consists of a center point and a radius of 90 (or its equivalent
in radians).
See Also
12-584
sdtsdemread
Purpose
Syntax
[Z, R] = sdtsdemread(filename)
Description
corresponding to null data values or fill data values in the cell module.
filename can be the name of the SDTS catalog directory file (*CATD.DDF)
or the name of any of the other files in the data set. filename can
include the directory name; otherwise filename is searched for in the
current directory and the MATLAB path. If any of the files specified in
the catalog directory are missing, sdtsdemread fails.
Remarks
Example
[Z, R] = sdtsdemread('9129CATD.ddf');
mapshow(Z,R,'DisplayType','contour')
See Also
12-585
sdtsinfo
Purpose
Syntax
info = sdtsinfo(filename)
Description
If any of the other files in the data set as specified by the catalog file
is missing, a warning message is returned. Subsequent calls to read
data from the file might also fail.
Field
Descriptions
Title
ProfileID
12-586
ProfileVersion
MapDate
DataCreationDate
HorizontalDatum
sdtsinfo
Example
See Also
MapRefSystem
ZoneNumber
XResolution
YResolution
NumberOfRows
NumberOfCols
HorizontalUnits
VerticalUnits
MinElevation
MaxElevation
info = sdtsinfo('9129CATD.DDF');
sdtsdemread, makerefmat
12-587
sectorg
Purpose
Syntax
sectorg
Description
Remarks
See also
scircleg, trackg
12-588
setltln
Purpose
Syntax
Description
longitudes associated with the input row and column coordinates of the
regular data grid Z. R is either a 1-by-3 vector containing elements:
[cells/degree northern_latitude_limit western_longitude_limit]
Examples
12-589
setltln
64.5000
indxPointOutsideGrid = [] % Empty because the point is valid
See Also
12-590
setm
Purpose
Syntax
setm(h,MapAxesPropertyName,PropertyValue,...)
setm(texthndl,'MapPosition',position)
setm(surfhndl,'Graticule',lat,lon,alt)
setm(surfhndl,'MeshGrat',npts,alt)
Description
setm(h,MapAxesPropertyName,PropertyValue,...), where h is a
valid map axes handle, sets the map axes properties specified in the
input list. The map axes properties must be recognized by axesm.
setm(texthndl,'MapPosition',position) alters the position of
the projected text object specified by its handle to the [latitude
longitude] or the [latitude longitude altitude] specified by the
position vector.
setm(surfhndl,'Graticule',lat,lon,alt) alters the graticule of
Examples
12-591
setm
12-592
setm
See Also
axesm, getm
12-593
setpostn
Purpose
Syntax
Description
Examples
12-594
setpostn
130
col =
105
See Also
12-595
shaderel
Purpose
Syntax
[cindx,cimap,clim]
[cindx,cimap,clim]
[cindx,cimap,clim]
[cindx,cimap,clim]
clim)
Description
=
=
=
=
shaderel(X,Y,Z,cmap)
shaderel(X,Y,Z,cmap,[azim elev])
shaderel(X,Y,Z,cmap,[azim elev],cmapl)
shaderel(X,Y,Z,cmap,[azim elev],cmapl,
Remarks
12-596
This function effectively multiplies two colormaps, one with color based
on elevation, the other with a grayscale based on the slope of the
surface, to create a new color map. This produces an effect similar to
using a light on a surface, but with all of the visible colors actually in the
colormap. Lighting calculations are performed on the unprojected data.
shaderel
Examples
See Also
12-597
shapeinfo
Purpose
Syntax
info = shapeinfo(filename)
Description
the same directory and have valid file extensions. If the main file (with
extension .SHP) is missing, shapeinfo returns an error. If either of the
other files is missing, shapeinfo returns a warning.
Field
Descriptions
ShapeType
BoundingBox
Attributes
NumFeatures
12-598
shapeinfo
See Also
shaperead
12-599
shaperead
Purpose
Syntax
s = shaperead(filename)
[s, a] = shaperead(filename)
[s, a] = shaperead(filename, param1, val1, param2, val2,...)
Description
Remarks
the same directory and have valid file extensions. If the main file (with
12-600
shaperead
Supported
Shape
Types
Output
Structure
Field Contents
Comment
Geometry
'Point',
'Multipoint',
'PolyLine', or
'Polygon'
BoundingBox
X or Lon
Coordinate vector
Y or Lat
Coordinate vector
attr1
Value of first
attribute
Included in output s
if output a is omitted
attr2
Value of second
attribute
Included in output s
if output a is omitted
...
...
...
12-601
shaperead
The names of the attribute fields (listed above as Attr1, Attr2, ...)
are determined at run-time from the xBASE table (with extension
.DBF) and/or optional, user-specified parameters. There can be many
attribute fields, or none at all.
Field Descriptions
Geometry String with one of the following values: 'Point',
'MultiPoint', 'Line', or 'Polygon'. (Note that these match the
standard shapefile types, except that for shape type 'Polyline' the
value of the Geometry field is simply 'Line'.)
BoundingBox Contains a 2-by-2 numerical array specifying the
minimum and maximum feature coordinate values in each dimension
(min([x, y]); max([x, y], where x and y are N-by-1 and contain
the combined coordinates of all parts of the feature). In the absence
of documentation or metadata for the geodata in a shapefile, you can
use this information to decide what kind of coordinate system (map
or geographic) the shapes have.
X and Y / Lon and Lat (Coordinate vector) 1-by-N arrays
of class double. For 'Point' shapes, they are 1-by-1. In the case
of multipart 'Polyline' and 'Polygon' shapes, NaNs are added to
separate the lines or polygon rings. In addition, one terminating
NaN is added to support horizontal concatenation of the coordinate
data from multiple shapes.
Attribute fields Attribute names, types, and values are defined
within a given shapefile. The following four types are supported:
Numeric, Floating, Character, and Date. shaperead skips over
other attribute types. The field names in the output shape structure
are taken directly from the shapefile if they contain no spaces or
other illegal characters and there is no duplication of field names
(e.g., an attribute named 'BoundingBox', 'PointData', etc., or two
attributes with the same names).
Otherwise, the following name mangling is applied: Illegal
characters are replaced by '_'. If the first character in the attribute
name is illegal, a leading 'Z' is added. Numerals are appended if
12-602
shaperead
MATLAB Storage
Numeric
double (scalar)
Float
double (scalar)
Character
char array
Date
char array
Parameter-Value Options
By default, shaperead returns an entry for every nonnull feature and
creates a field for every attribute. Use the first three parameters below
(RecordNumbers, BoundingBox, and Selector) to be selective about
which features to read. Use the fourth parameter (Attributes) to
control the attributes to keep. Use the fifth (UseGeoCoords) to control
the output field names.
Name
Description of
Value
RecordNumbers Integer-valued
2-by-(2, 3, or 4)
array, class double
Purpose
Screen out features whose
record numbers are not listed.
Screen out features whose
bounding boxes fail to
intersect the selected box.
No trimming of features that
partially intersect the box is
performed.
12-603
shaperead
Name
12-604
Description of
Value
Purpose
Selector
Cell array
containing a
function handle
and one or more
attribute names.
Function must
return a logical
scalar.
Attributes
Cell array of
attribute names
UseGeoCoords
Scalar logical
shaperead
Examples
Example 1
Read the entire concord_roads.shp shapefile, including the attributes,
in concord_roads.dbf:
S = shaperead('concord_roads.shp');
% Restrict output based on a bounding box and read only two
% of the feature attributes.
bbox = [2.08 9.11; 2.09 9.12] * 1e5;
S = shaperead('concord_roads','BoundingBox',bbox,...
'Attributes',{'STREETNAME','CLASS'});
% Select the class 4 and higher road segments that are at least 200
% meters in length.
% selector.
S = shaperead('concord_roads.shp','Selector',...
{@(v1,v2) (v1 >= 4) && (v2 >= 200),'CLASS','LENGTH'});
N = hist([S.CLASS],1:7)
hist([S.LENGTH])
12-605
shaperead
Example 2
Read worldwide city names and locations in latitude and longitude.
Note presence of 'Lat' and 'Lon' fields:
S = shaperead('worldcities.shp', 'UseGeoCoords', true)
S =
318x1 struct array with fields:
Geometry
Lon
Lat
Name
Note For details on locating map data for download over the
Internet, see the following documentation at the MathWorks Web site:
http://www.mathworks.com/support/tech-notes/2100/2101.html.
See Also
12-606
shapewrite
Purpose
Syntax
shapewrite(S, filename)
shapewrite(S, filename, 'DbfSpec', dbfspec)
Description
Each attribute field value must be either a real, finite, scalar double
or a character string.
The type of a given attribute must be consistent across all features.
filename must be a character string specifying the output file name
and location. If an extension is included, it must be '.shp' or '.SHP'.
shapewrite creates three output files,
[basename '.shp']
[basename '.shx']
basename '.dbf']
where basename is filename without its extension.
If a given attribute is integer-valued for all features, then it is written to
the [basename '.dbf'] file as an integer. If an attribute is noninteger
for any feature, then it is written as a fixed point decimal value with six
digits to the right of the decimal place.
shapewrite(S, filename, 'DbfSpec', dbfspec) writes a shapefile
in which the content and layout of the DBF file is controlled by a DBF
specification, indicated here by the parameter value dbfspec. A DBF
specification is a scalar MATLAB structure with one field for each
feature attribute to be included in the output shapefile. To include an
attribute in the output, make sure to provide a field in dbfspec with
a field name identical to the attribute name (the corresponding field
12-607
shapewrite
name in S), and assign to that field a scalar structure with the following
four fields:
FieldName The field name to be used in the file
FieldType The field type to be used in the file ('N' or 'C')
FieldLength The field length in the file, in bytes
FieldDecimalCount For numeric fields, the number of digits to
the right of the decimal place
When a DBF spec is provided, a given attribute will be included in the
output file only if it matches the name of a field in the spec.
The easiest way to construct a DBF spec is to call makedbfspec, then
modify the output to remove attributes or change the FieldName,
FieldLength, or FieldDecimalCount for one or more attributes. See
the help for makedbfspec for more details and an example.
Remarks
Example
% 609 features
ans =
Filename:
ShapeType:
BoundingBox:
NumFeatures:
12-608
[3x67 char]
'PolyLine'
[2x2 double]
609
shapewrite
See Also
[3x24 char]
'PolyLine'
[2x2 double]
107
[5x1 struct]
12-609
showaxes
Purpose
Syntax
showaxes
showaxes('on')
showaxes('off')
showaxes('hide')
showaxes('show')
showaxes('reset')
showaxes(color)
showaxes(color)
Description
showaxes toggles the visibility of the axes between the 'on' and 'off'
conditions.
showaxes('on') sets the color of the axes (the XColor and YColor
properties) to black.
showaxes('off') sets the color of the axes (the XColor and YColor
settings.
showaxes(color) sets the color of the axes (the XColor and YColor
See Also
12-610
axesm
showm
Purpose
Syntax
showm
showm(handle)
showm(object)
Description
showm brings up a dialog box for selecting the objects to show (set their
Visible property to 'on').
showm(handle) shows the objects specified by a vector of handles.
showm(object) shows those objects specified by the object string,
which can be any string recognized by the handlem function.
See Also
12-611
sizem
Purpose
Syntax
[r,c] = sizem(latlim,lonlim,scale)
rc = sizem(latlim,lonlim,scale)
[r,c,refvec] = sizem(latlim,lonlim,scale)
Description
Examples
How large a matrix would be required for a map of the world at a scale of
25 matrix cells per degree? (Thats 25x25=625 cells per square degree.)
[r,c] = sizem([90,-90],[-180,180],25)
r =
4500
c =
9000
Bear in mind for memory purposes 9000 x 4500 = 4.05 x 107 entries!
See Also
12-612
smoothlong
Purpose
Syntax
ang = smoothlong(angin)
ang = smoothlong(angin,angleunits)
Description
See Also
unwrapMultipart
12-613
spcread
Purpose
Syntax
mat = spcread
mat = spcread(filename)
mat = spcread(cols)
Description
dialog box.
mat = spcread(filename) specifies the file from which to read by its
name, given as the string filename.
mat = spcread(cols) specifies the number of columns of
space-delimited data in the file with the integer cols. The default value
of cols is 2.
Remarks
See Also
nanclip
12-614
spzerom
Purpose
Syntax
[Z,refvec] = spzerom(latlim,lonlim,scale)
Description
Examples
[Z,refvec] = spzerom([46,51],[-79,-75],1)
Z =
All zero sparse: 5-by-4
refvec =
1
51
-79
See Also
12-615
stdist
Purpose
Syntax
dist
dist
dist
dist
Description
=
=
=
=
stdist(lat,lon)
stdist(lat,lon,units)
stdist(lat,lon,ellipsoid)
stdist(lat,lon,ellipsoid,units,method)
Background
12-616
stdist
Examples
Create latitude and longitude lists using the worldcities data set
and obtain standard distance deviation for group (compare with the
example for stdm):
cities = shaperead('worldcities.shp', 'UseGeoCoords', true);
Paris = strmatch('Paris',{cities(:).Name});
London = strmatch('London',{cities(:).Name});
Rome = strmatch('Rome',{cities(:).Name});
Madrid = strmatch('Madrid',{cities(:).Name});
Berlin = strmatch('Berlin',{cities(:).Name});
Athens = strmatch('Athens',{cities(:).Name});
lat = [cities(Paris).Lat cities(London).Lat...
cities(Rome).Lat cities(Madrid).Lat...
cities(Berlin).Lat cities(Athens).Lat]
lon = [cities(Paris).Lon cities(London).Lon...
cities(Rome).Lon cities(Madrid).Lon...
cities(Berlin).Lon cities(Athens).Lon]
dist =stdist(lat,lon)
lat =
48.8708
lon =
2.4131
dist =
8.1827
See Also
51.5188
41.9260
40.4312
52.4257
38.0164
-0.1300
12.4951
-3.6788
13.0802
23.5183
meanm, stdm
12-617
stdm
Purpose
Syntax
[latdev,londev] = stdm(lat,lon)
[latdev,londev] = stdm(lat,lon,ellipsoid)
[latdev,londev] = stdm(lat,lon,units)
Description
Background
Examples
Create latitude and longitude lists using the worldcities data set
and obtain standard distance deviation for group (compare with the
example for stdist):
12-618
stdm
See Also
51.5188
41.9260
40.4312
52.4257
38.0164
-0.1300
12.4951
-3.6788
13.0802
23.5183
12-619
stem3m
Purpose
Syntax
h = stem3m(lat,lon,z)
h = stem3m(lat,lon,z,LineType)
h = stem3m(lat,lon,z,PropertyName,PropertyValue,...)
Description
of z-values will greatly affect the 3-D look of the plot. Regardless of
AngleUnits, the x and y limits of the map axes are at most - to +
and -/2 to +/2, respectively. This means that for most purposes,
appropriate z values would be on the order of 1 to 3, not 10 to 30. The
axes DataAspectRatio property can be used to adjust the appearance of
the graphic. The handles of the displayed stem lines can be returned
in h.
h = stem3m(lat,lon,z,LineType) allows the style of the stem plots
lines to be specified with any string LineType recognized by the
MATLAB line function.
h = stem3m(lat,lon,z,PropertyName,PropertyValue,...) allows
any property/value pair recognized by the MATLAB line function to
be specified for the stems.
Examples
12-620
load coast
axesm sinusoid; view(3)
h = framem; set(h,'zdata',zeros(size(lat)))
plotm(lat,long)
ptlat = [0 30 30 -50 -78]';
ptlon = [0 30 -70 65 -35]';
ptz = [1 1.5 2 .5 1]';
stem3m(ptlat,ptlon,ptz,'r-')
stem3m
See Also
scatterm
12-621
str2angle
Purpose
Syntax
angles = str2angle(strings)
Description
Example
'123 30''00"W'
d, m, s Separators
'123d30m00sW'
'123-30-00W'
Packed DMS
'1233000W'
Example
12-622
'23-30-00S'
'123d30m00sE'
'1233000W'
str2angle
-23.5
123.5
-123.5
strs = strvcat(strs{:})
strs =
23 30'00"N
23-30-00S
123d30m00sE
1233000W
str2angle(strs)
ans =
23.5
-23.5
123.5
-123.5
See Also
angl2str
12-623
surfacem
Purpose
Syntax
surfacem(lat,lon,Z)
surfacem(latlim,lonlim,Z)
surfacem(lat,lon,Z,alt)
surfacem(...,prop1,val1,prop2,val2,...)
h = surfacem(...)
Description
in the current map axes. The surface lies flat in the horizontal plane
with its CData property set to Z. The vectors or 2-D arrays lat and lon
define the latitude-longitude graticule mesh on which Z is displayed.
For a complete description of the various forms that lat and lon can
take, see surfm.
surfacem(latlim,lonlim,Z) defines the graticule using the latitude
and longitude limits latlim and lonlim. These limits should match the
geographic extent of the data grid Z. The two-element vector latlim
has the form:
[southern_limit northern_limit]
12-624
surfacem
Note Unlike meshm and surfm, surfacem always adds a surface to the
current axes, regardless of hold state.
Example
See Also
12-625
surflm
Purpose
Syntax
surflm(lat,lon,Z)
surflm(latlim,lonlim,Z)
surflm(...,s)
surflm(...,s,k)
h = surflm(...)
Description
The default light source (45 degrees counterclockwise from the current
view) and reflectance constants are the same as in surfl.
surflm(...,s) and surflm(...,s,k) use a light source vector, s, and
a vector of reflectance constants, k. For more information on s and
k, see the help for surfl.
h = surflm(...) returns a handle to the surface object.
Remarks
Example
Project a 3-D shaded surface with lighting on the current map axes.
Note that in the following example, the graticule is the size of topo
(180 x 360) and is rendered in 3-D, so it might take a while. It is also
memory intensive:
figure('Color','white')
load topo
axesm miller
axis off; framem on; gridm on;
[lat,lon] = meshgrat(topo,topolegend);
surflm(lat,lon,topo)
colormap(gray)
coast = load('coast');
plotm(coast.lat,coast.long,max(topo(:)),...
12-626
surflm
'LineWidth',1.5,'Color','yellow')
See Also
surfm
12-627
surflsrm
Purpose
Syntax
surflsrm(lat,long,Z)
surflsrm(lat,long,Z,[azim elev])
surflsrm(lat,long,Z,[azim elev],cmap)
surflsrm(lat,long,Z,[azim elev],cmap,clim)
h = surflsrm(...)
Description
grid with the light coming from the specified azimuth and elevation.
Lighting is applied before the data is projected. Angles are in degrees,
with the azimuth measured clockwise from North, and elevation up
from the zero plane of the surface. By default, the direction of the light
source is east (90 azimuth) at an elevation of 45.
surflsrm(lat,long,Z,[azim elev],cmap) displays the geolocated
Remarks
12-628
This function effectively multiplies two colormaps, one with color based
on elevation, the other with a grayscale based on the slope of the
surface, to create a new colormap. This produces an effect similar to
using a light on a surface, but with all of the visible colors actually in the
colormap. Lighting calculations are performed on the unprojected data.
surflsrm
Examples
Create a new colormap using demcmap with white colors for the sea
and default colors for land. Use this colormap for the lighted shaded
relief map of the Middle East region:
load mapmtx
[cmap,clim] = demcmap(map1,[],[1 1 1],[]);
axesm loximuth
surflsrm(lt1,lg1,map1,[],cmap,clim)
See Also
12-629
surfm
Purpose
Syntax
surfm(lat,lon,Z)
surfm(latlim,lonlim,Z)
surfm(lat,lon,Z,alt)
surfm(...,prop1,val1,prop2,val2,...)
h = surfm(...)
Description
in the current map axes. The surface lies flat in the horizontal plane
with its CData property set to Z. The 2-D arrays or vectors lat and lon
define the latitude-longitude graticule mesh on which Z is displayed.
The sizes and shapes of lat and lon affect their interpretation, and also
determine whether the default FaceColor property of the surface is
'flat' or 'texturemap'. There are three options:
2-D arrays (matrices) having the same size as Z. Lat and lon are
treated as geolocation arrays specifying the precise location of each
vertex. FaceColor is 'flat'.
2-D arrays having a different size than Z. The arrays lat and
lon define a graticule mesh that might be either larger or smaller
than Z. Lat and lon must match each other in size. FaceColor is
'texturemap'.
Vectors having more than two elements. The elements of lat
and lon are repeated to form a graticule mesh with size equal to
numel(lat)-by-numel(lon). FaceColor is 'flat' if the graticule
mesh matches Z in size. Otherwise, FaceColor is 'texturemap'.
surfm clears the current map if the hold state is 'off'.
surfm(latlim,lonlim,Z) defines the graticule using the latitude and
longitude limits latlim and lonlim, which should match the geographic
extent of the data grid Z. Latlim is a two-element vector of the form:
[southern_limit northern_limit]
12-630
surfm
[western_limit eastern_limit]
Remarks
Examples
12-631
surfm
See Also
12-632
symbolm
Purpose
Syntax
symbolm(lat,lon,z,'MarkerType')
symbolm(lat,lon,z,'MarkerType','PropertyName',PropertyValue,
...)
h = symbolm(...)
Description
default marker size, and all other points are plotted with proportionally
larger markers. The MarkerType string is a LineSpec string specifying
a marker and optionally a color.
symbolm(lat,lon,z,'MarkerType','PropertyName',PropertyValue,...)
See also
12-633
tagm
Purpose
Syntax
tagm(hndl,tagstr)
Description
Examples
See Also
12-634
tbase
Purpose
Syntax
[Z,refvec] = tbase(scalefactor)
[Z,refvec] = tbase(scalefactor,latlim,lonlim)
Description
Background
Remarks
Elevations and depths are given in meters above or below mean sea
level.
The tbase.bin file is available on CD-ROM from
NOAA/NGDC
Mail Code E/GC3
325 Broadway
Boulder, CO 80303
USA
Tel: (303) 497-6338
Fax: (303) 497-6513
The data and documentation are available over the Internet via http
and anonymous ftp.
12-635
tbase
Note For details on locating map data for download over the
Internet, see the following documentation at the MathWorks Web site:
http://www.mathworks.com/support/tech-notes/2100/2101.html.
No byte-swapping or line-ending conversion is required.
Examples
Size
Z
refvec
Bytes
216x432
1x3
746496
24
Class
double array
double array
limitm(Z,refvec)
ans =
-90
90
360
See Also
12-636
Size
180x360
Bytes
518400
Class
double array
textm
Purpose
Syntax
textm(lat,lon,string)
textm(lat,lon,z,string)
textm(lat,lon,z,string,PropertyName,PropertyValue,...)
h = textm(...)
Description
Remarks
You may be working with scalar lat and lon data or vector lat and lon
data. If you are in scalar mode and you enter a cell array of strings, you
will get a text object with a multiline string. Also note that vertical
slash characters, rather than producing multiline strings, will yield a
single line string containing vertical slashes. On the other hand, if
lat and lon are nonscalar, then the size of the cell array input must
match their size exactly.
Example
12-637
textm
framem('FEdgeColor','red')
textm(60,90,'hello')
hello
12-638
textm
hello
See Also
12-639
tgrline
Purpose
Syntax
[CL,PR,SR,RR,H,AL,PL] = tgrline(filename)
[CL,PR,SR,RR,H,AL,PL] = tgrline(filename,year)
[CL,PR,SR,RR,H,AL,PL] = tgrline(filename,year,countyname)
Description
TIGER line files in the format from that year. The layout of TIGER/Line
files is updated periodically and filename extensions may change from
year to year. Valid years are 1990, 1992, 1994, 1995, 1999, 2000, 2002,
2003, and 2004.
[CL,PR,SR,RR,H,AL,PL] = tgrline(filename,year,countyname)
uses the string countyname to tag the county data.
12-640
tgrline
Note For details on locating map data for download over the
Internet, see the following documentation at the MathWorks Web site:
http://www.mathworks.com/support/tech-notes/2100/2101.html.
Background
Remarks
This function reads only a subset of the data in the TIGER/Line files.
For example, the function does not return local roads, zip codes, or
census tract numbers.
Data are returned as Mapping Toolbox display structures, which you
can then update to geographic data structures. For information about
display structure format, see Version 1 Display Structures on page
12-142 in the reference page for displaym. The updategeostruct
function performs such conversions.
12-641
tgrline
Examples
See Also
12-642
shaperead, updategeostruct
tightmap
Purpose
Syntax
tightmap
Description
tightmap sets the axis limits to be tight around the map in the current
Examples
Display a map of Africa. Notice the white space between the map frame
and the edge of the axes box.
axes. This eliminates or reduces the white border between the map
frame and the axes box. Use axis auto to undo tightmap.
Limitations
See Also
12-643
timezone
Purpose
Syntax
[zd,zltr,zone] = timezone(long)
[zd,zltr,zone] = timezone(long,units)
Description
Examples
Greenwich Mean Time (GMT) is 1330 plus five hours, or 1830 (6:30
p.m.).
Background
12-644
timezone
directly below the Sun, Local Mean Time (LMT) in that zone is noon.
The zone description is an integer that when added to LMT gives GMT.
For notational convenience, each zone is also given an alphabetical
indicator. The indicator at Greenwich is Z, so GMT is often called
ZULU time.
F G H I K L
MY
X W V U T S R Q P O N Z A B C D E
Note that there are actually 25 time zones, because the zone centered
on the International Date Line (180 E/W) is split into two: +12 Y
and -12 M.
Limitations
National and local governments set their own time zone boundaries for
political or geographic convenience. The timezone function does not
account for statutory deviations from the meridian-based system.
12-645
tissot
Purpose
Syntax
h
h
h
h
h
h
Description
=
=
=
=
=
=
tissot
tissot(spec)
tissot(spec,linestyle)
tissot(linestyle)
tissot(spec,PropertyName,PropertyValue,...)
tissot(linestyle,PropertyName,PropertyValue,...)
current map axes and returns handles for the displayed indicatrices.
h = tissot(spec) allows you to specify plotting parameters of the
Background
12-646
tissot
=
=
=
=
[Radius]
[Latint,Longint]
[Latint,Longint,Radius]
[Latint,Longint,Radius,Points]
points.
Examples
12-647
tissot
12-648
tissot
See Also
mdistort, distortcalc
12-649
toDegrees
Purpose
Syntax
[angle1InDegrees, angle2InDegrees,
...] = toDegrees(fromUnits, angle1, angle2, ...)
Description
See Also
12-650
toRadians
Purpose
Syntax
[angle1InRadians, angle2InRadians,
...] = toRadians(fromUnits, angle1, angle2, ...)
Description
See Also
12-651
track
Purpose
Syntax
[lattrk,lontrk] = track(waypts)
[lattrk,lontrk] = track(waypts,units)
[lattrk,lontrk] = track(lat,lon)
[lattrk,lontrk] = track(lat,lon,ellipsoid)
[lattrk,lontrk] = track(lat,lon,ellipsoid,units,npts)
[lattrk,lontrk] = track(method,lat,...)
trkpts = track(lat,lon...)
Description
12-652
track
Examples
-5.0000
-2.0000
5.0000
11.0000
13.0000
30.0000
32.0000
With a display this clear, the captain gladly approves the plan.
12-653
track
0
45 N
30 N
See Also
12-654
30 E
track1
Purpose
Syntax
[lat,lon] = track1(lat0,lon0,az)
[lat,lon] = track1(lat0,lon0,az,rng)
[lat,lon] = track1(lat0,lon0,az,rng,geoid)
[lat,lon] = track1(lat0,lon0,az,units)
[lat,lon] = track1(lat0,lon0,az,rng,units)
[lat,lon] = track1(lat0,lon0,az,rng,geoid,units)
[lat,lon] = track1(lat0,lon0,az,rng,geoid,units,npts)
[lat,lon] = track1(track,...)
mat = track1(...)
Description
12-655
track1
Definitions
A path along the surface of the Earth connecting two points is a track.
Two types of track lines are of interest geographically, great circles and
rhumb lines. Great circles represent the shortest possible path between
two points. Rhumb lines are paths with constant angular headings.
They are not, in general, the shortest path between two points.
Full great circles bisect the Earth; the ends of the track meet to form
a complete circle. Rhumb lines with true east or west azimuths are
parallels; the ends also meet to form a complete circle. All other rhumb
lines terminate at the poles; their ends do not meet.
Examples
12-656
track1
Rhumb line
track
Great
circle track
See Also
12-657
track2
Purpose
Syntax
[lat,lon] = track2(lat1,lon1,lat2,lon2)
[lat,lon] = track2(lat1,lon1,lat2,lon2,geoid)
[lat,lon] = track2(lat1,lon1,lat2,lon2,units)
[lat,lon] = track2(lat1,lon1,lat2,lon2,geoid,units)
[lat,lon] = track2(lat1,lon1,lat2,lon2,geoid,units,npts)
[lat,lon] = track2(track,...)
mat = track2(...)
Description
12-658
track2
Definitions
A path along the surface of the Earth connecting two points is a track.
Two types of track lines are of interest geographically, great circles and
rhumb lines. Great circles represent the shortest possible path between
two points. Rhumb lines are paths with constant angular headings.
They are not, in general, the shortest path between two points.
Examples
% Set up the axes.
axesm('mercator','MapLatLimit',[30 50],'MapLonLimit',[-40 40])
% Calculate the great circle track.
[lattrkgc,lontrkgc] = track2(40,-35,40,35);
% Calculate the rhumb line track.
[lattrkrh,lontrkrh] = track2('rh',40,-35,40,35);
% Plot both tracks.
plotm(lattrkgc,lontrkgc,'g')
plotm(lattrkrh,lontrkrh,'r')
See Also
12-659
trackg
Purpose
Syntax
h = trackg(ntrax)
h = trackg(ntrax,npts)
h = trackg(ntrax,linestyle)
h = trackg(ntrax,PropertyName,PropertyValue,...)
[lat,lon] = trackg(ntrax,npts,...)
h = trackg(track,ntrax,...)
Description
h = trackg(ntrax) brings forward the current map axes and waits for
the user to make (2 x ntrax) mouse clicks. The output h is a vector of
handles for the ntrax track segments, which are then displayed.
h = trackg(ntrax,npts) specifies the number of plotting points to be
used for each track segment. npts is 100 by default.
h = trackg(ntrax,linestyle) specifies the line style for the displayed
track segments, where linestyle is any line style string recognized by
the standard MATLAB line function.
h = trackg(ntrax,PropertyName,PropertyValue,...) allows
property name/property value pairs to be set, where PropertyName and
PropertyValue are recognized by the line function.
[lat,lon] = trackg(ntrax,npts,...) returns the coordinates of the
plotted points rather than the handles of the track segments. Successive
segments are stored in separate columns of lat and lon.
h = trackg(track,ntrax,...) specifies the logic with which tracks
are calculated. If the string track is 'gc' (the default), a great circle
path is used. If track is 'rh', rhumb line logic is used.
This function is used to define great circles or rhumb lines for display
using mouse clicks. For each track, two clicks are required, one for each
endpoint of the desired track segment. You can modify the track after
creation by Shift+clicking it. The track is then in edit mode, during
which you can change the length and position by dragging control
points, or by entering values into a control panel. Shift+clicking again
exits edit mode.
12-660
trackg
See Also
12-661
trimcart
Purpose
Syntax
trimcart(h)
Description
Examples
Limitations
12-662
figure; axesm('miller')
framem
[x, y] = humps(0:.05:1);
h = plot(x, y/25, 'r+-');
load coast
geoshow(lat, long)
trimcart(h)
trimcart
See Also
handlem, makemapped
12-663
trimdata
Purpose
Syntax
[ymat,xmat,trimpts] = trimdata(ymat,ylim,xmat,xlim,'object')
Description
[ymat,xmat,trimpts] =
trimdata(ymat,ylim,xmat,xlim,'object') identifies points in map
data that exceed projection limits. The projection limits are defined by
the lower and upper inputs. The particular object to be trimmed is
identified by the 'object' input.
Allowable object strings are
'surface' for trimming graticules
'light' for trimming lights,
'line' for trimming lines
'patch' for trimming patches
'text' for trimming text object location points
'none' to skip all trimming operations
See Also
12-664
undoclip
Purpose
Syntax
[lat,long] = undoclip(lat,long,clippts,'object')
Description
properly invert projected data from the Cartesian space to the original
latitude and longitude data points.
The input variable, clippts, must be constructed by the function
clipdata.
See Also
12-665
undotrim
Purpose
Syntax
[ymat,xmat] = undotrim(ymat,xmat,trimpts,'object')
Description
See Also
12-666
unitsratio
Purpose
Syntax
Description
Units of
Length
length:
Unit Name
String(s)
Meter
Centimeter
Millimeter
Micron
'micron(s)'
Kilometer
Nautical mile
International foot
Inch
Yard
'yd', 'yard(s)'
12-667
unitsratio
Units of
Angle
Examples
Unit Name
String(s)
international mile
of angle:
Unit Name
String(s)
radian
'rad', 'radian(s)'
degree
'deg', 'degree(s)'
= 'feet';
from = 'mile';
sprintf('There are %g %s per %s.', unitsratio(to,from), to, from)
% The following prints a true statement for valid TO, FROM pairs:
to
= 'degrees';
from = 'radian';
sprintf('One %s is %g %s.', from, unitsratio(to,from), to)
12-668
unitstr
Purpose
Syntax
unitstr
str = unitstr(str0,'angles')
str = unitstr(str0,'distances')
Description
Examples
12-669
unitstr
str =
radians
See Also
12-670
unitsratio
unwrapMultipart
Purpose
Syntax
unwrapped = unwrapMultipart(p)
Description
Examples
Example 1
Compare the behavior unwrapMultipart to that of unwrap. The output
of unwrapMultipart starts over again at 6.11 following the NaN, unlike
the output of unwrap. The output of unwrapMultipart is equivalent to a
concatenation (with NaN-separator) of separate calls to unwrap:
p1 = [0.17
5.67
4.89
p2 = [6.11
1.05
2.27];
4.10];
ans =
0.1700
-0.6132
-1.3932
-2.1832
NaN
-0.1732
1.0500
2.2700
-2.1832
NaN
6.1100
7.3332
8.5532
-2.1832
NaN
6.1100
7.3332
8.5532
ans =
0.1700
-0.6132
-1.3932
ans =
0.1700
-0.6132
-1.3932
12-671
unwrapMultipart
Example 2
Wrap two revolutions of a sphere to with wrapToPi, and then unwrap
it with unWrapMultipart:
lon = wrapToPi(degtorad(0:10:720));
unwrappedlon = unwrapMultipart(lon);
figure; hold on
plot(lon,'--')
plot(unwrappedlon)
xlabel 'Point Number'
ylabel 'Longitude in radians'
12-672
unwrapMultipart
See Also
12-673
updategeostruct
Purpose
Syntax
geostruct = updategeostruct(displaystruct)
geostruct = updategeostruct(displaystruct, str)
[geostruct,symbolspec] = updategeostruct(displaystruct, ...)
[geostruct,symbolspec] = updategeostruct(displaystruct, ...,
cmap)
Description
symbolspec.
Remarks
12-674
There are two Mapping Toolbox encodings for vector features that
use MATLAB structure arrays. In both cases there is one feature per
array element, and in both cases a given arrays elements all held the
same type of feature. Version 1.3.1 and earlier of the Mapping Toolbox
software only supported Mapping Toolbox display structures. Version
2.0 introduced a data structure for vector geodata which was less rigidly
defined and more open-ended. The new structures are called geostructs
(if they contain geographic coordinate data) and mapstructs (if they
updategeostruct
A latitude field:
A longitude field:
12-675
updategeostruct
Object properties used in the display are taken from the otherproperty
field of the structure. If a line or patch objects otherproperty field
is empty, displaym uses default colors. A patch is assigned an index
into the current colormap based on the structures tag field. Lines are
assigned colors from the current color order according to their tags.
The newer geostruct representation has significant advantages:
It can represent a much wider range of attributes (display structures
essentially can represent only a feature name).
The geostruct representation (in combination with geoshow and
makesymbolspec) keeps graphics display properties separate from
the intrinsic properties of the geographic features themselves.
For example, a road-class attribute can be used to display major
highways with a distinctive color and greater line width than secondary
roads. The same geographic data structure can be displayed in many
different ways, without altering any of its contents, and shapefile
data imported from external sources need not be altered to control its
graphic display.
For information about the display structure format, see Version 1
Display Structures on page 12-142 in the reference page for displaym.
For a discussion of the characteristics of geographic data structures,
see Mapping Toolbox Geographic Data Structures on page 2-16 in
the Mapping Toolbox Users Guide.
Example
12-676
updategeostruct
See Also
12-677
usamap
Purpose
Syntax
usamap state
usamap(state)
usamap 'conus'
usamap('conus')
usamap
usamap(latlim, lonlim)
usamap(Z, R)
h = usamap(...)
h = usamap('all')
h = usamap('allequal')
Description
12-678
usamap
Remarks
usamap uses tightmap set the axis limits tight around the map. If you
change the projection, or just want more white space around the map
frame, use tightmap again or axis auto.
axes(h(n)), where n = 1, 2, or 3, makes the desired axes current.
set(h,'Visible','on') makes the axes visible.
set(h,'ButtonDownFcn','selectmoveresize') allows interactive
repositioning of the axes. set(h,'ButtonDownFcn','uimaptbx')
Examples
Example 1
Make a map of Alabama only:
usamap('Alabama')
alabamahi = shaperead('usastatehi', 'UseGeoCoords', true,...
12-679
usamap
Example 2
Map a region extending from California to Montana:
figure; ax = usamap({'CA','MT'});
set(ax, 'Visible', 'off')
latlim = getm(ax, 'MapLatLimit');
lonlim = getm(ax, 'MapLonLimit');
states = shaperead('usastatehi',...
'UseGeoCoords', true, 'BoundingBox', [lonlim', latlim']);
geoshow(ax, states, 'FaceColor', [0.5 0.5 1])
lat = [states.LabelLat];
lon = [states.LabelLon];
tf = ingeoquad(lat, lon, latlim, lonlim);
textm(lat(tf), lon(tf), {states(tf).Name}, ...
'HorizontalAlignment', 'center')
12-680
usamap
Example 3
Map the Conterminous United States with a different fill color for
each state:
figure; ax = usamap('conus');
states = shaperead('usastatelo', 'UseGeoCoords', true,...
'Selector',...
{@(name) ~any(strcmp(name,{'Alaska','Hawaii'})), 'Name'});
faceColors = makesymbolspec('Polygon',...
{'INDEX', [1 numel(states)], 'FaceColor', ...
polcmap(numel(states))}); %NOTE - colors are random
geoshow(ax, states, 'DisplayType', 'polygon', ...
'SymbolSpec', faceColors)
framem off; gridm off; mlabel off; plabel off
12-681
usamap
Example 4
Map of the USA with separate axes for Alaska and Hawaii:
figure; ax = usamap('allequal');
set(ax, 'Visible', 'off')
states = shaperead('usastatelo', 'UseGeoCoords', true);
names = {states.Name};
indexHawaii = strmatch('Hawaii',names);
indexAlaska = strmatch('Alaska',names);
indexConus = 1:numel(states);
indexConus(indexHawaii) = [];
indexConus(indexAlaska) = [];
stateColor = [0.5 1 0.5];
geoshow(ax(1), states(indexConus), 'FaceColor', stateColor)
geoshow(ax(2), states(indexAlaska), 'FaceColor', stateColor)
geoshow(ax(3), states(indexHawaii), 'FaceColor', stateColor)
for k = 1:3
setm(ax(k), 'Frame', 'off', 'Grid', 'off',...
'ParallelLabel', 'off', 'MeridianLabel', 'off')
end
12-682
usamap
See also
12-683
usgs24kdem
Purpose
Syntax
[lat,lon,Z] = usgs24kdem
[lat,lon,Z] = usgs24kdem(filename)
[lat,lon,Z] = usgs24kdem(filename,samplefactor)
[lat,lon,Z] =
usgs24kdem(filename,samplefactor,latlim,lonlim)
[lat,lon,Z] = ...usgs24kdem(filename,samplefactor,latlim,
lonlim,gsize)
[lat, lon, Z, header, profile] = usgs24kdem(...)
Description
12-684
usgs24kdem
[lat,lon,Z] =
...usgs24kdem(filename,samplefactor,latlim,lonlim,gsize)
specifies the graticule size in gsize. gsize is a two-element vector
Background
Example
12-685
usgs24kdem
delete(demFilename);
4 As no negative elevations exist, move all points at sea level to -1
37.7504
figure
usamap(latlim, lonlim)
geoshow(lat, lon, Z, 'DisplayType','surface')
demcmap(Z)
daspectm('m',1)
12-686
usgs24kdem
CTOG'
Filler: ''
ProcessCode: ''
Filler2: ''
SectionalIndicator: ''
MCoriginCode: ''
DEMlevelCode: 2
ElevationPatternCode: 'regular'
PlanimetricReferenceSystemCode: 'UTM'
12-687
usgs24kdem
Zone: 10
ProjectionParameters: [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]
HorizontalUnits: 'meters'
ElevationUnits: 'feet'
NsidesToBoundingBox: 4
BoundingBox: [1x8 double]
MinMaxElevations: [0 1314]
RotationAngle: 0
AccuracyCode: 'accuracy information in record C'
XYZresolutions: [30 30 1]
NrowsCols: [1 371]
MaxPcontourInt: NaN
SourceMaxCintUnits: NaN
SmallestPrimary: NaN
SourceMinCintUnits: NaN
DataSourceDate: NaN
DataInspRevDate: NaN
InspRevFlag: ''
DataValidationFlag: NaN
SuspectVoidFlag: NaN
VerticalDatum: NaN
HorizontalDatum: NaN
DataEdition: NaN
PercentVoid: NaN
Remarks
This function reads USGS DEM files stored in the UTM projection.
The function unprojects the grid back to latitude and longitude. Use
usgsdem for data stored in geographic grids.
The number of points in a file varies with the geographic location.
Unlike the USGS DEM products, which use an equal-angle grid, the
UTM projection grid DEMs cannot simply be concatenated to cover
larger areas. There can be data gaps between DEMs.
You can obtain the data files from the U.S. Geological Survey and from
commercial vendors. Other agencies have made some local area data
available online. The DEM files are ASCII files, and can be transferred
as text. Line-ending conversion is not necessarily required.
12-688
usgs24kdem
See Also
12-689
usgsdem
Purpose
Syntax
[Z,refvec] = usgsdem(filename,scalefactor)
[Z,refvec] = usgsdem(filename,scalefactor,latlim,lonlim)
Description
reads data within the latitude and longitude limits. These limits are
two-element vectors with the minimum and maximum values specified
in units of degrees.
Background
The U.S. Geological Survey has made available a set of digital elevation
maps of 1-degree quadrangles covering the contiguous United States,
Hawaii, and limited portions of Alaska. The data is on a regular grid
with a spacing of 30 arc-seconds (or about 100-meter resolution).
1-degree DEMs are also referred to as 3-arc-second or 1:250,000 scale
DEM data.
The data is derived from the U.S. Defense Mapping Agencys DTED-1
digital elevation model, which itself was derived from cartographic and
photographic sources. The cartographic sources were maps from the
7.5-minute through 1-degree series (1:24,000 scale through 1:250,000
scale).
Remarks
12-690
The grid for the digital elevation maps is based on the 1984 World
Geodetic System (WGS84). Older DEMs were based on WGS72.
Elevations are in meters relative to National Geodetic Vertical Datum
of 1929 (NGVD 29) in the continental U.S. and local mean sea level
in Hawaii.
usgsdem
The absolute horizontal accuracy of the DEMs is 130 meters, while the
absolute vertical accuracy is 30 meters. The relative horizontal and
vertical accuracy is not specified, but is probably much better than the
absolute accuracy.
These DEMs have a grid spacing of 3 arc-seconds in both the latitude
and longitude directions. The exception is DEM data in Alaska, where
latitudes between 50 and 70 degrees North have grid spacings of 6
arc-seconds, and latitudes greater than 70 degrees North have grid
spacings of 9 arc-seconds.
Statistical data in the files is not returned.
You can obtain the data files from the U.S. Geological Survey and from
commercial vendors. Other agencies have made some local area data
available online.
Note For details on locating map data for download over the
Internet, see the following documentation at the MathWorks Web site:
http://www.mathworks.com/support/tech-notes/2100/2101.html.
Examples
Read every fifth point in the file containing part of Rhode Island and
Cape Cod:
[Z,refvec] = usgsdem('providence-e',5);
See Also
Size
226x485
Bytes
876880
Class
double array
12-691
usgsdems
Purpose
Syntax
[fname,qname] = usgsdems(latlim,lonlim)
Description
Background
The U.S. Geological Survey has made available a set of digital elevation
maps of 1-degree quadrangles covering the contiguous United States,
Hawaii, and limited portions of Alaska. These are referred to as
1-degree, 3-arc second or 1:250,000 scale DEMs. Because the filenames
of these 1 degree data sets are taken from the names of cities or features
in the quadrangle, determining the files needed to cover a particular
region generally requires consulting an index map or other reference.
This function takes the place of such a reference by returning the
filenames for a given geographic region.
Remarks
This function only returns filenames for the contiguous United States.
Examples
12-692
usgsdems
See Also
usgsdem
12-693
utmgeoid
Purpose
Syntax
ellipsoid = utmgeoid,
ellipsoid = utmgeoid(zone)
[ellipsoid,ellipsoidstr] = utmgeoid(...)
Description
interface for selecting a UTM zone. This zone is then used to return the
recommended ellipsoid definitions for that particular zone.
ellipsoid = utmgeoid(zone) uses the input zone to return the
Background
Examples
See Also
12-694
utmzone
0.081473
0.081697
utmzone
Purpose
Syntax
zone = utmzone
zone = utmzone(lat,long)
zone = utmzone(mat),
[latlim,lonlim] = utmzone(zone),
lim = utmzone(zone)
Description
designation, returns the geographic limits of the zone. Valid UTM zones
designations are numbers, or numbers followed by a single letter. For
example, '31' or '31N'. The returned limits are in units of degrees.
lim = utmzone(zone) returns the limits in a single vector output.
Background
Examples
12-695
utmzone
utmzone(latlim,lonlim)
ans =
12F
Limitations
The UTM zone system is based on a regular division of the globe, with
the exception of a few zones in northern Europe. utmzone does not
account for these deviations.
See Also
utmgeoid
12-696
vec2mtx
Purpose
Syntax
[Z,
[Z,
[Z,
[Z,
Description
R]
R]
R]
R]
=
=
=
=
vec2mtx(lat,
vec2mtx(lat,
vec2mtx(lat,
vec2mtx(...,
lon, density)
lon, density, latlim, lonlim)
lon, Z1, R1)
'filled')
from vector data, placing ones in grid cells intersected by a vector and
zeroes elsewhere. R is the referencing vector for the computed grid. lat
and lon are vectors of equal length containing geographic locations in
units of degrees. density indicates the number of grid cells per unit
of latitude and longitude (a value of 10 indicates 10 cells per degree,
for example), and must be scalar-valued. Whenever there is space, a
buffer of two grid cells is included on each of the four sides of the grid.
The buffer is reduced as needed to keep the latitudinal limits within
[-90 90] and to keep the difference in longitude limits from exceeding
360 degrees.
[Z, R] = vec2mtx(lat, lon, density, latlim, lonlim) uses the
two-element vectors latlim and lonlim to define the latitude and
longitude limits of the grid.
[Z, R] = vec2mtx(lat, lon, Z1, R1) uses a pre-existing data grid
Z1, georeferenced by R1, to define the limits and density of the output
grid. R1 is either a 1-by-3 vector containing elements:
[cells/degree northern_latitude_limit western_longitude_limit]
12-697
vec2mtx
Notes
Empty lat, lon vertex arrays will result in an error unless the grid
limits are explicitly provided (via latlim, lonlim or Z1, R1). In the
case of explicit limits, Z will be filled entirely with 0s if the 'filled'
parameter is omitted, and 2s if it is included.
Its possible to apply vec2mtx to sets of polygons that tile without
overlap to cover an area, as in Example 1 below, but using 'filled'
with polygons that actually overlap may lead to confusion as to which
areas are inside and which are outside.
Example 1
12-698
vec2mtx
Example 2
See Also
imbedm
12-699
vfwdtran
Purpose
Syntax
th = vfwdtran(lat,lon,az)
th = vfwdtran(mstruct,lat,lon,az)
[th,len] = vfwdtran(...)
Description
latitude and longitude points on the sphere into the projection space.
The map projection currently displayed is used to define the projection
space. The input angles must be in the same units as specified by the
current map projection. The inputs can be scalars or matrices of the
equal size. The angle in the projection space is defined as positive
counterclockwise from the x-axis.
th = vfwdtran(mstruct,lat,lon,az) uses the map projection defined
by the input mstruct to compute the map projection.
[th,len] = vfwdtran(...) also returns the vector length in the
Background
Examples
Sample calculations:
axesm('eqdconic','maplatlim',[-10 45],'maplonlim',[-55 55])
gridm; framem; mlabel; plabel
quiverm([0 0 0],[-45 0 45],[0 0 0],[10 10 10],0)
quiverm([0 0 0],[-45 0 45],[10 10 10],[0 0 0],0)
12-700
vfwdtran
45 N
30 N
30 W
30 E
15 N
0
90
120.39
0.0001931
30.386
Limitations
Remarks
12-701
vfwdtran
See Also
12-702
viewshed
Purpose
Syntax
[vis,R] = viewshed(Z,R,lat1,lon1)
viewshed(Z,R,lat1,lon1,observerAltitude)
viewshed(Z,R,lat1,lon1,observerAltitude,targetAltitude)
viewshed(Z,R,lat1,lon1,observerAltitude,targetAltitude, ...
observerAltitudeOption)
viewshed(Z,R,lat1,lon1,observerAltitude,targetAltitude, ...
observerAltidueOption,targetAltitudeOption)
viewshed(Z,R,lat1,lon1,observerAltitude,targetAltitude, ...
observerAltitudeOption,targetAltitudeOption,actualRadius)
viewshed(Z,R,lat1,lon1,observerAltitude,targetAltitude, ...
observerAltitudeOption,targetAltitudeOption, ...
actualRadius,effectiveRadius)
Description
12-703
viewshed
propagation of the line of sight. This can account for the curvature of
the signal path due to refraction in the atmosphere. For example, radio
propagation in the atmosphere is commonly treated as straight line
propagation on a sphere with 4/3 the radius of the Earth. In that case
the last two arguments would be R_e and 4/3*R_e, where R_e is the
12-704
viewshed
radius of the earth. Use Inf for flat Earth viewshed calculations. The
altitudes, the elevations, and the radii should be in the same units.
Remarks
Example
Compute visibility for a point on the peaks map. Add the detailed
information for the line of sight calculation between two points from
los2.
Z = 500*peaks(100);
refvec = [ 1000 0 0];
[lat1,lon1,lat2,lon2]=deal(-0.027,0.05,-0.093,0.042);
[visgrid,visleg] = viewshed(Z,refvec,lat1,lon1,100);
[vis,visprofile,dist,zi,lattrk,lontrk] ...
= los2(Z,refvec,lat1,lon1,lat2,lon2,100);
axesm('globe','geoid',almanac('earth','sphere','meters'))
meshm(visgrid,visleg,size(Z),Z); axis tight
camposm(-10,-10,1e6); camupm(0,0)
colormap(flipud(summer(2))); brighten(0.75);
shading interp; camlight
h = lcolorbar({'obscured','visible'});
set(h,'Position',[.875 .45 .02 .1])
plot3m(lattrk([1;end]),lontrk([1; end]), ...
zi([1; end])+[100; 0],'r','linewidth',2)
plotm(lattrk(~visprofile),lontrk(~visprofile), ...
zi(~visprofile),'r.','markersize',10)
plotm(lattrk(visprofile),lontrk(visprofile), ...
zi(visprofile),'g.','markersize',10)
12-705
viewshed
12-706
viewshed
lighting phong
material([0.25 0.8 0])
lat = 34.0931; lon = 125.6578;
altobs = 3000; alttarg = 0;
plotm(lat,lon,'wo')
Re = almanac('earth','radius','m');
[vmap,vmapl] = viewshed( ...
map,refvec,lat,lon,altobs,alttarg, ...
'MSL','AGL',Re,4/3*Re);
meshm(vmap,vmapl,size(map),map)
caxis auto; colormap([1 0 0; 0 0 1])
lighting phong; material metal
axis off
Over what area can the radar plane flying at an altitude of 3000 meters
have line-of-sight to other aircraft flying at 5000 meters? Now the area
is much larger. Some edges of the area are reduced by shadowing from
Jeju-Do and the mountains on the Korean peninsula.
[vmap,vmapl] = viewshed(map,refvec,lat,lon,3000,5000, ...
'MSL','MSL',Re,4/3*Re);
12-707
viewshed
clmo surface
meshm(vmap,vmapl,size(map),map)
material metal
lighting phong
See Also
12-708
los2
vinvtran
Purpose
Syntax
az = vinvtran(x,y,th)
az = vinvtran(mstruct,x,y,th)
[az,len] = vinvtran(...)
Description
Background
Examples
Sample calculations:
axesm('eqdconic','maplatlim',[-10 45],'maplonlim',[-55 55])
gridm; framem; mlabel; plabel
[x,y] = mfwdtran([0 0 0],[-45 0 45]);
quiver(x,y,[ .2 .2 .2],[0 0 0],0)
quiver(x,y,[0 0 0],[ .2 .2 .2],0)
12-709
vinvtran
45 N
30 W
30 N
30 E
15 N
0
vinvtran(x,y,[ 0 0 0])
ans =
57.345
90.338
124.98
vinvtran(x,y,[ 90 90 90])
ans =
331.99
28.008
Limitations
Remarks
12-710
vinvtran
See Also
12-711
vmap0data
Purpose
Syntax
struct = vmap0data(library,latlim,lonlim,theme,topolevel)
struct = vmap0data(devicename,library, ...)
[struct1, struct2, ...] =
vmap0data(...,{topolevel1,
topolevel2,...})
Description
struct = vmap0data(library,latlim,lonlim,theme,topolevel)
reads the data for the specified theme and topology level directly from
the VMAP0 CD-ROM. There are four CDs, one for each of the libraries:
'NOAMER' (North America), 'SASAUS' (Southern Asia and Australia),
'EURNASIA' (Europe and Northern Asia), and 'SOAMAFR' (South
America and Africa). The desired theme is specified by a two-letter code
string. A list of valid codes is displayed when an invalid code, such as
'?', is entered. topolevel defines the type of data returned. It is a
string containing 'patch', 'line', 'point', or 'text'. The region of
interest can be given as a point latitude and longitude or as a region
with two-element vectors of latitude and longitude limits. The units of
latitude and longitude are degrees. The data covering the requested
region is returned, but will include data extending to the edges of the
tiles. The result is returned as a Mapping Toolbox Version 1 display
structure.
struct = vmap0data(devicename,library, ...) specifies the logical
levels. The levels must be specified as a cell array with the entries
'patch', 'line', 'point', or 'text'. Entering {'all'} for the
topology level argument is equivalent to {'patch', 'line', 'point',
'text'}. Upon output, the data structures are returned in the output
Background
12-712
The Vector Map (VMAP) Level 0 database represents the third edition
of the Digital Chart of the World. The second edition was a limited
vmap0data
release item published in 1995. The product is dual named to show its
lineage to the original DCW, published in 1992, while positioning the
revised product within a broader emerging family of VMAP products.
VMAP Level 0 is a comprehensive 1:1,000,000 scale vector base map of
the world. It consists of cartographic, attribute, and textual data stored
on compact disc read-only memory (CD-ROM). The primary source for
the database is the Operational Navigation Chart (ONC) series of the
U. S. National Geospatial Intelligence Agency (NGA), formerly the
National Imagery and Mapping Agency (NIMA), and before that, the
Defense Mapping Agency (DMA). This is the largest scale unclassified
map series in existence that provides consistent, continuous global
coverage of essential base map features. The database contains more
than 1,900 MB of vector data and is organized into 10 thematic layers.
The data includes major road and rail networks, major hydrologic
drainage systems, major utility networks (cross-country pipelines and
communication lines), all major airports, elevation contours (1000
foot (ft), with 500 ft and 250 ft supplemental contours), coastlines,
international boundaries, and populated places. The database can
be accessed directly from the four optical CD-ROMs that store the
database or can be transferred to magnetic media.
Remarks
12-713
vmap0data
Vector Map Level 0, created in the 1990s, is still probably the most
detailed global database of vector map data available to the public.
VMAP0 CD-ROMs are available from through the U.S. Geological
Survey (USGS):
USGS Information Services (Map and Book Sales)
Box 25286
Denver Federal Center
Denver, CO 80225
Telephone: (303) 202-4700
Fax: (303) 202-4693
Note For details on locating map data for download over the
Internet, see the following documentation at the MathWorks Web site:
http://www.mathworks.com/support/tech-notes/2100/2101.html.
Examples
12-714
vmap0data
ind
phys
pop
trans
util
veg
:
:
:
:
:
:
Industry
Physiography
Population
Transportation
Utilities
Vegetation
BNDpatch = vmap0data(devicename,'NOAMER',...
[41 44],[-72 -69],'bnd','patch')
BNDpatch =
1x169 struct array with fields:
type
otherproperty
altitude
lat
long
tag
See Also
12-715
vmap0read
Purpose
Syntax
vmap0read
vmap0read(filepath,filename)
vmap0read(filepath,filename,recordIDs)
vmap0read(filepath,filename,recordIDs,field,varlen)
struc = vmap0read(...)
[struc,field] = vmap0read(...)
[struc,field,varlen] = vmap0read(...)
[struc,field,varlen,description] = vmap0read(...)
[struc,field,varlen,description,
narrativefield] = vmap0read(...)
Description
vmap0read reads a VMAP0 file. The user selects the file interactively.
vmap0read(filepath,filename) reads the specified file. The
combination [filepath filename] must form a valid complete filename.
vmap0read(filepath,filename,recordIDs) reads selected records or
fields from the file. If recordIDs is a scalar or a vector of integers,
the function returns the selected records. If recordIDs is a cell
array of integers, all records of the associated fields are returned.
vmap0read(filepath,filename,recordIDs,field,varlen)
current file.
12-716
vmap0read
Background
Remarks
This function reads all VMAP0 files except index files (files with names
ending in 'X'), thematic index files (files with names ending in 'TI'),
and spatial index files (files with names ending in 'SI').
File separators are platform dependent. The filepath input must
use appropriate file separators, which you can determine using the
MATLAB filesep function.
Examples
The following examples use the UNIX directory system and file
separators for the pathname:
s = vmap0read('VMAP/VMAPLV0/NOAMER/','GRT')
s =
id:
data_type:
units:
ellipsoid_name:
ellipsoid_detail:
vert_datum_name:
vert_datum_code:
sound_datum_name:
sound_datum_code:
geo_datum_name:
geo_datum_code:
projection_name:
1
'GEO'
'M'
'WGS 84'
'A=6378137 B=6356752 Meters'
'MEAN SEA LEVEL'
'015'
'N/A'
'N/A'
'WGS 84'
'WGE'
'Dec. Deg. (unproj.)'
s = vmap0read('VMAP/VMAPLV0/NOAMER/TRANS/','INT.VDT')
s =
34x1 struct array with fields:
id
12-717
vmap0read
table
attribute
value
description
s(1)
ans =
id: 1
table: 'aerofacp.pft'
attribute: 'use'
value: 8
description: 'Military'
s = vmap0read('VMAP/VMAPLV0/NOAMER/TRANS/','AEROFACP.PFT',1)
s =
id:
f_code:
iko:
nam:
na3:
use:
zv3:
tile_id:
end_id:
1
'GB005'
'BGTL'
'THULE AIR BASE'
'GL52085'
8
77
10
1
s = vmap0read('VMAP/VMAPLV0/NOAMER/TRANS/','AEROFACP.PFT',{1,2})
s =
1x4424 struct array with fields:
id
f_code
See Also
12-718
vmap0data, vmap0rhead
vmap0rhead
Purpose
Syntax
vmap0rhead
vmap0rhead(filepath,filename)
vmap0rhead(filepath,filename,fid)
vmap0rhead(...),
str = vmap0rhead(...)
Description
header.
Background
The Vector Map Level 0 (VMAP0) uses header strings in most files
to document the contents and format of that file. This function reads
the header string and displays a formatted version in the Command
Window, or returns it as a string.
Remarks
This function reads all VMAP0 files except index files (files with names
ending in 'X'), thematic index files (files with names ending in 'TI')
and spatial index files (files with names ending in 'SI').
File separators are platform dependent. The filepath input must
use appropriate file separators, which you can determine using the
MATLAB filesep function.
Examples
12-719
vmap0rhead
s =
L;Geographic Reference Table;-;id=I,1,P,Row
Identifier,-,-,-,:data_type=T,3,N,Data
Type,-,-,-,:units=T,3,N,Units of Measure Code for
Library,-,-,-,:ellipsoid_name=T,15,N,Ellipsoid,-,-,-,:ellipsoid
_detail=T,50,N,Ellipsoid
Details,-,-,-,:vert_datum_name=T,15,N,Datum Vertical
Reference,-,-,-,:vert_datum_code=T,3,N,Vertical Datum
Code,-,-,-,:sound_datum_name=T,15,N,Sounding
Datum,-,-,-,:sound_datum_code=T,3,N,Sounding Datum
Code,-,-,-,:geo_datum_name=T,15,N,Datum Geodetic
Name,-,-,-,:geo_datum_code=T,3,N,Datum Geodetic
Code,-,-,-,:projection_name=T,20,N,Projection Name,-,-,-,:;
vmap0rhead('VMAP/VMAPLV0/NOAMER/TRANS/','AEROFACP.PFT')
L
Airport Point Feature Table
aerofacp.doc
id=I,1,P,Row Identifier,-,-,-,
f_code=T,5,N,FACC Feature Code,char.vdt,-,-,
iko=T,4,N,ICAO Designator,char.vdt,-,-,
nam=T,*,N,Name,char.vdt,-,-,
na3=T,*,N,Name,char.vdt,-,-,
use=S,1,N,Usage,int.vdt,-,-,
zv3=S,1,N,Airfield/Aerodrome Elevation (meters),int.vdt,-,-,
tile_id=S,1,N,Tile Reference ID,-,tile1_id.pti,-,
end_id=I,1,N,Entity Node Primitive ID,-,end1_id.pti,-,
See Also
12-720
vmap0data, vmap0read
WebMapServer class
Purpose
Description
Construction
Properties
Timeout
12-721
WebMapServer class
ServerURL
Methods
Example
getCapabilities
getMap
updateLayers
See Also
12-722
WebMapServer.getCapabilities
Purpose
Syntax
capabilities = server.getCapabilities()
Description
Example
12-723
WebMapServer.getMap
Purpose
Syntax
A = server.getMap(mapRequestURL)
Description
Example
12-724
WebMapServer.updateLayers
Purpose
Syntax
Description
Examples
12-725
WebMapServer.updateLayers
for k=1:numel(servers)
serverLayers = ...
terra.refine(servers{k}, 'SearchField', 'serverurl');
fprintf('Updating properties from server %d:\n%s\n', ...
k, serverLayers(1).ServerURL);
server = WebMapServer(serverLayers(1).ServerURL);
layers = server.updateLayers(serverLayers);
% Grow using concatenation; layers can have any length
% ranging from 0 to numel(serverLayers).
updatedTerraLayers = [updatedTerraLayers; layers];
end
12-726
westof
Purpose
Syntax
lonWrapped = westof(lon,meridian)
lonWrapped = westof(lon,meridian,angleunits)
Description
12-727
WMSCapabilities class
Purpose
Description
Construction
capabilities = WMSCapabilites(ServerURL,
capabilitiesResponse) constructs a WMSCapabilities object
from the input string parameters. The ServerURL string, a WMS
server URL, includes the protocol 'http://' or 'https://'. The
capabilitiesResponse string contains XML elements that describe
the capabilities of the ServerURL WMS server.
Properties
ServerTitle
Title of server
Data Type: string
ServerURL
URL of server
Data Type: string
ServiceName
12-728
WMSCapabilities class
Data Type
Field Content
Person
String
Name of individual
Organization
String
Name of organization
String
E-mail address
AccessConstraints
12-729
WMSCapabilities class
LayerNames
Methods
Example
disp
Display properties
See Also
12-730
WMSCapabilities.disp
Purpose
Display properties
Syntax
capabilities.disp()
Description
12-731
WMSCapabilities.Layer property
Purpose
Layer information
Description
12-732
Property Name
Data
Type
Property Content
ServerTitle
String
ServerURL
String
URL of server
LayerTitle
String
LayerName
String
Name of layer
Latlim
Double
array
Lonlim
Double
array
Abstract
String
CoordRefSysCodes
Cell array
Details
Structure
wmsfind
Purpose
Syntax
layers = wmsfind(querystr)
layers = wmsfind(..., param, val, ...)
Description
the WMS database based on the values of the parameters. You can
abbreviate parameter names, and case does not matter. To modify the
search, specify any of the parameters listed in the Inputs section.
The WMS Database does not store content for the properties
'Abstract', 'CoordRefSysCodes', and 'Details'. Therefore, you
cannot use wmsfind to search these properties. Populate these fields by
using the wmsupdate function. This function updates these properties
by downloading information from the server. The WMSLayer.disp
12-733
wmsfind
Inputs
querystr
Data Type
Value
'IgnoreCase'
Logical
'Latlim'
Two-element
vector or scalar
12-734
wmsfind
(Continued)
Parameter
Data Type
Value
'Lonlim'
Two-element
vector or scalar
A two-element vector of
longitude specifying the
longitudinal limits of the search
in the form [western_limit
eastern_limit] or a scalar
value representing the longitude
of a single point. All angles are
in units of degrees.
If provided and not empty,
a given layer appears in the
results only if its limits contain
the specified 'Lonlim' limits.
Partial overlap does not result
in a match.
'MatchType'
String
'SearchFields'
String or cell
array of strings
12-735
wmsfind
(Continued)
Parameter
Data Type
Value
partial match with querystr.
If 'layer' is supplied, then
both the 'layertitle' and
'layername' fields are searched.
If 'server' is supplied, then
both the 'serverurl' and
'servertitle' fields are
searched. The layer information
is returned if any supplied
'SearchFields' match. The
default value is {'layer'}.
Examples
12-736
wmsfind
12-737
wmsfind
servers = layers.servers;
Find and display to the command window a list of global sea surface
temperature layers.
global_sst = sst.refine('global')
Sort and display to the command window the unique layer titles in
the WMS database.
layerTitles = sort(unique({layers.LayerTitle}))'
12-738
wmsfind
Refine layers to contain only layers that have the terms oil and gas
in the LayerTitle.
oil_gas = layers.refine('oil*gas', 'SearchField', 'layertitle');
See Also
12-739
wmsinfo
Purpose
Syntax
Description
12-740
wmsinfo
Examples
Sample Output
Index:
ServerTitle:
ServerURL:
LayerTitle:
LayerName:
Latlim:
Lonlim:
Abstract:
CoordRefSysCodes:
Details:
304
'NASA SVS Image Server'
'http://aes.gsfc.nasa.gov/cgi-bin/wms?'
'(2048x2048 Animation)'
'3352_24736'
[38.3727 39.3133]
[-91.1052 -89.9017]
'During the first half of 1993, ....'
{'EPSG:4326'}
[1x1 struct]
12-741
wmsinfo
glaciers(1).Abstract
Sample Output
Since measurements of Jakobshavn Isbrae were first taken....
See Also
12-742
WMSLayer class
Purpose
Description
Construction
Properties
12-743
WMSLayer class
12-744
WMSLayer class
CoordRefSysCodes
Methods
Example
disp
Display properties
refine
Refine search
refineLimits
servers
serverTitles
12-745
WMSLayer class
layer = wmsupdate(layer);
[A, R] = wmsread(layer, 'ImageHeight', 288, 'ImageWidth', 720);
figure
worldmap world
setm(gca,'maplatlimit',layer.Latlim, 'maplonlimit',layer.Lonlim)
mlabel off;plabel off
geoshow(A,R)
Courtesy NASA/JPL-Caltech
See Also
12-746
WMSLayer.disp
Purpose
Display properties
Syntax
Description
Use optional parameters for disp to modify the output display. You can
abbreviate parameter names, and case does not matter.
Inputs
param, val
Data Type
'Properties' String or
cell array
of strings
Value
Default
'all'
'Label'
String
'on'
'Index'
String
'on'
12-747
WMSLayer.disp
Examples
Sample Output
LayerTitle: 'SRTM30Plus World with Backdrop'
LayerName: '10:4'
Sample Output
Index: 1418
'topp:elevation_earth_300sec'
Index: 1419
'topp:elevation_europe_150sec'
Index: 1420
'topp:elevation_europe_150sec'
See Also
12-748
wmsfind
WMSLayer.refine
Purpose
Refine search
Syntax
Description
Inputs
querystr
Data Type
Value
Default
'SearchFields'
Case-insensitive
string or cell
array of strings
{'layer'}
12-749
WMSLayer.refine
(Continued)
Parameter
Data Type
Value
Default
Case-insensitive
string with value
'partial' or
'exact'
'IgnoreCase'
Example
Logical
'partial'
true
See Also
12-750
wmsfind | WMSLayer.refineLimits
WMSLayer.refineLimits
Purpose
Syntax
Description
include a given layer only if its boundary quadrangle (as defined by the
Latlim and Lonlim properties) is fully contained in the quadrangle
specified by the optional 'Latlim' or 'Lonlim' parameters. Partial
overlap does not result in a match. 'Latlim' and 'Lonlim' can be
abbreviated and case does not matter. All angles are in units of degrees.
The default value of [] for either 'Latlim' or 'Lonlim' implies that all
layers match the criteria. For example, if you specify the following:
layer.refineLimits('Latlim', [0 90], 'Lonlim', [])
then the results include all the layers that cover the northern
hemisphere.
Inputs
param, val
Value
'Latlim'
'Lonlim'
12-751
WMSLayer.refineLimits
Example
Sample Output
ans =
'Global'
'NRL GIDB Portal: Missouri CARES Maps'
'NRL GIDB Portal: NOAA NGDC Maps'
See Also
12-752
wmsfind
WMSLayer.servers
Purpose
Syntax
servers = layers.servers()
Description
Examples
servers.
Find all unique URLs of government servers.
layers = wmsfind('*.gov*','SearchField', 'serverurl');
servers = layers.servers;
sprintf('%s\n', servers{:})
Sample Output
http://www.ga.gov.au/bin/getmap.pl?dataset=national
http://www.geoportaligm.gov.ec/nacional/wms?
http://www.geoportaligm.gov.ec/regional/wms?
For each server that contains a temperature layer, list the server URL
and the number of temperature layers.
temperature = wmsfind('temperature');
servers = temperature.servers;
for k=1:numel(servers)
querystr = servers{k};
layers = temperature.refine(querystr, ...
'SearchFields', 'serverurl');
fprintf('Server URL\n%s\n', layers(1).ServerURL);
fprintf('Number of layers: %d\n\n', numel(layers));
end
Sample Output
Server URL
http://svs.gsfc.nasa.gov/cgi-bin/wms?
12-753
WMSLayer.servers
Number of layers: 36
See Also
12-754
WMSLayer.serverTitles
Purpose
Syntax
serverTitles = layers.serverTitles()
Description
Example
of unique servers.
List titles of unique government servers.
layers = wmsfind('*.gov*', 'SearchField', 'serverurl');
titles = layers.serverTitles
sprintf('%s\n', titles{:})
Sample Output
High Resolution Nighttime Imagery (Las Vegas)
See Also
wmsfind | WMSLayer.servers
12-755
WMSLayer.Details property
Description
Data
Type
Field Content
MetadataURL
String
Attributes
Structure
Attributes of layer
BoundingBox
Structure
array
Dimension
Structure
array
ImageFormats
Cell array
ScaleLimits
Structure
Style
Structure
array
Version
String
Attributes Structure
Field Name
Data
Type
Field Content
Queryable
Logical
feature information
Cascaded
Double
Opaque
Logical
completely opaque
12-756
WMSLayer.Details property
Data
Type
Field Content
FixedWidth
Logical
Logical
BoundingBox Structure
Field Name
Data
Type
Field Content
CoordRefSysCode
String
XLim
Double
array
YLim
Double
array
Dimension Structure
Field Name
Data
Type
Field Content
Name
String
Units
String
Measurement unit
UnitSymbol
String
12-757
WMSLayer.Details property
Data
Type
Field Content
Default
String
MultipleValues
Logical
12-758
NearestValue
Logical
Current
Logical
Extent
String
WMSLayer.Details property
ScaleLimits Structure
Field Name
Data Type
Field Content
ScaleHint
Double
array
MinScaleDenominator
Double
Minimum scale
denominator of maps
for which a layer is
appropriate
MaxScaleDenominator
Double
Maximum scale
denominator of maps
for which a layer is
appropriate
Data Type
Field Content
Title
String
Name
String
Name of style
Abstract
String
12-759
WMSMapRequest class
Purpose
Description
Construction
Properties
Server
12-760
WMSMapRequest class
12-761
WMSMapRequest class
12-762
WMSMapRequest class
12-763
WMSMapRequest class
12-764
WMSMapRequest class
12-765
WMSMapRequest class
Methods
Examples
boundImageSize
Basic Request
Read and display a global sea surface temperature map from the
European Space Agency Web server.
esa = wmsfind('esa.int', 'SearchField', 'serverurl');
sst = esa.refine('global sea surface');
server = WebMapServer(sst.ServerURL);
mapRequest = WMSMapRequest(sst, server);
sstImage = server.getMap(mapRequest.RequestURL);
figure
worldmap(mapRequest.Latlim, mapRequest.Lonlim);
geoshow(sstImage, mapRequest.RasterRef);
title(mapRequest.Layer.LayerTitle, ...
'Interpreter', 'none', 'FontWeight', 'bold')
12-766
WMSMapRequest class
12-767
WMSMapRequest class
Courtesy ESA
Style Request
Read and display a global elevation and bathymetry layer for the Gulf
of Maine at a 30 arc-seconds sampling interval. The values are in
units of meters.
layers = wmsfind('srtmplus', 'MatchType', 'exact');
layer = layers(1);
server = WebMapServer(layer.ServerURL);
mapRequest = WMSMapRequest(layer, server);
mapRequest.Latlim = [40 46];
mapRequest.Lonlim = [-71 -65];
samplesPerInterval = 30/3600;
mapRequest.ImageHeight = ...
round(diff(mapRequest.Latlim)/samplesPerInterval);
mapRequest.ImageWidth = ...
round(diff(mapRequest.Lonlim)/samplesPerInterval);
mapRequest.StyleName = 'short_int';
mapRequest.ImageFormat = 'image/geotiff';
12-768
WMSMapRequest class
Z = server.getMap(mapRequest.RequestURL);
Courtesy NASA/JPL
See Also
12-769
WMSMapRequest.boundImageSize
Purpose
Syntax
Description
Example
12-770
WMSMapRequest.boundImageSize
title(base_layer.LayerTitle)
12-771
WMSMapRequest.boundImageSize
Downsampled from the EGM96 grid developed by NASA Goddard and the
National Geospatial-Intelligence Agency (NGA)
12-772
WMSMapRequest.Time property
Purpose
Description
Input (string)
Stored format
dd-mm-yyyy HH:MM:SS
yyyy-mm-ddTHH:MM:SSZ
dd-mm-yyyy
yyyy-mm-dd
mm/dd/yy
yyyy-mm-dd
mm/dd
yyyy-mm-dd (current
year)
10
yyyy
yyyy
13
HH:MM:SS
yyyy-mm-ddTHH:MM:SSZ
14
HH:MM:SS PM
yyyy-mm-ddTHH:MM:SSZ
15
HH:MM
yyyy-mm-ddTHH:MM:00Z
16
HH:MM PM
yyyy-mm-ddTHH:MM:00Z
21
mmm.dd,yyyy HH:MM:SS
yyyy-mm-ddTHH:MM:SSZ
22
mmm.dd,yyyy
yyyy-mm-dd
23
mm/dd/yyyy
yyyy-mm-dd
12-773
WMSMapRequest.Time property
Dateform
(number)
Input (string)
Stored format
26
yyyy/mm/dd
yyyy-mm-dd
29
yyyy-mm-dd
yyyy-mm-dd
30
yyyymmddTHHMMSS
yyyy-mm-ddTHH:MM:SSZ
31
yyyy-mm-dd HH:MM:SS
yyyy-mm-ddTHH:MM:SSZ
Inputs using the dateform numbers 1316 return the date set to the
current year, month, and day. Use of other dateform formats, especially
19, 20, 24, and 25, results in erroneous output.
In addition to these standard MATLAB dateform formats, the
WMSMapRequest.Time property also accepts the following:
Input (string)
Description
'current'
numeric datenum
Byyyy
B.C.E. year
12-774
wmsread
Purpose
Syntax
[A,
[A,
[A,
[A,
Description
R]
R]
R]
R,
= wmsread(layer)
= wmsread(mapRequestURL)
= wmsread(layer, param, val, ...)
mapRequestURL] = wmsread(...)
has more than one element, then the server overlays each subsequent
layer on top of the base (first) layer, forming a single image. The server
renders multiple layers only if all layers share the same ServerURL
value.
The WMS server returns a raster map, either a color or grayscale image,
in the output A. The second output, a referencing matrix R, ties A to the
EPSG:4326 geographic coordinate system. The rows of A are aligned
with parallels, with even sampling in longitude. Likewise, the columns
of A are aligned with meridians, with even sampling in latitude.
The geographic limits of A span the full latitude and longitude extent
of layer. The larger spatial size of A is chosen to match its larger
geographic dimension and is fixed at the value 512. In other words,
assuming RGB output, A is 512-by-N-by-3 if the latitude extent
exceeds longitude extent and N-by-512-by-3 otherwise. In both cases N
<= 512. N is set to the integer value that provides the closest possible
approximation to equal cell sizes in latitude and longitude, under
the constraint (described earlier) that the map spans the full extent
supported for the layer.
[A, R] = wmsread(mapRequestURL) uses the input argument
mapRequestURL to define the request to the server. The mapRequestURL
string contains a WMS serverURL with additional WMS parameters.
The URL string includes the WMS parameters BBOX and GetMap and
the EPSG:4326 keyword. Obtain a mapRequestURL from the output of
wmsread, the RequestURL property of a WMSMapRequest object, or an
Internet search.
12-775
wmsread
then returns the raster map. The browser opens the returned map if its
mime type is understood, or saves the raster map to disk.
Inputs
layer
12-776
wmsread
Parameter
Data Type
Value
'Latlim'
Two-element
vector
'Lonlim'
Two-element
vector
'ImageHeight'
Scalar,
positive,
integer-valued
number
'ImageWidth'
Scalar,
positive,
integer-valued
number
'CellSize'
Scalar or
two-element
vector
layer.Details.Attributes.
FixedHeight contains a positive number, then
you cannot modify 'ImageHeight'.
12-777
wmsread
Parameter
Data Type
Value
'RelTolCellSize'
Scalar or
two-element
vector
'ImageFormat'
String
'StyleName'
String or
cell array of
strings
'Transparent'
Logical
'BackgroundColor'
Three-element
vector
12-778
wmsread
Parameter
Data Type
Value
'Elevation'
String
'Time'
String or
numeric date
number
'SampleDimension'
Two-element
cell array of
strings
12-779
wmsread
Parameter
Data Type
Value
determines the permissible range of values for
the second element of 'SampleDimension'.
'TimeoutInSeconds'
Definitions
Examples
12-780
wmsread
Courtesy NASA/JPL-Caltech
12-781
wmsread
Drape Landsat imagery onto elevation data from the USGS National
Elevation Dataset (NED) for an area surrounding the Grand Canyon.
Read the 'global_mosaic' and 'us_ned' layers from the Web map
server at the Jet Propulsion Laboratory.
% Obtain the layers of interest.
jpl = wmsfind('jpl.nasa.gov', 'SearchFields', 'serverurl');
jpl = wmsupdate(jpl);
global_mosaic = jpl.refine('global_mosaic', 'MatchType', ...
'exact');
us_ned = jpl.refine('us_ned');
% Assign geographic extent and image size.
latlim = [36 36.23];
lonlim = [-113.36 -113.13];
imageHeight = 575;
imageWidth = 575;
% Read the global_mosaic layer.
[A, R] = wmsread(global_mosaic, 'StyleName', 'visual', ...
'Latlim', latlim, 'Lonlim', lonlim, ...
12-782
wmsread
12-783
wmsread
Read and display a single sequence image from the MODIS instruments
on the Aqua and Terra satellites that shows hurricane Katrina on
August 29, 2005.
% Find the hurricane Katrina sequence layer.
katrina = wmsfind('Hurricane Katrina (Sequence)');
katrina = wmsupdate(katrina(1));
% The Dimension.Extent field shows a sequence delimited
% by commas. The sequence starts on August 24 and ends
% on August 31. The commas start at August 25 and end
% after August 30. Select the sequence corresponding to
% August 29.
commas = findstr(',', katrina.Details.Dimension.Extent);
extent = katrina.Details.Dimension.Extent;
12-784
wmsread
sequence = extent(commas(end-2)+1:commas(end-1)-1);
% Obtain the time, latitude, and longitude limits
% from the values in the sequence. Split the sequence
% into a cell array of values by first finding
% all values between and including the parentheses,
% then remove the parentheses and split the values.
pat = '[(-.\d)]';
r = regexp(sequence, pat);
values = sequence(r);
values = strrep(values, '(', ' ');
values = strrep(values, ')', ' ');
values = regexp(values, '\s', 'split');
values = values(~cellfun('isempty', values));
time = values{1};
xmin = values{2};
ymin = values{3};
xmax = values{4};
ymax = values{5};
% Define latitude and longitude limits from the information
% in the sequence. The layer's geographic extent is assigned
% for the combined set of sequences. The requested map cannot
% be a subset of the layer's bounding box. In this rare case,
% set the layer's limits using the limits of the sequence.
latlim = [str2double(ymin) str2double(ymax)];
lonlim = [str2double(xmin) str2double(xmax)];
katrina.Latlim = latlim;
katrina.Lonlim = lonlim;
% Read and display the sequence map.
[A,R] = wmsread(katrina, 'SampleDimension', ...
{katrina.Details.Dimension.Name, sequence});
figure
usamap(katrina.Latlim,katrina.Lonlim);
geoshow(A,R)
coast = load('coast');
12-785
wmsread
plotm(coast.lat, coast.long)
title({katrina.LayerTitle, time})
See Also
12-786
wmsupdate
Purpose
Syntax
Description
array with its properties synchronized with values from the server. The
input layers contains only one unique ServerURL. Layers no longer
available on the server are removed. The logical array index contains
true for each available layer; therefore, updatedLayers has the same
size as layers(index). Except for deletion, updatedLayers preserves
the same order of layers as layers.
[...] = wmsupdate(layers, param, val, ...) specifies
parameter-value pairs that modify the request. Parameter names can
be abbreviated and are case-insensitive.
Inputs
layers
Modifies the request. See the table below for permissible values.
12-787
wmsupdate
Parameter
Data Type
Value
Default
'TimeoutInSeconds'
Integer-valued,
scalar double
60 seconds
'AllowMultipleServers'
Logical scalar
false
Examples
(indicates
the array
must contain
elements
from the
same server)
Update the layers from the NASA Goddard Space Flight Center WMS
SVS Image Server.
% Search the abstract field of the updated layers
% to find layers containing the term 'blue marble'.
% Read and display the blue marble layer containing the term
% '1024x512' in its LayerTitle.
gsfc = wmsfind('svs.gsfc.nasa.gov', 'SearchField', 'serverurl');
gsfc = wmsupdate(gsfc);
blue_marble = gsfc.refine('blue marble', 'SearchField', ...
'abstract');
blueMarbleQuery = '1024x512';
layer = blue_marble.refine(blueMarbleQuery);
% Display the layer.
[A, R] = wmsread(layer);
figure
12-788
wmsupdate
worldmap world
plabel off; mlabel off
geoshow(A, R);
title(layer.LayerTitle)
Update the properties of all the layers from the NASA servers.
nasa = wmsfind('nasa', 'SearchField', 'serverurl');
nasa = wmsupdate(nasa, 'AllowMultipleServers', true);
See Also
12-789
worldfileread
Purpose
Syntax
R = worldfileread(worldfilename)
Description
Example
R = worldfileread('concord_ortho_w.tfw')
R =
1.0e+005 *
0
0.000010000000000
2.069995000000000
See Also
12-790
-0.000010000000000
0
9.130005000000001
worldfilewrite
Purpose
Syntax
worldfilewrite(R, worldfilename)
Description
Example
R = worldfileread('concord_ortho_w.tfw');
worldfilewrite(R,'concord_ortho_w_test.tfw');
See Also
12-791
worldmap
Purpose
Syntax
worldmap region
worldmap(region)
worldmap
worldmap(latlim, lonlim)
worldmap(Z, R)
h = worldmap(...)
Description
with projection and limits suitable to the part of the world specified in
region. region can be a string or a cell array of strings. Permissible
12-792
worldmap
For cylindrical projections, worldmap uses tightmap set the axis limits
tight around the map. If you change the projection, or just want more
white space around the map frame, use tightmap again or axis auto.
Examples
Example 1
Set up a world map and draw coarse coastlines:
worldmap('World')
load coast
plotm(lat, long)
Example 2
Set up worldmap with land areas, major lakes and rivers, and cities
and populated places:
ax = worldmap('World');
setm(ax, 'Origin', [0 180 0])
land = shaperead('landareas', 'UseGeoCoords', true);
geoshow(ax, land, 'FaceColor', [0.5 0.7 0.5])
lakes = shaperead('worldlakes', 'UseGeoCoords', true);
geoshow(lakes, 'FaceColor', 'blue')
rivers = shaperead('worldrivers', 'UseGeoCoords', true);
geoshow(rivers, 'Color', 'blue')
cities = shaperead('worldcities', 'UseGeoCoords', true);
geoshow(cities, 'Marker', '.', 'Color', 'red')
12-793
worldmap
Example 3
Draw a map of Antarctica:
worldmap('antarctica')
antarctica = shaperead('landareas', 'UseGeoCoords', true,...
'Selector',{@(name) strcmp(name,'Antarctica'), 'Name'});
patchm(antarctica.Lat, antarctica.Lon, [0.5 1 0.5])
Example 4
Draw a map of Africa and India with major cities and populated places:
worldmap({'Africa','India'})
land = shaperead('landareas.shp', 'UseGeoCoords', true);
geoshow(land, 'FaceColor', [0.15 0.5 0.15])
cities = shaperead('worldcities', 'UseGeoCoords', true);
geoshow(cities, 'Marker', '.', 'Color', 'red')
Example 5
Make a map of the geoid over South America and the central Pacific:
worldmap([-50 50],[160 -30])
load geoid
12-794
worldmap
Example 6
Draw a map of terrain elevations in Korea:
load korea
h = worldmap(map, refvec);
set(h, 'Visible', 'off')
geoshow(h, map, refvec, 'DisplayType', 'texturemap')
colormap(demcmap(map))
Example 7
Make a map of the United States of America, coloring state polygons:
ax = worldmap('USA');
load coast
geoshow(ax, lat, long,...
'DisplayType', 'polygon', 'FaceColor', [.45 .60 .30])
states = shaperead('usastatelo', 'UseGeoCoords', true);
faceColors = makesymbolspec('Polygon',...
{'INDEX', [1 numel(states)], 'FaceColor', ...
polcmap(numel(states))}); % NOTE - colors are random
12-795
worldmap
See Also
12-796
wrapTo180
Purpose
Syntax
lonWrapped = wrapTo180(lon)
Description
-180. (In general, odd, positive multiples of 180 map to 180 and odd,
negative multiples of 180 map to -180.)
See Also
12-797
wrapTo360
Purpose
Syntax
lonWrapped = wrapTo360(lon)
Description
See Also
12-798
wrapTo2Pi
Purpose
Syntax
lambdaWrapped = wrapTo2Pi(lambda)
Description
See Also
12-799
wrapToPi
Purpose
Syntax
lambdaWrapped = wrapToPi(lambda)
Description
See Also
12-800
zdatam
Purpose
Syntax
zdatam
zdatam(hndl)
zdatam('str')
zdatam(hndl,zdata)
zdatam(str,zdata)
Description
zdatam displays a GUI for selecting an object from the current axes
and modifying its ZData property.
zdatam(hndl) and zdatam('str') display a GUI to modify the ZData
of the object(s) specified by the input. str is any string recognized by
handlem.
zdatam(hndl,zdata) alters the z-plane position of displayed map
objects designated by the MATLAB graphics handle hndl. The z-plane
position may be the Z position in the case of text objects, or the ZData
property in the case of other graphic objects. The function behaves
as follows:
12-801
zdatam
See Also
12-802
handlem, setm
zero22pi
Purpose
Syntax
Description
newlon = zero22pi(lon)
newlon = zero22pi(lon,angleunits)
newlon = zero22pi(lon) wraps the input angle lon in degrees to the 0
Examples
zero22pi(567.5)
ans =
207.5
zero22pi(-567.5)
ans =
152.5
zero22pi(-7.5,'radian')
ans =
5.0664
See Also
wrapTo2Pi, wrapTo360
12-803
zerom
Purpose
Syntax
[Z,refvec] = zerom(latlim,lonlim,scale)
Description
Examples
[Z,refvec] = zerom([46,51],[-79,-75],1)
Z =
0
0
0
0
0
refvec =
1
See Also
12-804
0
0
0
0
0
0
0
0
0
0
51
-79
0
0
0
0
0
axesm, axesmui
Purpose
Activation
Define map axes and modify map projection and display properties
Command Line
Maptool
Map Display
axesm
extend-click map
display
axesmui
c =
axesmui(...)
Description
12-805
axesm, axesmui
Controls
=
=
=
=
=
=
=
=
Cylindrical
Pseudocylindrical
Conic
Polyconic
Pseudoconic
Azimuthal
Modified Azimuthal
Pseudoazimuthal
The Zone button and edit box are used to specify the UTM or UPS zone.
For non-UTM and UPS projections, the two are disabled.
The Geoid edit boxes and pull-down menu are used to specify the geoid.
Units must be in meters for the UTM and UPS projections, since this
is the standard unit for the two projections. For non-UTM and UPS
12-806
axesm, axesmui
projections, the geoid unit can be anything, bearing in mind that the
resulting projected data will be in the same units as the geoid.
The Angle Units pull-down menu is used to specify the angle units
used on the map projection. All angle entries corresponding to the
current map projection must be entered in these units. Current angle
entries are automatically updated when new angle units are selected.
The Map Limits edit boxes are used to specify the extent of the map
data in geographic coordinates. The Latitude edit boxes contain the
southern and northern limits of the map. The Longitude edit boxes
contain the western and eastern limits of the map. The map limits
establish the extent of the meridian and parallel grid lines, regardless
of the display settings (see grid settings). Map limits are always in
geographic coordinates, regardless of the map origin and orientation
setting. In the normal aspect, the map display is trimmed to the
minimum of the map and frame limits.
The Frame Limits edit boxes are used to specify the location of the
map frame, measured from the center of the map projection in the base
coordinate system. The Latitude edit boxes contain the southern and
northern frame edge locations. The Longitude edit boxes contain
the western and eastern frame edge locations. Displayed map data
are trimmed at the frame limits. For azimuthal map projections, the
latitude limits should be set to inf and the desired trim distance from
the map origin. In the normal aspect, the map display is trimmed to the
minimum of the map and frame limits.
The Map Origin edit boxes are used to specify the origin and aspect
angle of the map projection. The Lat and Long boxes specify the map
origin in geographic coordinates. This is the point that is placed in the
center of the projection. If either box is left blank, 0 degrees is used.
The Orientation box specifies the azimuth angle of the North Pole
relative to the map origin. Azimuth is measured clockwise from the top
of the projection. If the Orientation box is disabled, then the selected
map projection requires a fixed orientation. See the Mapping Toolbox
Users Guide for a complete description of the map origin.
12-807
axesm, axesmui
The Cartesian Origin edit boxes are used to specify the x-y offset,
along with a desired scale factor of the map projection. The False E and
N boxes specify the false easting and northing in Cartesian coordinates.
These must be in the same units as the geoid. The Scalefactor box
specifies the scale factor used in the map projection calculations.
The Parallels edit boxes specify the standard parallels of the selected
map projection. A particular map projection may have one or two
standard parallels. If the edit boxes are disabled, then the selected
projection has no standard parallels or the standard parallels are fixed.
The Aspect pull-down menu is used to select a normal or transverse
display aspect. When the aspect is normal, north (on the base
projection) is up, and the map is displayed in a portrait setting. In a
transverse aspect, north (in the base projection) is to the right, and the
map is displayed in a landscape setting. This property does not control
the map projection aspect. The projection aspect is determined by the
map Origin property).
The Frame button brings up the Map Frame Properties dialog box,
which allows the map frame settings to be modified.
The Grid button brings up the Map Grid Properties dialog box, which
allows the map grid settings to be modified.
The Labels button brings up the Map Label Properties dialog box,
which allows the parallel and meridian label settings to be modified.
The Fill in button is used to compute projection and display settings
based on any currently specified map parameters. Only settings that
are left blank are affected when this button is pushed.
The Reset button is used to reset the default projection properties and
display settings of the current map. Default display settings include
frame, grid, and label properties set to 'off'.
The Apply button is used to apply the projection and display settings to
the current map, which results in the map being reprojected.
The Help button is used to bring up online help text for each control on
the Projection Control dialog box.
12-808
axesm, axesmui
12-809
axesm, axesmui
are applied to the current map only when the Apply button on the
Projection Control dialog box is pushed.
The Cancel button disregards any modifications to the map frame
properties and returns to the Projection Control dialog box.
The Grid selection buttons determine whether the map grid is visible.
The Color pull-down menu is used to select the color of the map grid
lines. Selecting custom allows a custom RGB triple to be defined for
the grid line color.
The Style pull-down menu is used to select the line style of the map
grid lines.
The Line Width edit box is used to enter the width of the map grid
lines, in points.
The Grid Altitude edit box is used to enter z-axis location of the map
grid. This property can be used to place some mapped objects above or
below the map grid. The default map grid altitude is inf, which places
the grid above all other mapped objects.
12-810
axesm, axesmui
12-811
axesm, axesmui
12-812
axesm, axesmui
Grid Properties dialog box. Changes are applied to the current map only
when the Apply button on the Projection Control dialog box is pushed.
The Cancel button disregards any modifications to the meridian and
parallel grid lines and returns to the Map Grid Properties dialog box.
12-813
axesm, axesmui
The label Units pull-down menu is used to specify the angle units
used to display the parallel and meridian labels. These units, used
for display purposes only, need not be the same as the angle units of
the map projection.
The Font edit box is used to specify the character font used to display
the parallel and meridian labels. If the font specified does not exist on
the computer, the default of Helvetica is used. Pressing the Font
button previews the selected font.
The font Size edit box is used to enter an integer value that specifies
the font size of the parallel and meridian labels. This value must be in
the units specified by the font Units pull-down menu.
The font Color pull-down menu is used to select the color of the parallel
and meridian labels. Selecting custom allows a custom RGB triple to
be defined for the labels.
The font Weight pull-down menu is used to specify the character weight
of the parallel and meridian labels.
The font Units pull-down menu is used to specify the units used to
interpret the font size entry. When set to normalized, the value entered
in the Size edit box is interpreted as a fraction of the height of the
axes. For example, a normalized font size of 0.1 sets the label text to a
height of one tenth of the axes height.
The font Angle pull-down menu is used to select the character slant
of the parallel and meridian labels. normal specifies nonitalic font.
italic and oblique specify italic font.
The Meridian and Parallel Settings button brings up the Meridian
and Parallel Label Properties dialog box, which allows modification of
properties specific to the meridian and parallel grid labels.
The Accept button accepts any modifications that have been made to
the map label properties and returns to the Projection Control dialog
box. Changes are applied to the current map only when the Apply
button on the Projection Control dialog box is pushed.
12-814
axesm, axesmui
The Cancel button disregards any modifications to the map labels and
returns to the Projection Control dialog box.
12-815
axesm, axesmui
12-816
axesm, axesmui
The Cancel button disregards any modifications to the map geoid and
returns to the Projection Control dialog box.
See Also
axesm
12-817
clmo-ui
Purpose
Activation
Command Line
Maptool
clmo
Description
clmo brings up a Select Object dialog box for selecting mapped objects
Controls
The scroll box is used to select the desired objects from the list of
mapped objects.
to delete.
Pushing the Select all button highlights all objects in the scroll box for
selection. Pushing the OK button deletes the selected objects from the
map. Pushing the Cancel button aborts the operation.
See Also
12-818
clmo
clrmenu
Purpose
Activation
Command Line
clrmenu
clrmenu(h)
Description
Controls
12-819
clrmenu
colormap to the current figure. The number of land and sea colors in
the colormap is appropriate for the maximum elevations and depths of
the data grid. The dialog box is shown and described below:
The Mode selection buttons are used to specify whether the length
of the colormap is specified or whether the altitude range increment
assigned to each color is specified.
The Map variable edit box is used to specify the data grid containing
the elevation data.
The Color Map Size edit box is used in Size mode. This entry defines
the length of the colormap. If omitted, a default length of 64 is used.
This entry must be a scalar value.
The Altitude Range edit box is used in Range mode. This entry
defines the altitude range increment assigned to each color. If omitted,
a default increment of 100 is used. This entry must be a scalar value.
The RGB Sea edit box is used to define colors for data with negative
values. The actual sea colors of the generated colormap are interpolated
from this matrix. This entry can be a matrix of any length (n by 3). The
colormap matrix of the current figure can be used by entering the string
'window' in this box. The demcmap function provides default sea colors,
which are used if this entry is left blank.
12-820
clrmenu
The RGB Land edit box is used to define colors for data with
positive values. The actual land colors of the generated colormap are
interpolated from this matrix. This entry can be a matrix of any length
(n by 3). The colormap matrix of the current figure can be used by
entering the string 'window' in this box. The demcmap function provides
default sea colors, which are used if this entry is left blank.
Pressing the Apply button accepts the input data, creates the colormap,
and assigns it to the current figure.
Pressing the Cancel button disregards any input data and closes the
DEM Color Map Input dialog box.
See Also
colorm, demcmap
12-821
colorm
Purpose
Activation
Command Line
colorm(datagrid,refvec)
Description
Controls
12-822
colorm
The colorm tool displays the surface map data in a new figure window
with the current colormap. Zoom and Colormaps menus are activated
for that figure.
The Zoom On/Off menu toggles the panzoom box on and off. The box
can be moved by clicking the new location or by dragging the box to the
new location. The box size can be increased or decreased by dragging
a corner of the box. Pressing the Return key or double-clicking in the
center of the box zooms in.
The Colormaps menu provided a variety of colormap options that can
be applied to the map. See clrmenu in this guide for a description of the
Colormaps menu options.
The Load button activates a dialog box, used to specify a colormap
variable to be applied to the displayed surface map. This colormap can
then be edited and saved.
The Select button activates the mouse cursor and allows a point on the
map to be selected. The value of that point then appears in the Codes
pull-down menu. The color of the selected point appears in the Color
pull-down menu and can then be edited.
The Codes pull-down menu is used to select a particular value in the
data grid. The color associated with that value then appears in the
Color pull-down menu and can be edited.
The Color pull-down menu is used to select a particular color to assign
to the value currently displayed in the Codes pull-down menu. A custom
color can be defined by selecting the custom option. This brings up a
custom color interface with which an RGB triple can be selected.
The Save button is used to save the modified colormap to the workspace.
A dialog box appears in which the colormap variable name is entered.
See Also
12-823
demdataui
Purpose
Activation
demdataui
Description
data from a number of external data files. You can extract data to
MAT-files or the base workspace as regular data grids with referencing
vectors.
The demdataui panel lets you read data from a variety of high-resolution
digital elevation maps (DEMs). These DEMs range in resolution from
about 10 kilometers to 100 meters or less. The data files are available
over the Internet at no cost, or (in some cases) on CD-ROMs for varying
fees. demdataui reads ETOPO5, TerrainBase, GTOPO30, GLOBE,
satellite bathymetry, and DTED data. See the links under See Also
for more information on these data sets. demdataui looks for these
geospatial data files on the MATLAB path and, for some operating
systems, on CD-ROM disks.
You use the list to select the source of data and the map to select the
region of interest. When you click the Get button, data is extracted
and displayed on the map. Use the Save button to save the data in a
MAT-file or to the base workspace for later display. The Close button
closes the window.
12-824
demdataui
Controls
The Map
The map controls the geographic extent of the data to be extracted.
demdataui extracts data for areas currently visible on the map. Use
the mouse to zoom in or out to the area of interest. See zoom for more
on zooming.
Some data sources divide the world up into tiles. When extracting,
data is concatenated across all visible tiles. The map shows the tiles
in light yellow with light gray edges. When data resolution is high,
extracting data for large area can take much time and memory. An
approximate count of the number of points is shown above the map. Use
the Samplefactor slider to reduce the amount of data.
The List
The list controls the source of data to be extracted. Click a name to see
the geographic coverage in light yellow. The sources list shows the data
sources found when demdataui started.
12-825
demdataui
12-826
demdataui
See Also
12-827
handlem-ui
Purpose
Activation
Command Line
h = handlem
h = handlem('prompt')
Description
Controls
12-828
handlem-ui
The scroll box is used to select the desired objects from the list of mapped
objects. Pushing the Select all button highlights all objects in the scroll
box for selection. Pushing the OK button returns the object handles in
the variable h. Pushing the Cancel button aborts the operation.
Specify Object Dialog Box
The Object Controls are used to select an object type or tag. The Name
pull-down menu is used to select from a list of predefined object strings.
The Other Tag edit box is used to specify an object tag not listed in
the Name pull-down menu. Pushing the Select button brings up the
Select Object dialog box, which shows only the currently displayed
objects for selection.
The Match Controls are used when a Handle Graphics object type
(image, line, surface, patch, or text) is specified. The Untagged
Objects selection button is used to return the handles of only those
objects with empty tag properties. The All Objects selection button is
12-829
handlem-ui
See Also
12-830
handlem
hidem-ui
Purpose
Activation
Description
Command Line
Maptool
hidem
hidem brings up a Select Object dialog box for selecting mapped objects
to hide (Visible property set to 'off').
Controls
The scroll box is used to select the desired objects from the list of mapped
objects. Pushing the Select all button highlights all objects in the scroll
box for selection. Pushing the OK button changes the Visible property
of the selected objects to 'off'. Pushing the Cancel button aborts the
operation without changing any properties of the selected objects.
See Also
hidem
12-831
lightmui
Purpose
Syntax
lightmui(hax)
Description
See Also
12-832
lightm
maptool
Purpose
Activation
Command Line
maptool(PropertyName,PropertyValue)
maptool(ProjectionFile,...)
h = maptool(...)
Description
maptool creates a figure window with a map axes and activates the
Projection Control dialog box for defining map projection and display
properties. The figure window features a special menu bar that provides
access to most of Mapping Toolbox GUIs.
maptool(PropertyName,PropertyValue,...) creates a figure
window with a map axes defined by the supplied map properties. The
MapProjection property must be the first input pair. maptool supports
the same map properties as axesm.
maptool(ProjectionFile,PropertyName, PropertyValue,...)
allows for the omission of the MapProjection property name.
ProjectionFile must be the identifying string of an available map
projection.
h = maptool(...) returns a two-element vector containing the handle
of the maptool figure window and the handle of the map axes.
12-833
maptool
Controls
Session Menu
The Load option is used to load workspace data. Select from the
workspace names provided, or use the Specify Workspace option to
enter a different workspace.
The Layers option is used to load a map layers workspace and activate
the mlayers tool. Select from the workspace names provided, or use the
Other option to enter a different workspace. Choosing Workspace
loads all structure variables in the current workspace.
The Renderer option is used to set the renderer for the maptool figure
window. The Figure Renderer dialog box is activated when this option
is selected.
The Variables option is used to view the current workspace variables.
The Command option brings up the Workspace Commands dialog box
for entering commands to operate on the current workspace.
The Clear option is used to clear variables and functions from memory.
12-834
maptool
Map Menu
The Lines option activates the Line Map Input dialog box for projecting
two- and three-dimensional line objects onto the map axes.
The Patches option activates the Patch Map Input dialog box for
projecting patch objects onto the map axes.
The Regular Surfaces option activates the Mesh Map Input dialog
box for projecting a regular data grid onto a graticule projected onto
the map axes.
The General Surfaces option activates the Surface Map Input dialog
box for projecting a geolocated data grid onto the map axes.
The Comet option activates the Comet Map Input dialog box for a
projecting two- or three-dimensional comet plot onto the map axes.
The Contours option activates the Contour Map Input dialog box for
projecting a two- or three-dimensional contour plot onto the map axes.
The Quiver 2D option activates the Quiver Map Input dialog box for
projecting a two-dimensional quiver plot onto the map axes.
The Quiver 3D option activates the Quiver3 Map Input dialog box for
projecting a three-dimensional quiver plot onto the map axes.
The Stem option activates the Stem Map Input dialog box for projecting
a stem plot onto the map axes.
The Scatter option activates the Scatter Map Input dialog box for
projecting a scatter plot onto the map axes.
The Text option activates the Text Map Input dialog box for projecting
text objects onto the map axes.
The Light option activates the Light Map Input dialog box for projecting
light objects onto the map axes.
Display Menu
The Projection option activates the Projection Control dialog box for
editing map projection properties and map display settings.
12-835
maptool
The Graticule option is used to view and edit the graticule size for
surface maps.
The Legend option is used to display a contour map legend.
The Frame option is used to toggle the map frame on and off.
The Grid option is used to toggle the map grid on and off.
The Meridian Labels option is used to toggle the meridian grid labels
on and off.
The Parallel Labels option is used to toggle the parallel grid labels
on and off.
The Tracks option activates the Define Tracks input box for calculating
and displaying Great Circle and Rhumb Line tracks on the map axes.
The Small Circles option activates the Define Small Circles input box
for calculating and displaying small circles on the map axes.
The Surface Distances option activates the Surface Distance dialog
box for distance, azimuth, and reckoning calculations.
Tools Menu
The Hide option is used to hide the mouse tool buttons.
The Off option is used to turn off the current mouse tool.
The Zoom Tool option is used to toggle Panzoom (panzoom) mode on
and off. It is used for zooming in on a two-dimensional map display.
The Set Limits option is used to define the zoom out limits to the
current settings on the axes.
The Full View option is used to zoom out to the current axes limit
settings.
The Rotate option is used to toggle Rotate 3-D (rotate3d) mode on
and off. Rotate 3-D mode is used to interactively rotate the view of
a three-dimensional plot.
The Origin option is used to toggle Origin (originui) mode on and off.
Origin mode is used to interactively modify the map origin.
12-836
maptool
Colormaps Menu
The Colormaps menu allows for manipulation of the colormap for
the current figure. See the clrmenu reference page for details on the
Colormaps menu options.
The Zoom button toggles Zoom mode on and off. Zoom mode is used for
zooming in on a two-dimensional map display.
The Rotate button toggles Rotate 3-D mode on and off. Rotate 3-D
mode is used to interactively rotate the view of a three-dimensional plot.
12-837
maptool
The Origin button toggles Origin mode on and off. Origin mode is used
to interactively modify the map origin.
See Also
12-838
axesm
maptrim
Purpose
Activation
Interactively trim and convert map data from vector to raster format
Command Line
maptrim(lat,lon)
maptrim(lat,lon,linespec)
maptrim(datagrid,refvec)
maptrim(datagrid,refvec,PropertyName,PropertyValue,...)
Description
12-839
maptrim
Controls
The maptrim tool displays the supplied map data in a new figure window
and activates a Customize menu for that figure. The Customize menu
has three menu options: Zoom On/Off, Limits, and Save As.
The Zoom On/Off menu option toggles the panzoom box on and off.
The box can be moved by clicking the new location or by dragging the
box to the new location. The box size can be increased or decreased by
dragging a corner of the box. Pressing the Return key or double-clicking
in the center of the box zooms in.
The Limits menu option activates the Enter Map Limits dialog
box, which is used to enter the latitude and longitude limits of the
desired map subset. These entries are two-element vectors, enclosed in
brackets. Pressing the OK button zooms in to the new limits. Pressing
the Cancel button disregards the new limits and returns to the map
display.
12-840
maptrim
See Also
12-841
mlayers
Purpose
Activation
Command Line
Maptool
mlayers('filename')
mlayers('filename',h)
mlayers(cellarray)
mlayers(cellarray,h)
Description
the current map axes. The display structure variables are accessible
only through the mlayers tool, and not through the base workspace.
filename must be a string.
mlayers('filename',h) assigns the layers found in filename to the
map axes indicated by the handle h.
mlayers(cellarray) associates the layers specified by cellarray with
the current map axes. cellarray must be of size n by 2. Each row
of cellarray represents a map layer. The first column of cellarray
contains the layer structure, and the second column contains the name
of the layer structure. Such a cell array can be generated from data in
the current workspace with the function rootlayr. In this case, the
calling sequence would be rootlayr; mlayers(ans).
mlayers(cellarray,h) assigns the layers specified by cellarray to
the map axes specified by the handle h.
12-842
mlayers
Controls
The scrollable list box displays all of the map layers currently associated
with the map axes. An asterisk next to the layer name indicates that
the layer is currently visible. An h next to the layer name indicates a
layer that is plotted, but currently hidden.
The Plot button plots the selected map layer. Once the selected layer
is plotted, the button toggles between Hide and Show, to turn the
Visible property of the plotted objects to 'off' and 'on', respectively.
The Zdata button activates the Specify Zdata dialog box, which is used
to enter the workspace variable containing the ZData for the selected
map layer. Pressing the List button produces a list of all current
workspace variables, from which the ZData variable can be selected.
This entry can also be a scalar.
The Highlight button is used to toggle the selected map layer between
highlighted and normal display.
The Members button brings up a list of members of the selected map
layer. Members of a layer are defined by their Tag property.
12-843
mlayers
The Delete button deletes the selected map layer from the map.
The Emode button activates the Layer Erase Mode dialog box, which is
used to specify the erase mode of the selected map layer.
The Property button activates the Define Layer Properties dialog box,
which is used to specify or change properties of all objects in the selected
map layer. String entries must be enclosed in single quotes.
The Purge button deletes the selected map layer from the mlayers
tool. Selecting Yes from the Confirm Purge dialog box deletes the map
layer from both the mlayers tool and the map display. Selecting Data
Only from the Confirm Purge dialog box deletes the map layer from the
mlayers tool, while retaining the plotted object on the map display.
See Also
12-844
mobjects, rootlayr
mobjects
Purpose
Activation
Command Line
Maptool
mobjects
mobjects(h)
Description
An object set is defined as all objects with identical tags. If no tags are
supplied, object sets are defined by object type.
mobjects allows manipulation of the object sets on the current map
axes.
mobjects(h) allows manipulation of the objects set on the map axes
specified by the handle h.
Controls
The scrollable list box displays all of the object sets associated with the
map axes. An asterisk next to an object set name indicates that the
object set is currently visible. An h next to an object set name indicates
an object set that is plotted, but currently hidden. The order shown in
the list indicates the stacking order of objects within the same plane.
12-845
mobjects
12-846
mobjects
The Update button updates the list box display with current objects
sets.
The Stacking Order buttons are used to modify the drawing order
of the selected object set in relation to other plotted object sets in the
same plane. Objects drawn first appear at the bottom of the stack, and
objects drawn last appear at the top of the stack. The Top button places
the selected object set above all other object sets in its plane. The Up
and Dwn buttons move the selected object set up and down one place in
the stacking order, respectively. The Btm button places the selected
object set below all other object sets in its plane. Note that the ZData
property overrides stacking order, i.e., if an object is at the top of the
stacking order for its plane, it can still be covered by an object drawn in
a higher plane.
See Also
mlayers
12-847
originui
Purpose
Activation
Command Line
Maptool
originui
originui on
originui off
Description
Controls
Keystrokes
originui recognizes the following keystrokes. Enter (or Return) will
reproject the map with the identified origin and remain in the originui
mode. Delete and Escape will exit the origin mode (same as originui
off). N,S,E,W keys move the marker North, South, East or West by
10.0 degrees for each keystroke. n,s,e,w keys move the marker in the
respective directions by 1 degree per keystroke.
Mouse Actions
originui recognizes the following mouse actions when the cursor is on
12-848
originui
See Also
axesm, setm
12-849
panzoom
Purpose
Activation
Command Line
Maptool
panzoom
panzoom on
panzoom off
panzoom setlimits
panzoom out
panzoom fullview
Description
The pan and zoom tool provides an interactive means of defining zoom
limits on a two-dimensional map display. A box that can be resized and
moved appears on the map display and is used to define the zoom area.
The box cannot be moved beyond the current axes limits.
Controls
Mouse Interaction
With the cursor inside the zoom box, a single-click and drag moves the
box. The zoom box can be resized by dragging the corners of the box. A
double-click in the center of the box zooms in to the current boundaries
of the box. A single-click outside the zoom box moves the box to that
12-850
panzoom
Keyboard Interaction
The following keyboard interaction is enabled if the figure containing
the map axes is made the active window.
Pressing the Return key sets the axes to the current zoom box and
remains in pan and zoom mode. The Enter key sets the axes to the
current zoom box and exits pan and zoom mode. Pressing the Esc or
Delete keys exits pan and zoom mode.
See Also
zoom
12-851
parallelui
Purpose
Activation
Command Line
Maptool
parallelui
parallelui on
parallelui off
Description
Controls
Mouse Interaction
A single-click-and-drag moves the parallel lines. A double-click on one
of the standard parallels reprojects the map using the new parallel
locations.
See Also
12-852
axesm, setm
property editors
Purpose
Activation
map display:
maptool:
Description
Controls
12-853
property editors
Property values that appear on the right side of the editor box are
modified by clicking and dragging. For example, to change the
MarkerColor property of a line object, click and hold the dot next to
MarkerColor, and drag the cursor until the dot appears in the desired
color.
The Drag control in the text editor is used to reposition the text string.
In drag mode, use the mouse to move the text to a new location, and
click to reposition the text. The Edit control in the text editor activates
a Text Edit window, which is used to modify text.
12-854
property editors
The Marker property name in the patch editor is used to toggle the
marker on and off. The property value to the right of Marker can be
modified by clicking and dragging until the desired marker symbol
appears.
12-855
property editors
12-856
property editors
See Also
12-857
qrydata
Purpose
Activation
Command Line
qrydata(cellarray)
qrydata(titlestr,cellarray)
qrydata(h,cellarray)
qrydata(h,titlestr,cellarray)
qrydata(...,cellarray1,cellarray2,...)
Description
12-858
qrydata
The 'vector' query uses the interp2 function to find the value of the
matrix Z at the input (x,y) point, then uses that value as an index to
a data vector. The value of the data vector at that index is returned
by the query. The format of cellarray for this type of query is:
{'label','vector',X,Y,Z, vector}. X and Y are matrices specifying
the points at which the data Z is given. The rows and columns of X and
Y must be monotonic. vector is the data vector.
The 'mapmatrix' query interpolates to find the value of the map at
the input (lat,lon) point. The format of cellarray for this query is:
{'label','mapmatrix',datagrid,refvec,method}. datagrid and
refvec are the data grid and the corresponding referencing vector.
method is an optional argument that specifies the interpolation method.
Possible method strings are 'nearest', 'linear', or 'cubic'. The
default is 'nearest'.
The 'mapvector' query interpolates to find the value of the map
at the input (lat,lon) point, then uses that value as an index to
a data vector. The value of the vector at that index is returned
by the query. The format of cellarray for this type of query is
{'label','mapvector',datagrid,refvec, vector}. datagrid and
refvec are the data grid and the corresponding referencing vector.
vector is the data vector.
User-defined query operations allow for functional operations using the
input (x,y) or (lat,lon) coordinates. The format of cellarray for this
type of query is {'label',function,other arguments...} where the
other arguments are the remaining elements of cellarray as in the four
predefined operations above. function is a user-created function and
must refer to an M-file of the form z = fcn(x,y,other_arguments...).
12-859
qrydata
cell arrays. This allows more than one data query to be performed on a
given point.
Controls
Examples
12-860
qrydata
Create the M-file qrytest on your path, and in it put the following code:
function cityname = qrytest(lt, lg, lat, lon, mat)
% function QRYTEST returns city name for mouse click
% QRYTEST will find the closest city (min radius) from
% the mouse click, within an angle of 5 degrees.
%
latdiff = lt-lat;
londiff = lg-lon;
rad = sqrt(latdiff.^2+londiff.^2);
[minrad,index] = min(rad);
if minrad > 5
index = [];
end
switch length(index)
case 0, cityname = 'No city located near click';
case 1, cityname = mat(index,:);
end
12-861
qrydata
Clicking the mouse over a city marker displays the name of the selected
city. Clicking the mouse in an area away from any city markers displays
the string 'No city located near click'.
See Also
12-862
interp2
scirclui
Purpose
Activation
Command Line
Maptool
scirclui
scirclui(h)
Description
scirclui activates the Define Small Circles dialog box for adding small
circles to the current map axes.
scirclui(h) activates the Define Small Circles dialog box for adding
small circles to the map axes specified by the axes handle h.
12-863
scirclui
Controls
The Style selection buttons are used to specify whether the circle radius
is a constant great circle distance or a constant rhumb line distance.
The Mode selection buttons are used to specify whether one point or
two points are to be used in defining the small circle. If one-point mode
is selected, a center point, radius, and azimuth are the required inputs.
If two-point mode is selected, a center point, and perimeter point on
the circle are the required inputs.
The Center Point controls are used in both one-point and two-point
mode. The Lat and Lon edit boxes are used to enter the latitude and
longitude of the center point of the small circle to be displayed. These
values must be in degrees. To display more than one small circle, a
vector of values can be entered, enclosed in brackets in each edit box.
Pushing the Lat or Lon button brings up an expanded edit box for
12-864
scirclui
easier entry of long vectors. The Mouse Select button is used to select
a center point by clicking the displayed map. The coordinates of the
selected point then appear in the Lat and Lon edit boxes and can be
modified. The coordinates appear in degrees, regardless of the angle
units defined for the current map projection.
The Circle Point controls are used only in two-point mode. The Lat
and Lon edit boxes are used to enter the latitude and longitude of a
point on the perimeter of the small circle to be displayed. These values
must be in degrees. To display more than one small circle, a vector of
values can be entered, enclosed in brackets in each edit box. Pushing
the Lat or Lon button brings up an expanded edit box for easier entry
of long vectors. The Mouse Select button is used to select a perimeter
point by clicking the displayed map. The coordinates of the selected
point then appear in the Lat and Lon edit boxes and can be modified.
The coordinates appear in degrees, regardless of the angle units defined
for the current map projection.
The Size and Sector controls are used only in one-point mode. The
Radius Units button brings up a Define Radius Units dialog box,
which allows for modification of the small circle radius units and the
normalizing geoid. The Rad edit box is used to enter the radius of the
small circle in the proper units. The Arc edit box is used to specify
the sector azimuth, measured in degrees, clockwise from due north. If
the entry is omitted, a complete small circle is drawn. When entering
radius and arc data for more than one small circle, vectors of values,
enclosed in brackets, are entered in each edit box. Pushing the Rad or
Arc button brings up an expanded edit box for that entry, which is
useful for entering long vectors.
The Z Plane edit box is used to enter a scalar value that specifies the
plane in which to display the small circles.
The Other Properties edit box is used to specify additional properties
of the small circles to be projected, such as 'Color','b'. String entries
must be enclosed in quotes.
Pressing the Apply button accepts the input data and displays the
small circles on the current map axes.
12-865
scirclui
Pressing the Cancel button disregards any input data and closes the
Define Small Circles dialog box.
This dialog box, available only in one-point mode, allows for modification
of the small circle radius units and the normalizing geoid.
The Radius Units pull-down menu is used to select the units of the
small circle radius. The unit selected is displayed near the top of the
Define Small Circles dialog box, and all latitude and longitude entries
must be entered in these units. Users must also be sure to specify
the normalizing geoid in the same units. If radians are selected, it is
assumed the radius entry is a multiple of the radius used to display the
current map, as defined by the map geoid property.
The Normalizing Geoid edit box is used modify the radius used to
normalize the small circle radius to a radian value, which is necessary
for proper calculations and map display. This entry must be in the
same units as the small circle radius. If the small circle radius units
are in radians, then the normalizing geoid must be the same as the
geoid used for the current map axes.
Pressing the Cancel button disregards any modifications and closes the
Define Radius Units dialog box.
Pressing the Apply button accepts any modifications and returns to the
Define Small Circles dialog box.
See Also
12-866
scircle1, scircle2
seedm
Purpose
Activation
Command Line
seedm(datagrid,refvec)
Description
window and allows for seeds to be specified and the encoded map
generated. The encoded map can then be saved to the workspace. map is
the data grid and must consist of positive integer index values. refvec
is the referencing vector of the surface.
12-867
seedm
Controls
The Zoom On/Off menu toggles the zoom box on and off. The box can
be moved by clicking the new location or by dragging the box to the
new location. The box size can be increased or decreased by dragging
a corner of the box. Pressing the Return key or double-clicking in the
center of the box zooms in to the box limits.
The Colormaps menu provides a variety of colormap options that can
be applied to the map. See clrmenu in this guide for a description of the
Colormaps menu options.
The Get button allows mouse selection of points on the map to which
seeds are assigned. The number of points to be selected is entered in
12-868
seedm
the # of Seeds edit box. The value of the seed is entered in the Value
edit box. This seed value is assigned to each point selected with the
mouse. The Get button is pressed to begin mouse selection. After all
the points have been selected, the Fill In button is pressed to perform
the encoding operation. The region containing the seed point is filled in
with the seed value. The Reset button is used to disregard all points
selected with the mouse before the Fill In button is pressed.
Alternatively, specific map values can be globally replaced by using the
From/To edit boxes. The value to be replaced is entered in the first
edit box, and the new value is entered in the second edit box. Pressing
the Change button replaces all instances of the From value to the
To value in the map.
Note Values of 1 represent boundaries and should not be changed.
The Save button is used to save the encoded map to the workspace. A
dialog box appears in which the map variable name is entered.
See Also
12-869
showm-ui
Purpose
Activation
Description
Command Line
Maptool
showm
showm brings up a Select Object dialog box for selecting mapped objects
to show (Visible property set to 'on').
Controls
The scroll box is used to select the desired objects from the list of mapped
objects. Pushing the Select all button highlights all objects in the scroll
box for selection. Pushing the OK button changes the Visible property
of the selected objects to 'on'. Pushing the Cancel button aborts the
operation without changing any properties of the selected objects.
See Also
12-870
showm
surfdist
Purpose
Activation
Command Line
Maptool
surfdist
surfdist(h)
surfdist([])
Description
surfdist activates the Surface Distance dialog box for the current axes
only if the axes has a proper map definition. Otherwise, the Surface
Distance dialog box is activated, but is not associated with any axes.
surfdist(h) activates the Surface Distance dialog box for the axes
specified by the handle h. The axes must be a map axes.
surfdist([]) activates the Surface Distance dialog box and does not
associate it with any axes, regardless of whether the current axes has a
valid map definition.
12-871
surfdist
Controls
The Style selection buttons are used to specify whether a great circle
or rhumb line is used to calculate the surface distance. When all other
entries are provided, selecting a style updates the surface distance
calculation.
The Mode selection buttons are used to specify whether one point or
two points are to be used in defining the track distance. If one-point
mode is selected, a starting point, azimuth, and range are the required
inputs, and the ending point is computed. If two-point mode is selected,
starting and ending points of the track are required, and the azimuth
and distance along this track are then computed.
The Show Track check box is used to indicate whether the track is
shown on the associated map display. The track is deleted when the
Surface Distance dialog box is closed, or when the Show Track check
box is unchecked and the surface distance calculations are recomputed.
12-872
surfdist
The Starting Point controls are used for both one-point and two-point
mode. The Lat and Lon edit boxes are used to enter the latitude and
longitude of the starting point of the track. These values must be in
degrees. Only one starting point can be entered. The Mouse Select
button is used to select a starting point by clicking the displayed map.
The coordinates of the selected point then appear in the Lat and Lon
edit boxes and can be modified. The coordinates appear in degrees,
regardless of the angle units defined for the current map projection.
The Ending Point controls are enabled only for two-point mode. The
Lat and Lon edit boxes are used to enter the latitude and longitude of
the ending point of the track. These values must be in degrees. Only
one ending point can be entered. The Mouse Select button is used to
select an ending point by clicking the displayed map. The coordinates of
the selected point then appear in the Lat and Lon edit boxes and can
be modified. The coordinates appear in degrees, regardless of the angle
units defined for the current map projection. During one-point mode,
the Ending Point controls are disabled, but the ending point that results
from the surface distance calculation is displayed.
The Direction controls are enabled only for one-point mode. The
Range Units button brings up a Define Range Units dialog box which
allows for modification of the range units and the normalizing geoid.
The Az edit box is used to enter the azimuth, which sets the initial
direction of the track from the starting point. Azimuth is measured in
degrees clockwise from due north. The Rng edit box is used to specify
the reckoning range of the track, in the proper units. The azimuth and
reckoning range, along with the starting point, are used to compute the
ending point of the track in one-point mode. During two-point mode,
the Direction controls are disabled, but the azimuth and range values
resulting from the surface distance calculation are displayed.
Pressing the Close button disregards any input data, deletes any
surface distance tracks that have been plotted, and closes the Surface
Distance dialog box.
Pressing the Compute button accepts the input data and computes the
specified distances.
12-873
surfdist
The Range Units pull-down menu is used to select the units of the
reckoning range. The unit selected is displayed near the top of the
Surface Distance dialog box, and all latitude and longitude entries
must be entered in these units. Users must also be sure to specify
the normalizing geoid in the same units. If radians are selected, it is
assumed the range entry is a multiple of the radius of the normalizing
geoid. In this case, the normalizing geoid must be the same as the geoid
used to display the current map.
The Normalizing Geoid edit box is used modify the radius used to
normalize range entries to radian values, which is necessary for proper
calculations and map display. This entry must be in the same units as
the range units. If the range units are in radians, then the normalizing
geoid must be the same as the geoid used for the current map axes.
Pressing the Cancel button disregards any modifications and closes
the Define Range Units dialog box.
Pressing the Apply button accepts any modifications and returns to
the Surface Distance dialog box.
12-874
tagm-ui
Purpose
Activation
Command Line
tagm
tagm(h)
Description
tagm brings up a Select Object dialog box for selecting mapped objects
and changing their Tag property. Upon selecting the objects, the Edit
Controls
Select Object Dialog Box
The scroll box is used to select the desired objects from the list of
mapped objects. Pushing the Select all button highlights all objects in
the scroll box for selection. Pushing the Ok button activates the Edit
Tag dialog box. Pushing the Canel button aborts the operation without
changing any properties of the selected objects.
12-875
tagm-ui
The new tag string is entered in the edit box. Pressing the Apply
button changes the Tag property of all selected objected to the new tag
string. Pressing the Cancel button closes the Edit Tag dialog box
without changing the Tag property of the selected objects.
See Also
12-876
tagm
trackui
Purpose
Activation
Command Line
Maptool
trackui
trackui(h)
Description
trackui activates the Define Tracks dialog box for adding great circle
circle or rhumb line tracks to the map axes specified by the axes handle
h.
12-877
trackui
Controls
The Style selection buttons are used to specify whether a great circle
or rhumb line track is displayed.
The Mode selection buttons are used to specify whether one point or
two points are to be used in defining the track. If one-point mode is
selected, a starting point, azimuth, and range are the required inputs.
If two-point mode is selected, starting and ending points are required.
The Starting Point controls are used for both one-point and two-point
mode. The Lat and Lon edit boxes are used to enter the latitude and
longitude of the starting point of the track to be displayed. These values
must be in degrees. To display more than one track, a vector of values
can be entered, enclosed in brackets in each edit box. Pushing the Lat
or Lon button brings up an expanded edit box for easier entry of long
vectors. The Mouse Select button is used to select a starting point
12-878
trackui
12-879
trackui
Pressing the Cancel button disregards any input data and closes the
Define Tracks dialog box.
This dialog box, available only for one-point mode, allows for
modification of the range units and the normalizing geoid.
The Range Units pull-down menu is used to select the units of the track
range. The unit selected is displayed near the top of the Define Tracks
dialog box, and all latitude and longitude entries must be entered in
these units. Users must also be sure to specify the normalizing geoid in
the same units. If radians are selected, it is assumed the range entry is
a multiple of the radius used to display the current map.
The Normalizing Geoid edit box is used to modify the radius used to
normalize range entries to radian values, which is necessary for proper
calculations and map display. This entry must be in the same units as
the range units. If the range units are in radians, then the normalizing
geoid must be the same as the geoid used for the current map axes.
Pressing the Cancel button disregards any modifications and closes
the Define Range Units dialog box.
Pressing the Apply button accepts any modifications and returns to the
Define Tracks dialog box.
See Also
12-880
track1, track2
uimaptbx
Purpose
Activation
Description
For X-Windows:
See Also
12-881
utmzoneui
Purpose
Activation
Command Line
utmzoneui
utmzoneui(InitZone)
Description
To interactively pick a UTM zone, activate the interface, and then click
any rectangular zone on the world map to display its UTM zone. The
selected zone is highlighted in red and its designation is displayed in
the Zone edit field. Alternatively, type a valid UTM designation in
the Zone edit field to select and see the location of a zone. Valid zone
designations consist of an integer from 1 to 60 followed by a letter from
C to X.
Typing only the numeric portion of a zone designation will highlight
a column of cells. Clicking Accept returns a that UTM column
designation. You cannot return a letter (row designation) in such a
manner, however.
12-882
utmzoneui
Controls
Remarks
See Also
ups
utm
utmgeoid
utmzone
12-883
vmap0ui
Purpose
Description
selecting and importing data from a Vector Map Level 0 (VMAP0) data
base. Use the string dirname to specify the directory containing the
data base. For more on using vmap0ui, click the Help button after
the interface appears.
vmap0ui(devicename) or vmap0ui devicename uses the logical device
(volume) name specified in string devicename to locate CD-ROM drive
Controls
12-884
vmap0ui
The vmap0ui screen lets you read data from the Vector Map Level
0 (VMAP0). The VMAP0 is the most detailed world map database
available to the public.
You use the list to select the type of data and the map to select the
region of interest. When you click the Get button, data is extracted
and displayed on the map. Use the Save button to save the data in a
MAT-file or to the base workspace for later display. The Close button
closes the window.
The Map
The Map controls the geographic extent of the data to be extracted.
vmap0ui extracts data for areas currently visible on the map. Use the
mouse to zoom in or out to the area of interest. Type help zoom for
more on zooming.
The VMAP0 divides the world into tiles of about 5by5 degrees. When
extracting, data is returned for all visible tiles, including those parts of
the tile that are outside the current view. The map shows the VMAP0
tiles in light yellow with light gray edges. The data density is high, so
extracting data for a large number of tiles can take much time and
memory. A count of the number of visible tiles is above the map.
The List
The List controls the type of data to be extracted. The tree structure of
the list reflects the structure of the VMAP0 database. Upon starting
vmap0ui, the list shows the major categories of VMAP data, called
themes. Themes are subdivided into features, which consist of data
of common graphic types (patch, line, point, or text) or cultural types
(airport, roads, railroads). Double-click a theme to see the associated
features. Features can have properties and values, for example, a
railroad tracks property, with values single or multiple. Double-click
a feature to see the associated properties and values. Double-clicking
an open theme or feature closes it. When a theme is selected, vmap0ui
gets all the associated features. When a feature is selected, vmap0ui
gets all of that features data. When properties and values are selected,
vmap0ui gets the data for any of the properties and values that match
(that is, the union operation).
12-885
vmap0ui
Examples
Windows:
vmap0ui
12-886
vmap0ui
vmap0ui('Volumes/VMAP')
See also
12-887
zdatam-ui
Purpose
Activation
Command Line
zdatam
zdatam(h)
zdatam(str)
Description
zdatam brings up a Select Object dialog box for selecting mapped objects
and adjusting their ZData property. Upon selecting the objects, the
Specify Zdata dialog box is activated, in which the new ZData variable
is entered. Note that not all mapped objects have the ZData property
12-888
zdatam-ui
Controls
The scroll box is used to select the desired objects from the list of
mapped objects. Pushing the Select all button highlights all objects in
the scroll box for selection. Pushing the OK button activates another
Specify Zdata dialog box. Pushing the Cancel button aborts the
operation without changing any properties of the selected objects.
The Zdata Variable edit box is used to specify the name of the
ZData variable. Pressing the List button produces a list of all current
workspace variables, from which the ZData variable can be selected.
A scalar value or a valid MATLAB expression can also be entered.
12-889
zdatam-ui
Pressing the Apply button changes the ZData property of all selected
objected to the new values. Pressing the Cancel button closes the
Specify ZData dialog box without changing the ZData property of the
selected objects.
See Also
12-890
zdatam
13
Class Reference
13
Class Reference
WebMapServer
getCapabilities
getMap
updateLayers
WebMapServer
WMSCapabilities
disp
Display properties
WMSCapabilities
WMSLayer
13-2
disp
Display properties
refine
Refine search
refineLimits
servers
serverTitles
WMSLayer
WMSMapRequest
boundImageSize
WMSMapRequest
13-3
13
13-4
Class Reference
14
Map Projections Reference
Cylindrical Projections (p. 14-2)
Pseudocylindrical Projections
(p. 14-2)
See Chapter 8, Using Map Projections and Coordinate Systems for a general
discussion of map projections, and Summary and Guide to Projections on
page 8-63 for a tabular comparison of their properties.
14
Cylindrical Projections
balthsrt
Balthasart Projection
behrmann
Behrmann Projection
bsam
braun
cassini
Cassini Projection
cassinistd
ccylin
eqacylin
edqcylin
Equidistant Projection
giso
gortho
gstereo
lambcyln
Lambert Projection
mercator
Mercator Projection
miller
Miller Projection
pcarree
tranmerc
trystan
wetch
Wetch Projection
Pseudocylindrical Projections
14-2
apianus
Apianus II Projection
collig
Collignon Projection
craster
Pseudocylindrical Projections
eckert1
Eckert I Projection
eckert2
Eckert II Projection
eckert3
eckert4
Eckert IV Projection
eckert5
Eckert V Projection
eckert6
EckertVI Projection
flatplrp
flatplrq
flatplrs
fournier
Fournier Projection
goode
hatano
kavrsky5
Kavraisky V Projection
kavrsky6
Kavraisky VI Projection
loximuth
Loximuthal Projection
modsine
mollweid
Mollweide Projection
putnins5
Putnins P5 Projection
quartic
robinson
Robinson Projection
sinusoid
Sinusoidal Projection
wagner4
Wsgner IV Projection
winkel
Winkel I Projection
14-3
14
Conic Projections
eqaconic
eqaconicstd
eqdconic
eqdconicstd
lambert
lambertstd
murdoch1
murdoch3
Bonne Projection
polycon
Polyconic Projection
polyconstd
vgrint1
werner
Werner Projection
14-4
aitoff
Aitoff Projection
breusing
bries
Briesemeister Projection
eqaazim
eqdazim
gnomonic
hammer
Hammer Projection
ortho
stereo
vperspec
wiechel
utm
14-5
14
14-6
15
Map Projections
Alphabetical List
Aitoff Projection
Classification
Modified Azimuthal
Syntax
aitoff
Graticule
Features
This projection is neither conformal nor equal area. The only point
free of distortion is the center point. Distortion of shape and area are
moderate throughout. This projection has less angular distortion on the
outer meridians near the poles than pseudoazimuthal projections
Parallels
Remarks
Example
15-2
landareas = shaperead('landareas.shp','UseGeoCoords',true);
axesm ('aitoff', 'Frame', 'on', 'Grid', 'on');
geoshow(landareas,'FaceColor',[1 1 .5],'EdgeColor',[.6 .6 .6]);
tissot;
Aitoff Projection
15-3
Classification
Conic
Syntax
eqaconic
eqaconic
Graticule
15-4
Features
Parallels
Remarks
Limitations
Longitude data greater than 135 east or west of the central meridian
is trimmed.
Example
See Also
landareas = shaperead('landareas.shp','UseGeoCoords',true);
axesm ('eqaconic', 'Frame', 'on', 'Grid', 'on');
geoshow(landareas,'FaceColor',[1 1 .5],'EdgeColor',[.6 .6 .6]);
tissot;
eqaconicstd
15-5
Classification
Conic
Syntax
eqaconicstd
Graticule
Features
Parallels
15-6
Remarks
Example
See also
eqaconic
15-7
Apianus II Projection
Classification
Pseudocylindrical
Syntax
apianus
Graticule
Features
Parallels
Remarks
Limitations
Example
15-8
landareas = shaperead('landareas.shp','UseGeoCoords',true);
axesm ('apianus', 'Frame', 'on', 'Grid', 'on');
geoshow(landareas,'FaceColor',[1 1 .5],'EdgeColor',[.6 .6 .6]);
tissot;
Apianus II Projection
15-9
Classification
Cylindrical
Syntax
balthsrt
Graticule
Features
Parallels
Remarks
Example
15-10
landareas = shaperead('landareas.shp','UseGeoCoords',true);
axesm ('balthsrt', 'Frame', 'on', 'Grid', 'on');
geoshow(landareas,'FaceColor',[1 1 .5],'EdgeColor',[.6 .6 .6]);
tissot;
15-11
Classification
Cylindrical
Syntax
behrmann
Graticule
Features
Parallels
Remarks
Example
15-12
landareas = shaperead('landareas.shp','UseGeoCoords',true);
axesm ('behrmann', 'Frame', 'on', 'Grid', 'on');
geoshow(landareas,'FaceColor',[1 1 .5],'EdgeColor',[.6 .6 .6]);
tissot;
15-13
Classification
Cylindrical
Syntax
bsam
Graticule
Features
Parallels
Remarks
This projection was first described in 1937, when it was used for maps
in the Bolshoi Sovietskii Atlas Mira (Great Soviet World Atlas). It is
commonly abbreviated as the BSAM projection. It is a special form of
the Braun Perspective Cylindrical projection secant at 30N and S.
Limitations
Example
15-14
landareas = shaperead('landareas.shp','UseGeoCoords',true);
axesm ('bsam', 'Frame', 'on', 'Grid', 'on');
geoshow(landareas,'FaceColor',[1 1 .5],'EdgeColor',[.6 .6 .6]);
tissot;
15-15
Bonne Projection
Classification
Pseudoconic
Syntax
bonne
Graticule
Features
Parallels
Remarks
Example
15-16
landareas = shaperead('landareas.shp','UseGeoCoords',true);
axesm ('bonne', 'Frame', 'on', 'Grid', 'on');
geoshow(landareas,'FaceColor',[1 1 .5],'EdgeColor',[.6 .6 .6]);
tissot;
Bonne Projection
15-17
Classification
Cylindrical
Syntax
braun
Graticule
Features
Parallels
Remarks
Limitations
Example
15-18
landareas = shaperead('landareas.shp','UseGeoCoords',true);
axesm ('braun', 'Frame', 'on', 'Grid', 'on');
geoshow(landareas,'FaceColor',[1 1 .5],'EdgeColor',[.6 .6 .6]);
tissot;
15-19
Classification
Azimuthal
Syntax
breusing
Graticule
Features
Parallels
Remarks
Limitations
Example
15-20
landareas = shaperead('landareas.shp','UseGeoCoords',true);
axesm ('breusing', 'Frame', 'on', 'Grid', 'on');
geoshow(landareas,'FaceColor',[1 1 .5],'EdgeColor',[.6 .6 .6]);
tissot;
15-21
Briesemeister Projection
Classification
Modified Azimuthal
Syntax
bries
Graticule
Features
Parallels
Remarks
Example
15-22
landareas = shaperead('landareas.shp','UseGeoCoords',true);
axesm ('bries', 'Frame', 'on', 'Grid', 'on');
geoshow(landareas,'FaceColor',[1 1 .5],'EdgeColor',[.6 .6 .6]);
tissot;
Briesemeister Projection
15-23
Classification
Cylindrical
Syntax
cassini
Graticule
Features
Parallels
Remarks
Example
15-24
landareas = shaperead('landareas.shp','UseGeoCoords',true);
axesm ('cassini', 'Frame', 'on', 'Grid', 'on');
geoshow(landareas,'FaceColor',[1 1 .5],'EdgeColor',[.6 .6 .6]);
tissot;
See also
cassinistd
15-25
Syntax
cassinistd
Graticule
Features
Parallels
Remarks
Example
15-26
landareas = shaperead('landareas.shp','UseGeoCoords',true);
axesm ('cassinistd', 'Frame', 'on', 'Grid', 'on');
See also
cassini
15-27
Classification
Cylindrical
Syntax
ccylin
Graticule
Features
Parallels
Remarks
The origin of this projection is unknown; it has little use beyond the
educational aspects of its method of projection and as a comparison to
the Mercator projection, which is not perspective. The transverse aspect
of the Central Cylindrical is called the Wetch projection.
Limitations
Example
15-28
landareas = shaperead('landareas.shp','UseGeoCoords',true);
axesm ('ccylin', 'Frame', 'on', 'Grid', 'on');
geoshow(landareas,'FaceColor',[1 1 .5],'EdgeColor',[.6 .6 .6]);
tissot;
15-29
Collignon Projection
Classification
Pseudocylindrical
Syntax
collig
Graticule
Features
Parallels
Remarks
Example
15-30
landareas = shaperead('landareas.shp','UseGeoCoords',true);
axesm ('collig', 'Frame', 'on', 'Grid', 'on');
geoshow(landareas,'FaceColor',[1 1 .5],'EdgeColor',[.6 .6 .6]);
tissot;
Classification
Pseudocylindrical
Syntax
craster
Graticule
Features
Parallels
For this projection, only one standard parallel is specified. The other
standard parallel is the same latitude with the opposite sign. The
standard parallel is by definition fixed at 3646.
Remarks
Example
landareas = shaperead('landareas.shp','UseGeoCoords',true);
axesm ('craster', 'Frame', 'on', 'Grid', 'on');
geoshow(landareas,'FaceColor',[1 1 .5],'EdgeColor',[.6 .6 .6]);
tissot;
15-31
15-32
Eckert I Projection
Classification
Pseudocylindrical
Syntax
eckert1
Graticule
Features
Scale is true along the 4710 parallels and is constant along any
parallel, between any pair of parallels equidistant from the Equator,
and along any given meridian. It is not free of distortion at any
point, and the break at the Equator introduces excessive distortion
there; regardless of the appearance here, the Tissot indicatrices are of
indeterminate shape along the Equator. This novelty projection is not
equal-area or conformal.
Parallels
For this projection, only one standard parallel is specified. The other
standard parallel is the same latitude with the opposite sign. The
standard parallel is by definition fixed at 4710.
Remarks
Limitations
Example
landareas = shaperead('landareas.shp','UseGeoCoords',true);
axesm ('eckert1', 'Frame', 'on', 'Grid', 'on');
geoshow(landareas,'FaceColor',[1 1 .5],'EdgeColor',[.6 .6 .6]);
tissot;
15-33
Eckert I Projection
15-34
Eckert ll Projection
Classification
Pseudocylindrical
Syntax
eckert2
Graticule
Features
Parallels
For this projection, only one standard parallel is specified. The other
standard parallel is the same latitude with the opposite sign. The
standard parallel is by definition fixed at 5510.
Remarks
Example
landareas = shaperead('landareas.shp','UseGeoCoords',true);
axesm ('eckert2', 'Frame', 'on', 'Grid', 'on');
geoshow(landareas,'FaceColor',[1 1 .5],'EdgeColor',[.6 .6 .6]);
tissot;
15-35
Eckert ll Projection
15-36
Classification
Pseudocylindrical
Syntax
eckert3
Graticule
Features
Scale is true along the 3558 parallels and is constant along any parallel
and between any pair of parallels equidistant from the Equator. No
point is free of all scale distortion, but the Equator is free of angular
distortion. This projection is not equal-area, conformal, or equidistant.
Parallels
For this projection, only one standard parallel is specified. The other
standard parallel is the same latitude with the opposite sign. The
standard parallel is by definition fixed at 3558.
Remarks
Limitations
Example
landareas = shaperead('landareas.shp','UseGeoCoords',true);
axesm ('eckert3', 'Frame', 'on', 'Grid', 'on');
geoshow(landareas,'FaceColor',[1 1 .5],'EdgeColor',[.6 .6 .6]);
tissot;
15-37
15-38
Eckert IV Projection
Classification
Pseudocylindrical
Syntax
eckert4
Graticule
Features
Parallels
For this projection, only one standard parallel is specified. The other
standard parallel is the same latitude with the opposite sign. The
standard parallel is by definition fixed at 4030.
Remarks
Example
landareas = shaperead('landareas.shp','UseGeoCoords',true);
axesm ('eckert4', 'Frame', 'on', 'Grid', 'on');
geoshow(landareas,'FaceColor',[1 1 .5],'EdgeColor',[.6 .6 .6]);
tissot;
15-39
Eckert IV Projection
15-40
Eckert V Projection
Classification
Pseudocylindrical
Syntax
eckert5
eckert5
Graticule
Features
Parallels
Remarks
Limitations
Example
landareas = shaperead('landareas.shp','UseGeoCoords',true);
axesm ('eckert5', 'Frame', 'on', 'Grid', 'on');
geoshow(landareas,'FaceColor',[1 1 .5],'EdgeColor',[.6 .6 .6]);
tissot;
15-41
Eckert V Projection
15-42
Eckert VI Projection
Classification
Pseudocylindrical
Syntax
eckert6
Graticule
Features
Parallels
For this projection, only one standard parallel is specified. The other
standard parallel is the same latitude with the opposite sign. The
standard parallel is by definition fixed at 4916.
Remarks
Example
landareas = shaperead('landareas.shp','UseGeoCoords',true);
axesm ('eckert6', 'Frame', 'on', 'Grid', 'on');
geoshow(landareas,'FaceColor',[1 1 .5],'EdgeColor',[.6 .6 .6]);
tissot;
15-43
Eckert VI Projection
15-44
Classification
Cylindrical
Syntax
eqacylin
Graticule
Features
Parallels
Remarks
Example
landareas = shaperead('landareas.shp','UseGeoCoords',true);
axesm ('eqacylin', 'Frame', 'on', 'Grid', 'on');
geoshow(landareas,'FaceColor',[1 1 .5],'EdgeColor',[.6 .6 .6]);
tissot;
15-45
15-46
Classification
Azimuthal
Syntax
eqdazim
Graticule
Features
Parallels
Remarks
This projection may have been first used by the ancient Egyptians for
star charts. Several cartographers used it during the sixteenth century,
including Guillaume Postel, who used it in 1581. Other names for this
projection include Postel and Zenithal Equidistant.
Limitations
Example
landareas = shaperead('landareas.shp','UseGeoCoords',true);
axesm ('eqdazim', 'Frame', 'on', 'Grid', 'on');
geoshow(landareas,'FaceColor',[1 1 .5],'EdgeColor',[.6 .6 .6]);
tissot;
15-47
15-48
Classification
Conic
Syntax
eqdconic
Graticule
Features
Scale is true along each meridian and the one or two selected standard
parallels. Scale is constant along any parallel. This projection is free
of distortion along the two standard parallels. Distortion is constant
along any other parallel. This projection provides a compromise in
distortion between conformal and equal-area conic projections, of which
it is neither.
Parallels
Remarks
15-49
Limitations
Example
See Also
15-50
Longitude data greater than 135 east or west of the central meridian
is trimmed.
landareas = shaperead('landareas.shp','UseGeoCoords',true);
axesm ('eqdconic', 'Frame', 'on', 'Grid', 'on');
geoshow(landareas,'FaceColor',[1 1 .5],'EdgeColor',[.6 .6 .6]);
tissot;
eqdconicstd
Syntax
eqdconicstd
Graticule
Features
Scale is true along each meridian and the one or two selected standard
parallels. Scale is constant along any parallel. This projection is free
of distortion along the two standard parallels. Distortion is constant
along any other parallel. This projection provides a compromise in
distortion between conformal and equal-area conic projections, of which
it is neither.
Parallels
15-51
Remarks
Limitations
Longitude data greater than 135 east or west of the central meridian
is trimmed.
Example
See Also
15-52
landareas = shaperead('landareas.shp','UseGeoCoords',true);
axesm ('eqdconicstd', 'Frame', 'on', 'Grid', 'on');
geoshow(landareas,'FaceColor',[1 1 .5],'EdgeColor',[.6 .6 .6]);
tissot;
eqdconic
Classification
Cylindrical
Syntax
eqdcylin
Graticule
Features
Parallels
Remarks
This projection was first used by Marinus of Tyre about A.D. 100.
Special forms of this projection are the Plate Carre, with a standard
parallel at 0, and the Gall Isographic, with standard parallels at
45N and S. Other names for this projection include Equirectangular,
Rectangular, Projection of Marinus, La Carte Paralllogrammatique,
and Die Rechteckige Plattkarte.
Example
landareas = shaperead('landareas.shp','UseGeoCoords',true);
axesm ('eqdcylin', 'Frame', 'on', 'Grid', 'on');
geoshow(landareas,'FaceColor',[1 1 .5],'EdgeColor',[.6 .6 .6]);
tissot;
15-53
15-54
Fournier Projection
Classification
Pseudocylindrical
Syntax
fournier
Graticule
Features
Parallels
Remarks
Example
landareas = shaperead('landareas.shp','UseGeoCoords',true);
axesm ('fournier', 'Frame', 'on', 'Grid', 'on');
geoshow(landareas,'FaceColor',[1 1 .5],'EdgeColor',[.6 .6 .6]);
tissot;
15-55
Fournier Projection
15-56
Classification
Cylindrical
Syntax
giso
Graticule
Features
Parallels
Remarks
Example
landareas = shaperead('landareas.shp','UseGeoCoords',true);
axesm ('giso', 'Frame', 'on', 'Grid', 'on');
geoshow(landareas,'FaceColor',[1 1 .5],'EdgeColor',[.6 .6 .6]);
tissot;
15-57
15-58
Classification
Cylindrical
Syntax
gortho
Graticule
Features
Parallels
Remarks
This projection is named for James Gall, who originated it in 1855 and
is a special form of the Equal-Area Cylindrical projection secant at 45N
and S. This projection is also known as the Peters projection.
Example
landareas = shaperead('landareas.shp','UseGeoCoords',true);
axesm ('gortho', 'Frame', 'on', 'Grid', 'on');
geoshow(landareas,'FaceColor',[1 1 .5],'EdgeColor',[.6 .6 .6]);
tissot;
15-59
15-60
Classification
Cylindrical
Syntax
gstereo
Graticule
Features
Parallels
Remarks
Limitations
Example
landareas = shaperead('landareas.shp','UseGeoCoords',true);
axesm ('gstereo', 'Frame', 'on', 'Grid', 'on');
geoshow(landareas,'FaceColor',[1 1 .5],'EdgeColor',[.6 .6 .6]);
tissot;
15-61
15-62
Globe
Classification
Spherical
Syntax
globe
Graticule
Features
Parallels
Remarks
Example
% Set up axes
axesm ('globe','Grid', 'on');
view(60,60)
axis off
% Display a surface
load geoid
meshm(geoid, geoidrefvec)
% Display coastline vectors
load coast
plotm(lat, long)
15-63
Globe
15-64
Gnomonic Projection
Classification
Azimuthal
Syntax
gnomonic
Graticule
Features
Parallels
Remarks
This projection may have been first developed by Thales around 580
B.C. Its name is derived from the gnomon, the face of a sundial, since
the meridians radiate like hour markings. This projection is also known
as a Gnomic or Central projection.
Limitations
Example
landareas = shaperead('landareas.shp','UseGeoCoords',true);
axesm ('gnomic', 'Frame', 'on', 'Grid', 'on');
15-65
Gnomonic Projection
15-66
Classification
Pseudocylindrical
Syntax
goode
Graticule
Features
This is an equal-area projection. Scale is true along all parallels and the
central meridian between 404411.8 N and S, and is constant along any
parallel and between any pair of parallels equidistant from the Equator
for all latitudes. Its distortion is identical to that of the Sinusoidal
projection between 404411.8 N and S, and to that of the Mollweide
projection elsewhere. This projection is not conformal or equidistant.
Parallels
Remarks
Limitations
Example
landareas = shaperead('landareas.shp','UseGeoCoords',true);
axesm ('goode', 'Frame', 'on', 'Grid', 'on');
15-67
15-68
Hammer Projection
Classification
Modified Azimuthal
Syntax
hammer
Graticule
Features
Parallels
Remarks
Example
landareas = shaperead('landareas.shp','UseGeoCoords',true);
axesm ('hammer', 'Frame', 'on', 'Grid', 'on');
geoshow(landareas,'FaceColor',[1 1 .5],'EdgeColor',[.6 .6 .6]);
tissot;
15-69
Hammer Projection
15-70
Classification
Pseudocylindrical
Syntax
hatano
Graticule
Features
Parallels
Remarks
Example
landareas = shaperead('landareas.shp','UseGeoCoords',true);
axesm ('hatano', 'Frame', 'on', 'Grid', 'on');
geoshow(landareas,'FaceColor',[1 1 .5],'EdgeColor',[.6 .6 .6]);
tissot;
15-71
15-72
Kavraisky V Projection
Classification
Pseudocylindrical
Syntax
kavrsky5
Graticule
Features
Parallels
Remarks
Example
landareas = shaperead('landareas.shp','UseGeoCoords',true);
axesm ('kavrsky5', 'Frame', 'on', 'Grid', 'on');
geoshow(landareas,'FaceColor',[1 1 .5],'EdgeColor',[.6 .6 .6]);
tissot;
15-73
Kavraisky V Projection
15-74
Kavraisky VI Projection
Classification
Pseudocylindrical
Syntax
kavrsky6
Graticule
Features
Parallels
Remarks
Example
landareas = shaperead('landareas.shp','UseGeoCoords',true);
axesm ('kavrsky6', 'Frame', 'on', 'Grid', 'on');
geoshow(landareas,'FaceColor',[1 1 .5],'EdgeColor',[.6 .6 .6]);
tissot;
15-75
Kavraisky VI Projection
15-76
Classification
Azimuthal
Syntax
eqaazim
Graticule
Features
Parallels
Remarks
Limitations
Data greater than 160 distant from the center point is trimmed.
Example
landareas = shaperead('landareas.shp','UseGeoCoords',true);
axesm ('eqaazim', 'Frame', 'on', 'Grid', 'on');
geoshow(landareas,'FaceColor',[1 1 .5],'EdgeColor',[.6 .6 .6]);
tissot;
15-77
15-78
Classification
Conic
Syntax
lambert
Graticule
Features
Scale is true along the one or two selected standard parallels. Scale is
constant along any parallel and is the same in every direction at any
point. This projection is free of distortion along the standard parallels.
Distortion is constant along any other parallel. This projection is
conformal everywhere but the poles; it is neither equal-area nor
equidistant.
Parallels
Remarks
15-79
Limitations
Example
See Also
15-80
Longitude data greater than 135 east or west of the central meridian
is trimmed. The default map limits are [0 90] to avoid extreme area
distortion.
landareas = shaperead('landareas.shp','UseGeoCoords',true);
axesm ('lambert', 'Frame', 'on', 'Grid', 'on');
geoshow(landareas,'FaceColor',[1 1 .5],'EdgeColor',[.6 .6 .6]);
tissot;
lambertstd
Classification
Conic
Syntax
lambertstd
Graticule
Features
Parallels
15-81
Remarks
Limitations
Longitude data greater than 135 east or west of the central meridian
is trimmed. The default map limits are [0 90] to avoid extreme area
distortion.
Example
See Also
15-82
landareas = shaperead('landareas.shp','UseGeoCoords',true);
axesm ('lambertstd', 'Frame', 'on', 'Grid', 'on');
geoshow(landareas,'FaceColor',[1 1 .5],'EdgeColor',[.6 .6 .6]);
tissot;
lambert
Classification
Cylindrical
Syntax
lambcyln
Graticule
Features
Parallels
Remarks
Example
landareas = shaperead('landareas.shp','UseGeoCoords',true);
axesm ('lambcyn', 'Frame', 'on', 'Grid', 'on');
geoshow(landareas,'FaceColor',[1 1 .5],'EdgeColor',[.6 .6 .6]);
tissot;
15-83
15-84
Loximuthal Projection
Classification
Pseudocylindrical
Syntax
loximuth
Graticule
Features
This projection has the special property that from the central point (the
intersection of the central latitude with the central meridian), rhumb
lines (loxodromes) are shown as straight, true to scale, and correct in
azimuth from the center. This differs from the Mercator projection,
in that rhumb lines are here shown in true scale and that unlike the
Mercator, this projection does not maintain true azimuth for all points
along the rhumb lines. Scale is true along the central meridian and is
constant along any parallel, but not, generally, between parallels. It is
free of distortion only at the central point and can be severely distorted
in places. However, this projection is designed for its specific special
property, in which distortion is not a concern.
Parallels
For this projection, only one standard parallel is specified: the central
latitude described above. Specification of this central latitude defines
the center of the Loximuthal projection. The default value is 0.
15-85
Loximuthal Projection
Remarks
Limitations
Example
15-86
landareas = shaperead('landareas.shp','UseGeoCoords',true);
axesm ('loximuth', 'Frame', 'on', 'Grid', 'on');
geoshow(landareas,'FaceColor',[1 1 .5],'EdgeColor',[.6 .6 .6]);
tissot;
Classification
Pseudocylindrical
Syntax
flatplrp
Graticule
Features
Parallels
For this projection, only one standard parallel is specified. The other
standard parallel is the same latitude with the opposite sign. The
standard parallel is by definition fixed at 4530.
Remarks
Example
landareas = shaperead('landareas.shp','UseGeoCoords',true);
axesm ('flatplrp', 'Frame', 'on', 'Grid', 'on');
geoshow(landareas,'FaceColor',[1 1 .5],'EdgeColor',[.6 .6 .6]);
tissot;
15-87
15-88
Classification
Pseudocylindrical
Syntax
flatplrq
Graticule
Features
Parallels
For this projection, only one standard parallel is specified. The other
standard parallel is the same latitude with the opposite sign. The
standard parallel is by definition fixed at 3345.
Remarks
Example
landareas = shaperead('landareas.shp','UseGeoCoords',true);
axesm ('flatplrq', 'Frame', 'on', 'Grid', 'on');
geoshow(landareas,'FaceColor',[1 1 .5],'EdgeColor',[.6 .6 .6]);
tissot;
15-89
15-90
Classification
Pseudocylindrical
Syntax
flatplrs
Graticule
Features
Parallels
For this projection, only one standard parallel is specified. The other
standard parallel is the same latitude with the opposite sign. The
standard parallel is by definition fixed at 5551.
Remarks
Example
landareas = shaperead('landareas.shp','UseGeoCoords',true);
axesm ('flatplrs', 'Frame', 'on', 'Grid', 'on');
geoshow(landareas,'FaceColor',[1 1 .5],'EdgeColor',[.6 .6 .6]);
tissot;
15-91
15-92
Mercator Projection
Classification
Cylindrical
Syntax
mercator
Graticule
Features
Parallels
Remarks
15-93
Mercator Projection
called the Wright projection, after Edward Wright, who developed the
mathematics behind the projection in 1599.
Limitations
Example
15-94
Classification
Cylindrical
Syntax
miller
Graticule
Features
Parallels
Remarks
15-95
Limitations
Example
15-96
Mollweide Projection
Classification
Pseudocylindrical
Syntax
mollweid
Graticule
Features
Parallels
For this projection, only one standard parallel is specified. The other
standard parallel is the same latitude with the opposite sign. The
standard parallel is by definition fixed at 4044.
Remarks
Example
landareas = shaperead('landareas.shp','UseGeoCoords',true);
axesm ('mollweid', 'Frame', 'on', 'Grid', 'on');
geoshow(landareas,'FaceColor',[1 1 .5],'EdgeColor',[.6 .6 .6]);
tissot;
15-97
Mollweide Projection
15-98
Classification
Conic
Syntax
murdoch1
Graticule
Features
Parallels
The parallels for this projection are not standard parallels, but rather
limiting parallels. The special feature of this map, correct total area,
holds between these parallels. The default parallels are [15 75].
Remarks
Limitations
This projection is available only for the sphere. Longitude data greater
than 135 east or west of the central meridian is trimmed.
Example
landareas = shaperead('landareas.shp','UseGeoCoords',true);
axesm ('murdoch1', 'Frame', 'on', 'Grid', 'on');
geoshow(landareas,'FaceColor',[1 1 .5],'EdgeColor',[.6 .6 .6]);
tissot;
15-99
15-100
Classification
Conic
Syntax
murdoch3
Graticule
Features
Parallels
The parallels for this projection are not standard parallels, but rather
limiting parallels. The special feature of this map, correct total area,
holds between these parallels. The default parallels are [15 75].
Remarks
Limitations
This projection is available only for the sphere. Longitude data greater
than 135 east or west of the central meridian is trimmed.
Example
landareas = shaperead('landareas.shp','UseGeoCoords',true);
axesm ('murdoch3', 'Frame', 'on', 'Grid', 'on');
geoshow(landareas,'FaceColor',[1 1 .5],'EdgeColor',[.6 .6 .6]);
tissot;
15-101
15-102
Orthographic Projection
Classification
Azimuthal
Syntax
ortho
Graticule
Features
Parallels
Remarks
Limitations
This projection is available only for the sphere. Data greater than 89
distant from the center point is trimmed.
15-103
Orthographic Projection
Example
15-104
landareas = shaperead('landareas.shp','UseGeoCoords',true);
axesm ('ortho', 'Frame', 'on', 'Grid', 'on');
geoshow(landareas,'FaceColor',[1 1 .5],'EdgeColor',[.6 .6 .6]);
tissot;
Classification
Cylindrical
Syntax
pcarree
Graticule
Features
Parallels
Remarks
Example
landareas = shaperead('landareas.shp','UseGeoCoords',true);
axesm ('pcarree', 'Frame', 'on', 'Grid', 'on');
geoshow(landareas,'FaceColor',[1 1 .5],'EdgeColor',[.6 .6 .6]);
tissot;
15-105
15-106
Polyconic Projection
Classification
Polyconic
Syntax
polycon
Graticule
Features
Parallels
Remarks
Limitations
Example
landareas = shaperead('landareas.shp','UseGeoCoords',true);
axesm ('polycon', 'Frame', 'on', 'Grid', 'on');
geoshow(landareas,'FaceColor',[1 1 .5],'EdgeColor',[.6 .6 .6]);
15-107
Polyconic Projection
tissot;
See Also
15-108
polyconstd
Classification
Polyconic
Syntax
polyconstd
Graticule
Features
Parallels
Remarks
Limitations
15-109
Example
See Also
15-110
landareas = shaperead('landareas.shp','UseGeoCoords',true);
axesm ('polyconstd ', 'Frame', 'on', 'Grid', 'on');
geoshow(landareas,'FaceColor',[1 1 .5],'EdgeColor',[.6 .6 .6]);
tissot;
polycon
Putnins P5 Projection
Classification
Pseudocylindrical
Syntax
putnins5
Graticule
Features
Scale is true along the 2114 parallels and is constant along any
parallel, between any pair of parallels equidistant from the Equator,
and along the central meridian. It is not free of distortion at any point.
This projection is not equal-area, conformal, or equidistant.
Parallels
For this projection, only one standard parallel is specified. The other
standard parallel is the same latitude with the opposite sign. The
standard parallel is by definition fixed at 2114.
Remarks
Limitations
Example
landareas = shaperead('landareas.shp','UseGeoCoords',true);
axesm ('putnin5', 'Frame', 'on', 'Grid', 'on');
geoshow(landareas,'FaceColor',[1 1 .5],'EdgeColor',[.6 .6 .6]);
tissot;
15-111
Putnins P5 Projection
15-112
Classification
Pseudocylindrical
Syntax
quartic
Graticule
Features
Parallels
Remarks
Example
landareas = shaperead('landareas.shp','UseGeoCoords',true);
axesm ('quartic', 'Frame', 'on', 'Grid', 'on');
geoshow(landareas,'FaceColor',[1 1 .5],'EdgeColor',[.6 .6 .6]);
tissot;
15-113
15-114
Robinson Projection
Classification
Pseudocylindrical
Syntax
robinson
Graticule
Features
Scale is true along the 38 parallels and is constant along any parallel
or between any pair of parallels equidistant from the Equator. It is not
free of distortion at any point, but distortion is very low within about 45
of the center and along the Equator. This projection is not equal-area,
conformal, or equidistant; however, it is considered to look right for
world maps, and hence is widely used by Rand McNally, the National
Geographic Society, and others. This feature is achieved through the
use of tabular coordinates rather than mathematical formulae for the
graticules.
Parallels
For this projection, only one standard parallel is specified. The other
standard parallel is the same latitude with the opposite sign. The
standard parallel is by definition fixed at 38.
Remarks
Limitations
Example
landareas = shaperead('landareas.shp','UseGeoCoords',true);
axesm ('robinson', 'Frame', 'on', 'Grid', 'on');
15-115
Robinson Projection
15-116
Sinusoidal Projection
Classification
Pseudocylindrical
Syntax
sinusoid
Graticule
Features
Parallels
Remarks
This projection was developed in the 16th century. It was used by Jean
Cossin in 1570 and by Jodocus Hondius in Mercator atlases of the early
17th century. It is the oldest pseudocylindrical projection currently in
use, and is sometimes called the Sanson-Flamsteed or the Mercator
Equal-Area projection.
Example
landareas = shaperead('landareas.shp','UseGeoCoords',true);
axesm ('sinusoid', 'Frame', 'on', 'Grid', 'on');
geoshow(landareas,'FaceColor',[1 1 .5],'EdgeColor',[.6 .6 .6]);
tissot;
15-117
Sinusoidal Projection
15-118
Stereographic Projection
Classification
Azimuthal
Syntax
stereo
Graticule
Features
Parallels
Remarks
Limitations
Example
landareas = shaperead('landareas.shp','UseGeoCoords',true);
axesm ('stereo', 'Frame', 'on', 'Grid', 'on');
geoshow(landareas,'FaceColor',[1 1 .5],'EdgeColor',[.6 .6 .6]);
tissot;
15-119
Stereographic Projection
15-120
Classification
Pseudocylindrical
Syntax
modsine
Graticule
Features
Parallels
Remarks
Limitations
Example
landareas = shaperead('landareas.shp','UseGeoCoords',true);
axesm ('modsine', 'Frame', 'on', 'Grid', 'on');
geoshow(landareas,'FaceColor',[1 1 .5],'EdgeColor',[.6 .6 .6]);
tissot;
15-121
Classification
Cylindrical
Syntax
tranmerc
Features
Remarks
Example
15-122
15-123
Classification
Cylindrical
Syntax
trystan
Graticule
Features
Parallels
Remarks
Example
15-124
landareas = shaperead('landareas.shp','UseGeoCoords',true);
axesm ('trystan', 'Frame', 'on', 'Grid', 'on');
geoshow(landareas,'FaceColor',[1 1 .5],'EdgeColor',[.6 .6 .6]);
tissot;
15-125
Classification
Azimuthal
Syntax
ups
Graticule
Features
Parallels
Remarks
15-126
Classification
Cylindrical
Syntax
utm
Graticule
Features
Parallels
There are no standard parallels for this projection. There are two lines
of zero distortion by virtue of the scale factor.
Remarks
15-127
Classification
Polyconic
Syntax
vgrint1
Graticule
Features
Parallels
Remarks
Limitations
Example
15-128
landareas = shaperead('landareas.shp','UseGeoCoords',true);
axesm ('vgrint1', 'Frame', 'on', 'Grid', 'on');
geoshow(landareas,'FaceColor',[1 1 .5],'EdgeColor',[.6 .6 .6]);
tissot;
15-129
Classification
Azimuthal
Syntax
vperspec
Graticule
Features
Remarks
This projection provides views of the globe resembling those seen from a
spacecraft in orbit. The Orthographic projection is a limiting form with
the observer at an infinite distance.
This projection requires a view altitude parameter, which specifies the
observers altitude above the origin point. Because this parameter is
unique to this projection and because the projection does not need any
standard parallels, a special workaround is used. Rather than add an
extra map axes property just for vperspec, the MapParallels property
is repurposed instead. You should assign the desired view altitude
value to the MapParallels property. Provide a scalar value for length
in the same units as the earth radius or semi-major axis length used in
the map axes reference ellipsoid ('Geoid') property.
15-130
Limitations
Example
This projection is available only for the sphere. Data more distant than
the limit of visibility is trimmed.
landareas = shaperead('landareas.shp','UseGeoCoords',true);
axesm ('vperspec', 'Frame', 'on', 'Grid', 'on');
geoshow(landareas,'FaceColor',[1 1 .5],'EdgeColor',[.6 .6 .6]);
tissot;
15-131
Wagner IV Projection
Classification
Pseudocylindrical
Syntax
wagner4
Graticule
Features
Parallels
For this projection, only one standard parallel is specified. The other
standard parallel is the same latitude with the opposite sign. The
standard parallel is by definition fixed at 4259.
Remarks
Example
15-132
landareas = shaperead('landareas.shp','UseGeoCoords',true);
axesm ('wagner4', 'Frame', 'on', 'Grid', 'on');
geoshow(landareas,'FaceColor',[1 1 .5],'EdgeColor',[.6 .6 .6]);
tissot;
Wagner IV Projection
15-133
Werner Projection
Classification
Pseudoconic
Syntax
werner
Graticule
Features
Parallels
Remarks
Example
15-134
landareas = shaperead('landareas.shp','UseGeoCoords',true);
axesm ('werner', 'Frame', 'on', 'Grid', 'on');
geoshow(landareas,'FaceColor',[1 1 .5],'EdgeColor',[.6 .6 .6]);
tissot;
Werner Projection
15-135
Classification
Cylindrical
Syntax
wetch
Graticule
Features
Parallels
Remarks
Limitations
Example
15-136
landareas = shaperead('landareas.shp','UseGeoCoords',true);
axesm ('wetch', 'Frame', 'on', 'Grid', 'on');
15-137
Wiechel Projection
Classification
Pseudoazimuthal
Syntax
wiechel
Graticule
Features
Parallels
Remarks
Limitations
Example
15-138
landareas = shaperead('landareas.shp','UseGeoCoords',true);
axesm ('wiechel', 'Frame', 'on', 'Grid', 'on');
geoshow(landareas,'FaceColor',[1 1 .5],'EdgeColor',[.6 .6 .6]);
tissot;
Wiechel Projection
15-139
Winkel I Projection
Classification
Pseudocylindrical
Syntax
winkel
Graticule
Features
Parallels
For this projection, only one standard parallel is specified. The other
standard parallel is the same latitude with the opposite sign. Any
latitude may be chosen; the default is set to 5028.
Remarks
Limitations
Example
15-140
landareas = shaperead('landareas.shp','UseGeoCoords',true);
axesm ('winkel', 'Frame', 'on', 'Grid', 'on');
geoshow(landareas,'FaceColor',[1 1 .5],'EdgeColor',[.6 .6 .6]);
tissot;
Winkel I Projection
15-141
Winkel I Projection
15-142
Glossary
Glossary
Glossary-1
Glossary
Azimuth
The angle a line makes with a meridian, taken clockwise from north.
Azimuthal projection
A projection on which the azimuth or direction from a given central
point to any other point is shown correctly. When a pole is the central
point, all meridians are spaced at their true angles and are straight
radii of concentric circles that represent the parallels. Also called a
zenithal projection.
Bathymetry
The measurement of water depths of oceans, seas, lakes, and other
bodies of water.
Bowditch, Nathaniel
A late 18th/early 19th century mathematician, astronomer, and sailor
who wrote the book on navigation. John Hamilton Moores The
Practical Navigator was the leading navigational text when Bowditch
first went out to sea, and had been for many years. Early in his first
voyage, however, Bowditch began noticing errors in Moores book,
which he recorded and later used in preparing an American edition
of Moores work. The revisions were to such an extent that Bowditch
was named the principal author, and the title was changed to The New
American Practical Navigator, published in 1802. In 1868, the U.S.
Navy bought the copyright to the book, which is still commonly referred
to as Bowditch and considered the bible of navigation.
Buffer zone
The locus of points that lie within a specified distance from a map
feature.
Cartography
The art or practice of making charts or maps. See Map.
Categorical geodata
Geospatial data in which raster pixel values (or vector data attributes)
are categorical indices, usually coded as integers. The meanings of the
categories are usually stored in a separate table. Examples are geocodes,
land use categories, and indexed color images. See Numerical geodata.
Glossary-2
Glossary
Central meridian
The meridian passing through the center of a projection, often a straight
line about which the projection is symmetrical.
Central projection
A projection in which the Earth is projected geometrically from the
center of the Earth onto a plane or other surface. The Gnomonic and
Central Cylindrical projections are examples.
Choropleth
A map portraying regions of homogeneous classified attribute values,
changing abruptly at region boundaries, and colored or shaded
according to their attribute values. Thematic political maps are usually
choropleth maps.
Complex curves
Curves that are not elementary forms such as circles, ellipses,
hyperbolas, parabolas, and sine curves, such as rivers, coastlines, and
administrative boundaries.
Composite projection
A projection formed by connecting two or more projections along
common lines such as parallels of latitude, necessary adjustments being
made to achieve fit. The Goode Homolosine projection is an example.
Conformal projection
A projection on which all angles at each point are preserved, except at a
finite number of singular points (e.g., the poles in a Mercator projection).
Also called an orthomorphic projection.
Conic projection
A projection resulting from the conceptual projection of the Earth onto
a tangent or secant cone, which is then cut lengthwise and laid flat.
When the axis of the cone coincides with the polar axis of the Earth,
all meridians are straight equidistant radii of concentric circular arcs
representing the parallels, but the meridians are spaced at less than
their true angles. Mathematically, the projection is often only partially
geometric.
Glossary-3
Glossary
Constant scale
A linear scale that remains the same along a particular line on a map,
although that scale may not be the same as the stated or nominal scale
of the map.
Contour
All points that are at the same height above or below a reference datum;
generally applied to continuous, single-valued surfaces only, such as
elevation, temperature, or magnetic field strength.
Conventional aspect
See Normal aspect.
Correct scale
A linear scale having exactly the same value as the stated or nominal
scale of the map, or a scale factor of 1.0. Also called true scale.
Cylindrical projection
A projection resulting from the conceptual projection of the Earth onto a
tangent or secant cylinder, which is then cut lengthwise and laid flat.
When the axis of the cylinder coincides with the axis of the Earth, the
meridians are straight, parallel, and equidistant, while the parallels
of latitude are straight, parallel, and perpendicular to the meridians.
Mathematically, the projection is often only partially geometric.
Data grid
A raster data set consisting of an array of values posted or sampled
at specific geographic points. Mapping Toolbox data grids can be
implicit (regular) or explicit (irregular, or geolocated), depending on the
uniformity of the grid. See Regular data grid, Geolocated data grid.
Datum (vertical)
A base reference level for establishing the vertical dimension of elevation
for the earths surface. A datum defines sea level and incorporates an
ellipsoid; thus one can reference a coordinate system to a datum or to a
specified ellipsoid, but not both at the same time.
Datum (horizontal)
A base measuring point (0.0 point) used as the origin of rectangular
coordinate systems for mapping or for maintaining excavation
Glossary-4
Glossary
Glossary-5
Glossary
DM
DMS
DTED
Easting
The distance of a point eastward from the origin in the units of the
coordinate system for the defined projection. Paired with Northings.
Ellipsoid
When used to represent the Earth, a solid geometric figure formed by
rotating an ellipse about its minor (shorter) axis. Also called spheroid.
Ellipsoid vector
A vector describing a specific ellipsoid model. The ellipsoid vector has
the form
ellipsvec = [semimajor-axis eccentricity]
Glossary-6
Glossary
Ellipsoidal height
Elevation of a point above a reference ellipsoid, as measured along
a normal to the ellipsoid.
Equal-area projection
A projection on which the areas of all regions are shown in the same
proportion to their true areas. Shapes may be greatly distorted. Also
called an equivalent or authalic projection.
Equator
The great circle straddling a planet at a latitude of 0, perpendicular to
its polar axis and midway along it, dividing the northern and southern
hemispheres.
Equatorial aspect
An aspect of an azimuthal projection on which the center of projection
or origin is some point along the Equator. For cylindrical and
pseudocylindrical projections, this aspect is usually called conventional,
direct, normal, or regular rather than equatorial.
Equidistant projection
A projection that maintains constant scale along all great circles from
one or two points. When the projection is centered on a pole, the
parallels are spaced in proportion to their true distances along each
meridian.
Equireal projection
See Equal-area projection.
Equivalent projection
See Equal-area projection.
False easting
The value of the easting assigned to the projection origin. Easting
values increase to the east.
False northing
The value of the northing assigned to the projection origin. Northing
values increase to the north.
Glossary-7
Glossary
Flat-polar projection
A cylindrical projection on which, in normal aspect, the pole is shown
as a line rather than as a point. For example, the Miller projection
is flat-polar.
Frame
See Map frame.
Free of distortion
Having no distortion of shape, area, or linear scale. On a flat map, this
condition can exist only at certain points or along certain lines.
Geodesic
A minimum-distance curve on a curved surface, independent of the
choice of a coordinate system. On a sphere a geodesic is equivalent
to a great circle arc.
Geolocated data grid
A data grid defined with separate latitude, longitude, and value
matrices, allowing irregular sampling, nonrectangular shapes,
and noncardinal orientations. Satellite imagery swaths are often
represented as geolocated data grids. See Data grid, Regular data grid.
Geodata
Geospatial data. See Geospatial.
Geoid
The figure of the earth less its topography, defined as an equipotential
surface with respect to gravity, more or less corresponding to mean sea
level. It is approximately an oblate ellipsoid, but not exactly so because
local variations in gravity create minor hills and dales. Empirically
determined geoids are used to define datums and to compute orbital
mechanics.
Geometric projection
See Perspective projection.
Glossary-8
Glossary
Geographic coordinates
Spherical 2-D coordinate tuples (latitudes, longitudes) that specify point
locations for unprojected geodata. The analogous term for geodata
projected to a rectangular coordinate system is map coordinates.
Geographic data structure
A Mapping Toolbox data structure for vector data comprised of a
MATLAB structure array with one element per vector geographic
feature. It includes a mandatory Geometry field, at least two coordinate
array fields. The field names are X and Y (for mapstructs), or Lat and
Lon (for geostructs), and optional attribute fields.
Georeferencing
Identifying objects and locations by name, identifier, or coordinates to
describe where they are located on the Earths surface.
Geospatial
Spatial data, concepts, and techniques that specifically refer to
geographic space or phenomena, and not just to arbitrary coordinate
systems or abstract space frames.
Geostruct
A Mapping Toolbox geographic data structure for vector geodata with
coordinates in latitude and longitude. See Geographic data structure
on page Glossary-9.
GeoTIFF
An extension of the TIFF image file format with additional tags
containing parameters for image georeferencing and projected map
coordinate system definition.
GIS (Geographic Information System)
A system, usually computer based, for the input, storage, retrieval,
analysis, and display of interpreted geographic data.
Globular projection
Generally, a nonazimuthal projection developed before 1700 on which
a hemisphere is enclosed in a circle, and meridians and parallels are
simple curves or straight lines.
Glossary-9
Glossary
Graticule
A network of lines representing a subset of the Earths parallels and
meridians (or plane coordinates) used as a reference grid on globes and
maps. Generally synonymous with map grid, except that many map
grids are rulings at regular intervals in projected coordinates. See Map
grid, National grid (U.S.), and National grid (U.K.). The vertices of
the graticule grid are precisely projected, and the map data contained
in any grid cell is warped to fit the resulting quadrilateral. A finer
graticule grid results in a higher projection fidelity at the expense of
greater computational requirements.
Great circle
Any circle on the surface of a sphere, especially when the sphere
represents the Earth, formed by the intersection of the surface with a
plane passing through the center of the sphere. It is the shortest path
between any two points along the circle and therefore important for
navigation. All meridians and the Equator are great circles on the
Earth taken as a sphere.
Grid
Homalographic/homolographic projection
See Equal-area projection.
Hydrography
The science of measurement, description, and mapping of the surface
waters of the Earth, especially with reference to their use in navigation.
The term also refers to those parts of a map collectively that represent
surface waters and drainage.
Hydrology
The scientific study of the waters of the Earth, especially with relation
to the effects of precipitation and evaporation upon the occurrence and
character of ground water.
Hypsographic tints
A graphic means of representing terrain or other scalar attributes using
a sequence of colors or tints indexed to elevation.
Glossary-10
Glossary
Hypsography
The scientific study of the Earths topological configuration above sea
level, especially the measurement and mapping of land elevation.
Index map
A small-scale map used to help locate a map containing a region or
feature of interest in a tiled geospatial database, map series, plat book,
or atlas.
Indicatrix
A circle or ellipse useful in illustrating the distortions of a given map
projection. Indicatrices are constructed by projecting infinitesimally
small circles on the Earth onto a map and giving them visible
dimensions. Their axes lie in the directions of and are proportional to
the maximum and minimum scales at their point locations. Often called
a Tissot indicatrix after the originator of the concept. Mapping Toolbox
Tissot indicatrices can be displayed using the tissot command, and
indicatrices for all supported projections are provided. See Chapter 15,
Map Projections Alphabetical List in Mapping Toolbox reference
documentation.
Interrupted projection
A projection designed to reduce peripheral distortion by making use of
separate sections joined at certain points or along certain lines, usually
the Equator in the normal aspect, and split along lines that are usually
meridians. There is normally a central meridian for each section. No
Mapping Toolbox projections are of this type, but the user can separate
data into sections and project these independently to achieve this effect.
Keyhole markup language (KML)
A file format and dialect of XML used to georeference geographic
locations and describe their attributes and relations, including
hyperlinks, for display in earth browsers.
Large-scale mapping
Mapping at a scale larger than about 1:75,000, although this limit is
somewhat flexible. Includes cadastral, utility, and some topographic
maps.
Glossary-11
Glossary
Latitude (astronomical)
The complement of the elevation angle of the celestial North Pole, which
depends on normal to the Earths equipotential surface (geoid) at a
given point (positive if the point is north of Equator, negative if it is
south). It can be thought of as the angle that a plumb line makes with
the equatorial plane.
Latitude (auxiliary)
Intermediate forms of latitude that are mathematically constructed
(normally by transferring latitudes first from an ellipsoid to a sphere,
and then to a plane) in order to achieve desired map projection
properties. Types include conformal (for constructing conformal
maps), authalic (for constructing equal-area maps), and rectifying (for
constructing equidistant maps).
Latitude (geocentric)
The angle at which a line connecting the surface of a sphere or reference
ellipsoid to its center intersects the equatorial plane (positive if the
point is north of Equator, negative if it is south). One of the two common
geographic coordinates of a point on the Earth.
Latitude (geodetic)
The angle made by a perpendicular to a given point on the surface
of a sphere or ellipsoid representing the Earth and the plane of the
Equator (positive if the point is north of Equator, negative if it is south).
Also called geographic latitude. One of the two common geographic
coordinates of a point on the Earth.
Latitude of opposite sign
See Parallel of opposite sign.
Legs
Legend
See Map legend.
Glossary-12
Glossary
Limiting forms
The form taken by a system of projection when the parameters of the
formulas defining that projection are allowed to reach limits that cause
it to be identical with another separately defined projection.
Logical data grid
A binary data grid consisting entirely of 1s and 0s. An example of a
logical data grid can be created with the topo map by performing a
logical test for positive elevations (topo>0). Each entry in the data grid
contains a 1 if it is above sea level, or a 0 if it is at or below sea level.
Longitude
The angle made by the plane of a meridian passing through a given
point on the Earths surface and the plane of the (prime) meridian
passing through Greenwich, England, east or west to 180 (positive if the
point is east, negative if it is west). One of the two common geographic
coordinates of a point on the Earth. Paired with Latitude.
Loxodrome
See Rhumb line.
Map
Map axes
A Handle Graphics axes object augmented with additional properties,
including a projection type, projection parameters, map latitude and
longitude limits and so forth. Many Mapping Toolbox display functions
require that a map axes first be defined. Others create a map axes if
necessary (e.g., worldmap and usamap) or assume that your coordinate
data are in a projected map coordinate system (mapshow and mapview).
Map coordinates
Orthogonal planar 2-D coordinate tuples that specify point locations
for projected geodata. The analogous term for unprojected geodata
is geographic coordinates. Also called grid coordinates and plane
coordinates.
Glossary-13
Glossary
Map frame
A projected rectangle or quadrangle enclosing a geographic data
displayed on a Mapping Toolbox map axes.
Map grid
A symbolized network of lines, or graticule, representing parallels and
meridians or plane coordinates. Plane coordinate grids are almost
always rectangular with uniform spacing. Azimuthal map grids are
organized as polar coordinates. See Graticule.
Map layer
A vector or raster geographic data set read into the Map Viewer, for
example, roads, rivers, municipal boundaries, topographic grids, or
orthophoto images. Map layers are stacked from top to bottom, and
can be reordered and hidden by the user.
Map legend
A key to symbolism used on a map, usually containing swatches
of symbols with descriptions, and can include notes on projection,
provenance, scale, units of distance, etc.
Mapstruct
A Mapping Toolbox geographic data structure for vector geodata with
coordinates in projected (x,y) coordinates. See Geographic data
structure on page Glossary-9.
Matrix map
See Data grid.
Meridian
A reference line on the Earths surface formed by the intersection of the
surface with a plane passing through both poles and some third point
on the surface. This line is identified by its longitude. When the Earth
is regarded as a sphere, this line is half a great circle; on the Earth
regarded as an ellipsoid, it is half an ellipse.
Minimum-error projection
A projection having the least possible total error of any projection
in the designated classification, according to a given mathematical
criterion. Usually, this criterion calls for the minimum sum of squares
Glossary-14
Glossary
of deviations of linear scale from true scale throughout the map (least
squares).
National grid (U.K.)
A metric grid based on the Transverse Mercator Projection developed
by Ordnance Survey in 1936 for use in Great Britain. Sometimes
abbreviated OSGB36, it is the de facto standard projection for display
of UK based mapping.
National grid (U.S.)
A metric grid based on the Transverse Mercator Projection, adopted
by the Federal Geographic Data Committee (FGDC) in 2001 for use
in the United States. It is an evolving standard intended to unify
georeferencing across the U.S., but is not yet as widely used as other
countries national grids.
Nominal scale
The stated scale at which a map projection is constructed. Scale is never
completely constant across the extent of a map, although in some maps
(especially at large scales) it can vary by minuscule amounts.
Normal aspect
A form of a projection that provides the simplest graticule and
calculations. It is the polar aspect for azimuthal projections, the
aspect having a straight Equator for cylindrical and pseudocylindrical
projections, and the aspect showing straight meridians for conic
projections. Also called conventional, direct, or regular aspect.
Northing
The distance of a point northward from the origin, in the units of the
coordinate system for the defined projection. Paired with Eastings.
Numerical geodata
Geospatial data in which raster pixel values (or vector data attributes)
are cardinal, ratio, or ordinal numeric measurements or computed
values. For example, the topo data set contains numerical geodata.
Each value in its data grid is an average elevation in meters for the
geographic area covered by that cell. See Categorical geodata.
Glossary-15
Glossary
Oblique aspect
An aspect of a projection on which the axis of the Earth is rotated so it
is neither aligned with nor perpendicular to the conceptual axis of the
map projection.
Orthoapsidal projection
A projection on which the surface of the Earth taken as a sphere is
transformed onto a solid other than the sphere and then projected
orthographically and obliquely onto a plane for the map.
Orthographic projection
A specific azimuthal projection or a type of projection in which the
Earth is projected geometrically onto a surface by means of parallel
projection lines.
Orthometric height
Elevation above a datum defined by a geoid representing mean sea level.
Orthomorphic projection
See Conformal projection.
Parallel
A small circle on the surface of the Earth, formed by the intersection of
the surface of the reference sphere or ellipsoid with a plane parallel to
the plane of the Equator. This line is identified by its latitude, which
can be defined in several ways. The Equator (a great circle) is usually
also treated as a parallel. See entries for Latitude.
Parallel of opposite sign
A parallel that is equally distant from but on the opposite side of the
Equator. For example, for lat 30N (or +30), the parallel of opposite
sign is lat 30 S (or -30). Also called latitude of opposite sign.
Perspective projection
A projection produced by projecting straight lines radiating from a
selected point (or from infinity) through points on the surface of a sphere
or ellipsoid and then onto a tangent or secant plane. Other perspective
maps are projected onto a tangent or secant cylinder or cone by using
straight lines passing through a single axis of the sphere or ellipsoid.
Also called geometric projection.
Glossary-16
Glossary
Planar projection
A projection resulting from the conceptual projection of the Earth onto
a tangent or secant plane. Usually, a planar projection is the same as
an azimuthal projection. Mathematically, the projection is often only
partially geometric.
Planimetric map
A map representing only the horizontal positions of features (without
their elevations).
Polar aspect
An aspect of a projection, especially an azimuthal one, on which the
Earth is viewed from directly above a pole. This aspect is called
transverse for cylindrical or pseudocylindrical projections.
Pole
Polyconic projection
A specific projection or member of a class of projections that are
constructed like conic projections but with different cones for each
parallel. In the normal aspect, all the parallels of latitude are
nonconcentric circular arcs, except for a straight Equator, and the
centers of these circles lie along a central axis.
Projected coordinate system
A coordinate system defined for a particular map projection and
associated parameters, which normally is planar with well-defined
coordinate origin, handedness, nominal scale, and units of distance.
While map scale can vary at different coordinate locations, a linear
projected coordinate system has constant units of distance.
Projection
A systematic representation of a curved 3-D surface such as the Earth
onto a flat 2-D plane. Each map projection has specific properties that
make it useful for specific purposes. For a list of Mapping Toolbox map
projections, type maps.
Glossary-17
Glossary
Projection parameters
The values of constants as applied to a map projection for a specific
map; examples are the values of the scale, the latitudes of the standard
parallels, and the central meridian. The required parameters vary with
the projection.
Pseudoconic projection
A projection that, in the normal aspect, has concentric circular arcs
for parallels and on which the meridians are equally spaced along the
parallels, like those on a conic projection, but on which meridians are
curved.
Pseudocylindric-al projection
A projection that, in the normal aspect, has straight parallel lines for
parallels and on which the meridians are (usually) equally spaced
along parallels, as they are on a cylindrical projection, but on which
the meridians are curved.
Quadrangle
A region bounded by parallels north and south, and meridians east
and west.
Raster geodata
A georeferenced array or grid of values corresponding to specific
geographic points, usually regularly and rectangularly sampled in
either geographic or map space. Values can be continuous or categorical.
In the case of georeferenced multiband images, raster geodata can take
the form of 3- and higher dimensional arrays.
Reckoning
The determination of geographic position by calculation.
Referencing matrix
A 3-by-2 matrix defining the scaling, orientation, and placement
of raster map data on the globe or in planar map coordinates. The
matrix specifies an affine transformation that ties (geolocates) the
row and column subscripts of an image or regular data grid to 2-D
map coordinates or to geographic coordinates (longitude and geodetic
latitude). See Referencing vector.
Glossary-18
Glossary
Referencing vector
A three-component vector defining the geographic placement and
unit cell size for raster map data. A referencing vector has the form
[cells/degree north-latitude west-longitude], with latitude and
longitude limits specified in degrees.
A referencing vector specifies an affine transformation with rows and
columns aligned to latitude and longitude, respectively, and the same
data spacing in both latitude and longitude. As such, it is more specific
than a referencing matrix. Note that a referencing vector can always
be transformed to a referencing matrix, but only certain referencing
matrices can be transformed to referencing vectors. See Referencing
matrix.
Regional map
A small-scale map of an area covering at least 5 or 10 degrees of latitude
and longitude but less than a hemisphere.
Regular aspect
See Normal aspect.
Regular data grid
A data grid with equally spaced grid points in either latitude-longitude
or map coordinates, defined with a referencing matrix or vector, and
limited to a rectangular shape and cardinal orientation. See Data grid,
Geolocated data grid, Referencing matrix.
Retroazimuthal projection
A projection on which the direction or azimuth from every point on the
map to a given central point is shown correctly with respect to a vertical
line parallel to the central meridian. The reverse of an azimuthal
projection.
Rhumb line
A complex curve (a spherical helix) on a planets surface that crosses
every meridian at the same oblique angle; a navigator can proceed
between any two points along a rhumb line by maintaining a constant
heading. A rhumb line is a straight line on the Mercator projection. Also
called a loxodrome.
Glossary-19
Glossary
Scale
Scale factor
The ratio of the scale at a particular location and direction on a map to
the nominal scale of the map. At a standard parallel, or other standard
line, the scale factor is 1.0.
Secant cone, cylinder, or plane
A secant cone or cylinder intersects the sphere or ellipsoid along two
separate lines; these lines are parallels of latitude if the axes of the
geometric figures coincide. A secant plane intersects the sphere or
ellipsoid along a line that is a parallel of latitude if the plane is at right
angles to the axis.
Selector
A cell array in which the first element is a predicate function and the
remaining elements list the names of attributes in a shapefile. Function
shaperead has an option to screen out any feature in the shapefile for
which a predicate returns false when applied to the subset of attributes
corresponding to the list in the selector.
Shaded relief
Shading added to a map or image that makes it appear to have
three-dimensional aspects. This type of enhancement is commonly done
to satellite images and thematic maps utilizing digital topographic data
to provide the appearance of terrain relief.
Shapefile
A widely used file format for vector geodata designed by Environmental
Systems Research Institute. Shapefiles encode coordinates for points,
multipoints, lines (polylines), or polygons along with tabular attributes.
Singular points
Certain points on most but not all conformal projections at which
conformality fails, such as the poles on the normal aspect of the
Mercator projection.
Glossary-20
Glossary
Skew-oblique aspect
An aspect of a projection on which the axis of the Earth is rotated, so it
is neither aligned with nor perpendicular to the conceptual axis of the
map projection, and tilted, so the poles are at an angle to the conceptual
axis of the map projection.
Small circle
A circle on the surface of a sphere, formed by the intersection with a
plane. Parallels of latitude are small circles on the Earth taken as
a sphere. Mapping Toolbox great circles, including the Equator and
all meridians, are treated as special, limiting cases of small circles.
Mapping Toolbox functions generalize the concept of small circle with
computations for two other types of curve: the locus of points on an
ellipsoid at a given distance (as measured along a geodesic) from a
central point, or the locus of points on a sphere or ellipsoid at a given
distance from a central point, as measured along a rhumb line.
Small-scale mapping
Mapping at a scale smaller than about 1:1,000,000, although the
limiting scale sometimes has been made as large as 1:250,000.
Spatial Data Transfer Standard (SDTS)
A self-documenting geospatial file formatting standard adopted by the
U.S. government and others. SDTS can encode locations, attributes,
topological relationships, data quality, and other metadata. Note that
Mapping Toolbox software can read the SDTS Raster Profile, but does
not currently support SDTS vector data.
Spheroid
See Ellipsoid.
Standard parallel
In the normal aspect of a projection, a parallel of latitude along which
the scale is as stated for that map. There are one or two standard
parallels on most cylindrical and conic map projections and one on many
polar stereographic projections.
State Plane
A set of commensurate coordinate systems commonly used for utility
and surveying applications in the lower 48 United States. Each
Glossary-21
Glossary
Glossary-22
Glossary
longer coincides with the conceptual axis of the projection. Used for
oblique and transverse aspects of many projections.
Transverse aspect
An aspect of a map projection on which the axis of the Earth is rotated
so that it is at right angles to the conceptual axis of the map projection.
For azimuthal projections, this aspect is usually called equatorial rather
than transverse.
True scale
See Correct scale.
Vector data set
Data representing geospatial objects as sequences of geographic
or projected coordinate points that are implicitly connected if they
represent linear or areal shapes. In Mapping Toolbox and other
software, such geodata is often represented by two vectors, one with
latitudes, another with longitudes. Objects can be segmented by
inserting NaNs at the same locations in both vectors. Such pairs of
coordinate vectors can also be represented as the Lat and Lon or X and Y
field values in a geographic data structure array.
Viewshed
The portion of a surface that is visible from a given point on or above it;
derived from the concept of a watershed.
Waypoints
Points through which a trip, track, or transit passes, usually
corresponding to course or speed changes.
WGS 72 (World Geodetic System 1972)
An Earth-centered datum, used as a definition of DMA (now NGA)
DEMs. The WGS 72 datum was the result of an extensive effort
extending over approximately three years to collect selected satellite,
surface gravity, and astrogeodetic data available throughout 1972. This
data was combined using a unified WGS solution (a large-scale least
squares adjustment).
Glossary-23
Glossary
Glossary-24
A
Bibliography
1 Snyder, J.P., Map Projections A Working Manual, U.S. Geological
A-2
Bibliography
B
Examples
Use this list to find examples in the documentation.
Examples
Raster Geodata
A Look at Raster Data on page 2-8
B-2
B-3
Examples
B-4
B-5
Examples
B-6
B-7
B-8
Examples
Index
A
Index
Index-1
Index
axes
map. See map axes
axes, Cartesian. See Cartesian axes
axes2ecc 12-34
using 3-6
axesm 12-35
map frame and 4-46
map grid 4-53
axesm GUI 12-805
axesmui 12-805
axesscale 12-53
using 6-2
azimuth 12-56
between track waypoints 12-336
calculating 12-56
calculating with GUI 12-871
defined 3-42
example of 3-42
finding cross fix position 12-105
in projected coordinates 6-32
azimuthal projection 8-8
B
Babinet projection 15-97
Balthasart Cylindrical projection 15-10
and Equal-Area Cylindrical projection 15-10
balthsrt 15-10
Bartholomew, John
Nordic projection 15-69
base projection 8-16
bearing. See azimuth
behrmann 15-12
Behrmann Cylindrical projection 15-12
and Equal-Area Cylindrical projection 15-12
Behrmann, Walter
Behrmann Cylindrical projection 15-12
Bienewitz, Peter
Apianus projction 15-8
Bolshoi Sovietskii Atlas Mira projection 15-14
Index-2
bonne 15-16
Bonne projection 15-16
and Sinusoidal projection 15-16
and Werner projection 15-16
Bonne, Rigobert
Bonne projection 15-16
Bordone Oval projection 15-86
braun 15-18
Braun
Braun Perspective Cylindrical
projection 15-18
Braun Perspective Cylindrical projection 15-18
and BSAM projection 15-18
and Gall Stereographic projection 15-18
Breusing Harmonic Mean projection 15-20
and Stereographic projection 15-20
Breusing, F. A. Arthur
Breusing projection 15-20
bries 15-22
Briesemeister projection 15-22
and Hammer projection 15-22
Briesemeister, William
Briesemeister projection 15-22
bsam 15-14
BSAM projection 15-14
and Braun Perspective Cylindrical
projection 15-14
buffer zone
defined 7-19
bufferm 12-59
example of 7-20
C
camposm 12-61
camtargm 12-63
camupm 12-65
cart2grn 12-67
Cartesian axes
displaying 12-610
Index
Cartesian coordinates
conversion to geographic 12-67
Cartesian plots
Mapping Toolbox and 6-28
cassini 15-24
Cassini Cylindrical projection 15-24
and Plate Carre projection 15-24
Cassini Cylindrical standard projection 15-26
and Plate Carre projection 15-26
Cassini de Thury, Csar Franois
Plate Carre projection 15-24
Cassini projection 15-105
cassinistd 15-26
ccylin 15-28
Central Cylindrical projection 15-28
and Mercator projection 15-28
and Wetch projection 15-28
Central projection 15-65
changem
example 2-41
Chien Lo-Chih 15-93
choropleth maps 6-18
circcirc 12-69
circles. See great circles. See small circles
clabelm 12-70
clegendm 12-72
clipdata 12-75
clma 12-76
clmo 12-77
GUI 12-818
clrmenu 12-819
coast MAT-file 2-5
collig 15-30
Collignon projection 15-30
Collignon, \x83 douard
Collignon projection 15-30
colorbar 6-37
labeled 6-43
colorbars
nominal 6-44
colorm 12-822
colormaps
annotating 6-43
digital elevation maps 6-34
manipulation with clrmenu GUI 12-819
political data 6-39
regular data grids 12-822
shaded relief map 12-596
surface contour maps 6-37
terrain elevations 12-137
colorui 12-80
combinations
enumerating 12-81
combntns 12-81
comet3m 12-83
cometm 12-84
description 6-24
conic projections
developed 8-7
equidistant standard formulation 15-51
spherical equidistant 15-49
Conical Orthomorphic projection 15-79
standard formulation 15-81
contour maps
adding legend 12-72
creating 2-D 12-96
creating 3-D 12-85
labeling 12-70
contour3m 12-85
contourcmap 12-90
example 6-37
contourfm 12-92
contourm 12-96
conventions
longitude ranges 3-12
conversion
ASCII file delimiters 12-444
Cartesian to geographic coordinates 12-67
distance from degrees 12-131
distance to degrees 12-322
Index-3
Index
Index-4
D
daspectm 12-110
Index
rules of 10-33
Deetz, Charles H.
Craster projection 15-31
defaultm 12-125
deg2km 12-131
example 3-41
deg2nm 12-131
example 3-25
deg2sm 12-131
degrees-minutes-seconds
representing 3-20
degrees2dm 12-133
degrees2dms 12-134
delaunay 6-29
demcmap 12-137
example 6-34
demdataui 12-824
example 5-13
DEMs. See digital elevation maps
departure 10-5 12-139
between meridians 12-139
Digital Chart of the World (DCW)
reading gazette 12-116
reading headers 12-123
reading selected data 12-112
digital elevation maps 6-34
colormap for 6-34
colormaps 12-137
description 2-7
line of sight in 5-19
reading data interactively 5-13
texture mapping color data onto 5-40
display structure 2-27
extracting data 12-199
display structures
interacting with objects 12-842
displaying
surfaces 12-474
displaym 12-141
dist2str 12-145
distance 12-147
E
Earth 12-2
default geoid 3-9
ellipsoid models 3-9
See also almanac
ecc2flat 12-173
ecc2n 12-174
eccentricity 12-34
Eckert I projection 15-33
Index-5
Index
Index-6
Index
F
Fifth Fundamental Catalog of Stars 12-531
fill3m 12-202
fillm 12-204
usage 4-66
filterm 12-206
example 7-25
findm 12-208
example 2-41
fipsname 12-210
fixing. See navigational fixing
Flat-Polar Quartic projection 15-89
flat2ecc 12-211
flatearthpoly 12-212
example 7-17
flatplrp 15-87
flatplrq 15-89
flatplrs 15-91
fournier 15-55
Fournier II projection 15-55
Fournier projection 15-55
Fournier, Georges
Fournier II projection 15-55
frame. See map frame
framem 12-215
map frame and 4-46
fromDegrees 12-216
fromRadians 12-217
G
Gall Isographic projection 15-57
and Equidistant Cylindrical projection 15-57
Gall Orthographic projection 15-59
and Equal-Area Cylindrical projection 15-59
and Peters projection 15-59
Gall projection 15-61
Gall Stereographic projection 15-61
and Braun Perspective Cylindrical
projection 15-61
Gall, James
Gall Orthographic projection 15-59
Gall Stereographic projection 15-61
gcm 12-220
gcpmap 12-223
gcwaypts 12-225
example 10-27
gcxgc 12-227
gcxsc 12-229
and scxsc 7-9
geodata. See geospatial data
geographic coordinates
conversion from data grid 12-589
conversion to data grid 12-594
conversion to equal-area 12-278
selection with mouse 12-311
geographic data structure
creating input to mlayers 12-553
defined 2-16
displaying 12-141
Version 1 2-27
Index-7
Index
Version 2 2-17
geographic data structures
constructing 2-20
geographic mean 10-2
geographic points
standard deviation 12-618
standard distance 12-616
geographic quadrangles
intersecting 12-305
locating points within 12-303
plotting 12-464
geographic standard deviation 10-4
geographic statistics
calculating geographic mean 10-2
calculating geographic standard
deviation 10-4
equal-area coordinate system 10-9
equirectangular binning 10-7
histograms 10-7
geoid
availability for planets 3-46
converting ellipsoid parameters 3-6
defined 3-2
ellipsoid approximation 3-4
ellipsoid models for Earth 3-9
importance of in mapping 5-40
geoid vector
for planets. See almanac
. See ellipsoid vector
geoloc2grid 12-234
geolocated data grids
displaying 4-68
displaying image and surface coloring 4-72
displaying light shading 5-29
displaying shaded relief 5-33
format 2-44
geographic interpretation 2-47
projecting 12-474
projecting on plots 12-624
projecting shaded relief 12-628
Index-8
Index
giso 15-57
globe 15-63
H
hammer 15-69
Index-9
Index
histograms
equal area geographic 12-296
equirectangular geographic 12-298
geographic 10-7
histr 12-298
example 10-7
Homolographic projection 15-97
Homolosine projection 15-67
Hondius, Jodocus
Sinusoidal projection 15-117
hypsometric tints 6-34
intrplat 12-313
intrplon 12-315
J
Jupiter. See almanac
K
I
imbedm 12-300
ind2rgb8 12-302
ingeoquad 12-303
inputm 12-311
example 4-76
waypoint definition with 10-29
inset maps
controlling scale 6-2
creating 6-2
interplat and interp1 7-7
interplon 7-7
interplon and interp1 7-7
interpm 12-312
interpolating vector data with 7-5
interpolation
along a path 7-42
latitude and longitude 7-5
latitudes example 7-7
longitudes 7-7
intersectgeoquad 12-305
intersection
great circles 12-227
great circles and small circles 12-229
object sets 12-105
rhumb lines 12-551
small circles 12-583
Index-10
L
La Carte Parall\x8e logrammatique 15-53
lambcyln 15-83
lambert 15-79 15-81
Lambert Azimuthal Equal-Area projection 15-77
Lambert Conformal Conic projection 15-79 15-81
and Mercator projection 15-79 15-81
Index
M
majaxis 12-352
makattribspec 12-353
makemapped 12-361
Index-11
Index
Index-12
Index
area 8-4
azimuthal 8-8
base 8-16
changing 12-591
changing with geoshow 4-40
choosing 8-63
classifying distortion 8-3
computations 8-37
conformality 8-3
conic 8-7
cylindrical 8-5
defined 8-2
defining 12-35
developable surface 8-3
distance 8-3
equidistance 8-3
equivalence 8-4
forward 12-433
general properties 3-29
planar 12-433
polyconic 8-7
projecting objects 12-505
pseudocylindrical projection
examples 8-6
shape 8-3
switching with setm 4-34
table of properties 8-63
vectors 8-43
visualizing distortions 8-27
map scale
between axes 6-2
when printing 6-45
map text
placement via mouse 12-286
projecting 12-637
map viewer
using 1-9
map2pix 12-374
mapbbox 12-375
maplist 12-376
mapoutline 12-378
mapped objects
converting from standard objects 6-30
manipulating by name 4-81
reprojecting 4-37
trimming to map frame 6-30
Mapping Toolbox
help for 1-26
mapprofile 12-381
example 7-42
maps 12-386
printing 6-45
mapshow 12-388
mapstructs
for polygons 2-26
maptool 12-833
maptrim GUI 12-839
maptriml 12-404
discussion 7-22
maptrimp 12-405
discussion 7-22
maptrims 12-407
mapview 12-409
example 1-9
Marinus of Tyre 15-105
Equidistant Cylindrical projection 15-53
Mars. See almanac
MATLAB graphics
on projected maps 6-28
matrix geodata. See raster geodata
matrix maps. See raster geodata
McBryde, F. Webster
and McBryde-Thomas Flat-Polar Parabolic
projection 15-87
and McBryde-Thomas Flat-Polar Quartic
projection 15-89
and McBryde-Thomas Flat-Polar Sinusoidal
projection 15-91
McBryde-Thomas Flat-Polar Parabolic
projection 15-87
Index-13
Index
use of 4-56
meridians
controlling display 4-53
defined 3-12
distance along 12-424
reckoning position along 12-425
mesh. See graticule mesh
meshgrat 12-426
3-D example 4-72
example 2-50
use of 4-71
meshlsrm 12-429
coloring and shading terrain maps 5-33
meshm 12-431
mfwdtran 12-433
miller 15-95
Miller Cylindrical projection 15-95
Index-14
usage 4-55
MLineLimit
usage 4-55
mobjects 12-845
modsine 15-121
mollweid 15-97
N
n2ecc 12-442
namem 12-443
Index
example 4-82
NaN-separated polygons
topology of 2-26
nanclip 12-444
nanm 12-446
NaNs
in data grids 12-446
National Geographic Society
and Robinson projection 15-115
navfix 12-447
example 10-18
navigation
calculating dead reckoning positions 10-33
calculating waypoints 10-27
connecting waypoints 10-29
course and distance legs 10-30
distance conventions 10-12
fixing position 10-13
functions for 10-11
retrieving time zone for longitude 10-38
units and conventions 10-12
navigational conventions
distance, speed, and angles 10-12
navigational fixing
example 10-18
navfix 12-447
position 10-13
navigational tracks
calculating segments between
waypoints 12-652
connecting waypoints 10-29
displaying 10-29
format 10-12
Neptune. See almanac
neworig 12-450
example 8-49
newpole 12-453
example 8-47
nm2deg 12-322
nm2km 12-326
nm2rad 12-324
nm2sm 12-326
O
objects
assigning tags 12-634
assigning tags with GUI 12-875
deleting 12-77
deleting with GUI 12-818
displaying 12-611
displaying with GUI 12-870
editing properties of 12-853
hiding 12-295
hiding with GUI 12-831
interacting with GUI 12-845
modifying zdata 12-801
modifying zdata with GUI 12-888
projecting to map axes 12-505
repackaging vector 7-2
retrieving handle 12-292
retrieving handle with GUI 12-828
retrieving name 12-443
testing if mapped 12-318
oblique aspect 8-11
onem 12-461
Ordinary Polyconic projection 15-107
org2pol 12-462
orientation
projection 8-10
orientation vectors 8-10
origin
interactive modification 12-848
transformation 12-450
origin property. See projection aspect
origin vectors. See orientation vectors
Index-15
Index
originui 12-848
ortho 15-103
pixcenters 12-478
plabel 12-480
placemarks
from addresses 2-60
planetary data 12-2
Plate Carre projection 15-105
plot3m 12-481
plotm 12-483
example 4-59
Pluto. See almanac
polcmap 12-485
example 6-39
pole transformations 12-462
poltical maps
coloring 6-39
poly2ccw 12-487
poly2cw 12-488
poly2fv 12-489
polybool 12-491
cutting across dateline 7-17
example 7-12
polycon 15-107
polyconic projection
developed 8-7
Polyconic projection 15-107
Polyconic standard projection 15-109
polyconstd 15-109
polycut 12-496
polygon
buffer zones 7-19
displaying as line object 4-58
eliminating date line crossing 7-17
extracting segments 7-2
intersection points 7-10
set operations 7-12
surface area 7-11
polygon maps
functions for 4-66
polygon rings
topology conventions 2-26
P
panzoom 6-45
panzoom GUI 12-850
paperscale 12-467
example 6-45
parallel labels 12-480
ParallelLabel
use of 4-56
parallels
controlling display 4-53
defined 3-11
parallelui 12-852
patch 12-472
patch drawing functions
differences between 4-66
patch maps
functions for 4-66
patch objects
displaying 4-61
filling 12-202
filling 2-D 12-204
filling 2-D and 3-D 12-472
filling separate 12-470
patchesm 12-470
usage 4-66
patchm
usage 4-66
pcarree 15-105
pcolorm 12-474
Index-16
Index
Putnins
P4 and Craster projections 15-31
Putnins P4 projection 15-31
Putnins P5 projection 15-111
Putnins, Reinholds V. 15-111
putnins5 15-111
putpole 12-516
Q
qrydata 12-858
R
rad2km 12-522
rad2nm 12-522
rad2sm 12-522
Index-17
Index
georeferencing 2-33
representing 2-33
resizing 12-547
trimming 12-407
trimming with GUI 12-839
See also data grids
raster maps. See raster geodata
rcurve 12-525
readfields 12-527
readfk5 12-531
readmtx 12-534
reckon 12-538
example 3-39
reckoning 12-538
distances with GUI 12-871
position ahead 3-38
Rectangular projection 15-53
reducem 12-540
referencing matrix
defined 2-33
for image 1-24
referencing vector
defined 2-33
refmat variable 2-33
refmat2vec 12-543
refvec2mat 12-544
regular data grids 2-35
accessing elements 2-40
calculating required matrix size 12-612
creating colormap 12-822
defined 2-35
determining limits 2-36
determining size with scaling 2-43
displaying 4-68
displaying image and surface coloring 4-72
displaying shaded relief 5-33
encoding 12-300
encoding regions 12-867
geographic interpretation 2-38
global 2-35
Index-18
Index
S
Sanson-Flamsteed projection 15-117
satbath 12-561
Saturn. See almanac
scale
between axes 6-2
printing maps to 6-45
scaleruler 12-564
example 6-8
scatterm 12-573
description 6-24
proportional symbol maps 10-8
scircle1 12-575
example 3-34
scircle2 12-578
example 3-34
scircleg 12-581
example 4-78
scirclui 12-863
scxsc 12-583
and gscxsc 7-9
sdtsdemread 12-585
sdtsinfo 12-586
sectorg 12-588
seedm 12-867
selectors
with shapefile data 2-27
semimajor axis 12-352
semiminor axis 12-435
setltln 12-589
example 2-38
setm 12-591
example 4-14
graphic scales 6-8
map frame 4-46
map grid 4-53
setpostn 12-594
example 2-39
shaded relief map
constructing cdata 12-596
Index-19
Index
intersection 12-583
intersection with great circles 12-229
spatial errors
in maps 8-27
spcread 12-614
specifying attributes
for KML output 12-353
speed units
format for navigation functions 10-12
spzerom 12-615
Stab-Werner projection 15-134
Stabius, Johannes
Werner projection 15-134
standard deviation of geographic data 10-4
standard deviation of geographic points 12-618
standard distance of geographic points 12-616
stdist 12-616
defined 10-6
stdm 12-618
defined 10-4
stem plot
example 6-24
stem3m 12-620
description 6-24
stereo 15-119
Stereographic projection 15-119
str2angle 12-622
Sun. See almanac
surface area
accessing from almanac 3-47
measuring polygons 7-11
planets. See almanac
polygon 12-15
quadrangle 12-21
regular data grids 12-18
surface aspect
defined 7-44
surface distance
along a parallel 12-139
between track waypoints 12-336
Index-20
T
tagm 12-634
tagm GUI 12-875
tbase 12-635
textm 12-637
texture mapping
Index
Thales
Gnomonic projection 15-65
thematic maps
3-D bar graphs 6-24
comet maps 6-24
quiver maps 6-24
scatter maps 6-24
tissot maps 6-24
Thomas, Paul D.
and McBryde-Thomas Flat-Polar Parabolic
projection 15-87
and McBryde-Thomas Flat-Polar Quartic
projection 15-89
and McBryde-Thomas Flat-Polar Sinusoidal
projection 15-91
TIGER data
reading FIPS name files 12-210
TIGER/Line data 12-640
tightmap 12-643
printing maps 6-45
time zones
determining from longitude 12-644
for navigation 10-38
navigational 10-36
timezone 12-644
example 10-39
tissot 12-646
description 6-24
example 8-27
tissot indicatrices
projecting 12-646
Tissot Modified Sinusoidal projection 15-121
Tissot, N. A.
Tissot Modified Sinusoidal projection 15-121
Tobler, Waldo R. 15-86
toDegrees 12-650
topo DEM 2-7
description 10-29
track waypoints
azimuth 12-336
distance 12-336
track1 12-655
example 3-39
track2 12-658
example 4-60
vs. track1 3-39
trackg 12-660
example 4-78
tracks. See great circles. See rhumb lines
trackui 12-877
tranmerc 15-122
transformation of coordinate system 8-45 12-554
See also coordinate transformation
transverse aspect 8-11
transverse Mercator projection
example 8-60
Transverse Mercator projection 15-122
and UTM 15-122
trimcart 12-662
and mapped objects 6-30
trimdata 12-664
trimming data 7-22
trimming map data
attribute filtering 7-25
trisurf 6-29
trystan 15-124
Trystan Edwards Cylindrical projection 15-124
and Equal-Area Cylindrical
projection 15-124
Tunhuang star chart 15-93
two-column ASCII geodata
reading 12-614
Index-21
Index
U
uimaptbx 12-881
undoclip 12-665
undotrim 12-666
units
testing for valid abbreviations 12-669
testing for valid strings 12-669
unitsratio 12-667
examples 3-17
unitstr 12-669
Universal Polar Stereographic projection 15-126
and UTM 15-126
limits 8-51
Universal Transverse Mercator system 15-127
and Gauss-Kr\x9f ger 15-127
and Transverse Mercator projection 15-127
military mapping 15-127
unprojection
geographic data 12-436
unwrapMultipart 12-671
updategeostruct 12-674
ups 15-126
UPS projection 15-126
Uranus. See almanac
usamap 12-678
using 4-7
userdata
Index-22
V
Van der Grinten I projection 15-128
Van der Grinten, Alphons J.
Van der Grinten I projection 15-128
vec2mtx 12-697
vector data. See vector geodata
vector geodata
calculating intersections 7-8
converting to grid 12-839
defined 2-4
displaying as lines with linem 12-343
displaying as lines with plot3m 12-481
displaying as lines with plotm 12-483
extracting from data structures 12-199
filtering 12-206
geographic interpolation 7-5
mean location 12-422
reducing 12-540
representing 2-13
simplifying/reducing 7-25
structures 2-16
trimming data to a region 7-22
trimming lines 12-404
trimming polygons 12-405
trimming vector via attributes 7-25
vector maps
delineation of objects in 2-14
displaying as lines 4-58
displaying as patches 4-61
projected directions 8-43
Venus. See almanac
Index
vertical exaggeration
daspectm 5-23
Vertical Perspective Azimuthal projection 15-130
and Orthographic projection 15-130
vfwdtran 6-32 12-700
and direction vectors 8-44
vgrint1 15-128
viewshed 12-703
defined 5-20
example 5-20
vinvtran 12-709
vmap0data 12-712
vmap0read 12-716
vmap0rhead 12-719
vmap0ui 12-884
volume of planets 3-47 12-2
See also almanac
von Hammer, H. H. Ernst
Hammer projection 15-69
vperspec 15-130
W
Wagner I projection 15-75
Wagner IV projection 15-132
Wagner, Karlheinz
Wagner I projection 15-75
Wagner IV projection 15-132
wagner4 15-132
waypoints 12-652
calculating 10-27
calculating on great circle 12-225
connecting 10-29
in navigation 10-12
selecting with mouse 10-29
See also track waypoints
werner 15-134
Werner projection 15-134
Werner, Johannes
Werner projection 15-134
wetch 15-136
Wetch Cylindrical projection 15-136
and Central Cylindrical projection 15-136
Wetch, J.
Wetch Cylindrical projection 15-136
wiechel 15-138
Wiechel projection 15-138
Wiechel, H.
Wiechel projection 15-138
winkel 15-140
Winkel I projection 15-140
and Eckert V projection 15-140
and Equidistant Cylindrical
projection 15-140
and Sinusoidal projection 15-140
Winkel, Oswald
Winkel I projection 15-140
worldfileread 12-790
worldfiles
creating from mapview 1-23
reading with worldfileread 1-24
worldfilewrite 12-791
worldmap 12-792
introduction to 1-4
using 4-5
wrapTo180 12-797
wrapTo2Pi 12-799
wrapTo360 12-798
wrapToPi 12-800
Wright projection 15-93
Wright, Edward 15-93
Y
Young, A. E.
Breusing projection 15-20
Z
zdatam 12-801
Index-23
Index
GUI 12-888
Zenithal Equal-Area projection 15-77
Zenithal Equivalent projection 15-77
zero22pi 12-803
Index-24
zerom 12-804
zeros 12-615
zooming in and out of map displays 12-850