wmline
(To be removed) Display geographic line on web map
The wmline
function will be removed in a future release. Use a
geographic axes object and the geoplot
function instead. For information on updating your code, see Version History.
Description
wmline(
displays a line overlay based
on the vector geographic features stored in P
)P
.
wmline(
displays the
line overlay on the web map specified by the web map handle,
wm
,___)wm
.
wmline(___,
specifies name-value pairs that set additional display properties.Name,Value
)
returns a
handle to line overlay.h
= wmline(___)
Examples
Geocode the cities of London and Paris.
london = geocode("London, England","city"); paris = geocode("Paris, France","city");
Display a line from London to Paris on a web map.
wmline([london; paris])
Input Arguments
Latitudes of vertices, specified as a matrix.
Data Types: single
| double
Longitudes of vertices, specified as a matrix.
Data Types: single
| double
Geographic features, specified as one of the following:
A geospatial table containing
geopointshape
,geolineshape
, orgeopolyshape
objects. Thewmline
function does not support geospatial tables containing more than one type of shape object. For more information about geospatial tables, see Create Geospatial Tables.A
geopoint
vector.A
geoshape
vector.
If P
is a geospatial table containing
geopointshape
objects or a geopoint
vector, then the overlay contains a single line connecting the
vertices.
If P
is a geospatial table containing
geolineshape
or geopolyshape
objects,
or a geoshape
vector, then the overlay contains one line
feature for each feature of P
.
Web map, specified as a web map handle.1
Name-Value Arguments
Specify optional pairs of arguments as
Name1=Value1,...,NameN=ValueN
, where Name
is
the argument name and Value
is the corresponding value.
Name-value arguments must appear after other arguments, but the order of the
pairs does not matter.
Before R2021a, use commas to separate each name and value, and enclose
Name
in quotes.
Example: wmline(lat,lon,'OverlayName','Shortest
Route');
Overlay visibility, specified as the comma-separated pair consisting
of 'Autofit'
and the scalar logical or numeric value
true
(1
) or
false
(0
).
If
true
,wmline
adjusts the spatial extent of the map to ensure that all the vector overlays on the map are visible.If
false
,wmline
does not adjust the spatial extent when this vector layer is added to the map.
Data Types: double
| logical
Description of feature, specified as the comma-separated pair
consisting of 'Description'
and a character vector,
cell array of character vectors, or a scalar structure. The description
defines the content of the description balloon displayed when you click
the feature in a web map. Description elements can be either plain text
or HTML markup. When an attribute spec is provided, the display in the
balloon for the attribute fields of P
are modified
according to the specification.
If you specify a scalar cell array,
wmline
applies the value to all line features.If you specify a nonscalar cell array, the cell array must contain a value for each feature, that is, the cell array must be the same length as
P
.If the value is a structure,
wmline
applies the attribute specification to each line.
Data Types: char
| struct
| cell
Name of overlay layer, specified as the comma-separated pair
consisting of 'OverlayName'
and a character vector.
wmline
inserts the name in the Layer Manager
under the "Overlays" item. The Layer Manager is the tool that appears on
the right side of the web map. The default name is 'Line
Overlay
where
N
'N
is the number assigned to this
overlay.
Data Types: char
Name of feature, specified as the comma-separated pair consisting of
'FeatureName'
and character vector or cell array
of character vectors. The name appears in the balloon that displays when
you click the feature in the web map. The default value is
'
, where
OverlayName
: Line
K
'OverlayName
is the name of the overlay
and K
is the number assigned to the
particular line.
If the value is a character vector, it applies to all features.
If the value is a cell array of character vectors, it must be either a scalar or the same length as
P
.
Data Types: char
| cell
Line color, specified as the comma-separated pair consisting of
'Color'
and one of these options.
A color name such as
'red'
or a short name such as'r'
.An RGB triplet, which is a three-element row vector whose elements specify the intensities of the red, green, and blue components of the color. The intensities must be in the range
[0,1]
; for example,[0.4 0.6 0.7]
.A cell array of color names such as
{'red','green','blue'}
or{'r','g','b'}
.A string vector of color names such as
["red" "green" "blue"]
or["r" "g" "b"]
.A matrix of RGB triplets, which is a three-column matrix in which each row is an RGB triplet.
The way you specify the color depends on the desired color scheme.
To apply the same color to all lines in
P
, specify a single color name or RGB triplet.To apply a different color to each line in
P
, specify a cell array of color names, a string vector of color names, or a matrix of RGB triplets. The number of colors and RGB triplets must match the length ofP
.
This table contains the color names and equivalent RGB triplets for some common colors.
Color Name | Short Name | RGB Triplet | Appearance |
---|---|---|---|
"red" | "r" | [1 0 0] |
|
"green" | "g" | [0 1 0] |
|
"blue" | "b" | [0 0 1] |
|
"cyan"
| "c" | [0 1 1] |
|
"magenta" | "m" | [1 0 1] |
|
"yellow" | "y" | [1 1 0] |
|
"black" | "k" | [0 0 0] |
|
"white" | "w" | [1 1 1] |
|
Data Types: char
| string
| cell
| double
Width of line in pixels, specified as the comma-separated pair
consisting of LineWidth
and a positive numeric scalar
or vector. If you specify a vector, it must include a value for each
line, that is, the vector must be the same length as
P
.
Data Types: single
| double
| int8
| int16
| int32
| int64
| uint8
| uint16
| uint32
| uint64
Transparency of line, specified as the comma-separated pair consisting
of 'Alpha'
and a numeric scalar or vector. If you
specify a vector, it must include a value for each line, that is, the
vector must be the same length as P
. The default
value, 1
, means that the line is fully opaque.
Data Types: single
| double
| int8
| int16
| int32
| int64
| uint8
| uint16
| uint32
| uint64
Output Arguments
Overlay layer, returned as a handle to a line overlay.
Tips
Under certain conditions, when you zoom in on a line overlay in a web map, parts of the line may become invisible. This can occur if the data is one long line segment that is composed of many parts. To work around this issue, break the long line into a series of line segments by inserting
NaN
values in the line data.
Version History
Introduced in R2013bWeb maps will be removed in a future release,
including the wmline
function. Use a geographic axes
object and the geoplot
function instead.
Unlike web maps, geographic axes enable you to:
Display data using additional plot types, including density plots and bubble charts.
Customize your maps using MATLAB® graphics functions.
Build apps using App Designer.
This table shows some typical uses of the wmline
function and how to update your code to use a geographic axes object and the
geoplot
function.
To Be Removed | Recommended |
---|---|
Display a line using the specified latitude and longitude coordinates.
wmline(lat,lon) | Display a line using the specified latitude and longitude coordinates.
geoplot(lat,lon) |
Display a line using the line shapes stored in the
geospatial table
wmline(GT) | Display a line using the line shapes stored in the
geospatial table
geoplot(GT) |
Display a line using the coordinates stored in the
wmline(P) | Extract the latitude and longitude coordinates from the
lat = P.Latitude; lon = P.Longitude; geoplot(lat,lon) |
Specify the line color by using the
wmline(lat,lon,Color=colorValue) | Specify the line color by using the
geoplot(lat,lon,Color=colorValue) To use a different color for each line, display the
lines using a loop. This code shows how to display each line
in a geospatial table
geobasemap streets-light hold on for k = 1:height(GT) row = GT(k,:); geoplot(row,Color=colorValue(k)) end |
Specify the line width by using the
wmline(lat,lon,LineWidth=widthValue) | Specify the line width by using the
geoplot(lat,lon,LineWidth=widthValue) |
Specify information about the feature, for use in
information balloons, by using the
wmline(lat,lon,FeatureName=fn,Description=d) | Display information about the icon data by using custom data tips. For examples that show how to create custom data tips, see Create Custom Data Tips and Add Data Tips to Point, Line, and Polygon Shapes. |
Depending on the input data, the geoplot
function creates
different types of Line
objects.
When you specify coordinates as input, the function creates a chart
Line
object. For information about the properties of chartLine
objects, see Line Properties.When you specify a geospatial table as input, the function creates a geographic chart
Line
object. For information about the properties of geographic chartLine
objects, see Line Properties.
To display multiple data sets using the same geographic axes object, set the hold
state to on
by using the hold
function.
For more information about migrating your web maps to geographic axes, see Web Map Migration Strategies.
The wmline
function accepts geospatial tables as
input.
See Also
1 Alignment of boundaries and region labels are a presentation of the feature provided by the data vendors and do not imply endorsement by MathWorks®.
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)