wmpolygon
(To be removed) Display geographic polygon on web map
The wmpolygon function will be removed in a future release. Use a
geographic axes object, a geopolyshape
object, and the geoplot
function instead. For information on updating your code, see Version History.
Description
wmpolygon( displays a polygon overlay
based on the vector geographic features stored in P)P. The
overlay contains one polygon feature for each element of
P.
wmpolygon( displays
the overlay in the web map specified by the web map handle,
wm,___)wm.
wmpolygon(___,
specifies name-value pairs that set additional display properties.Name,Value)
returns a
handle to the overlay.h = wmpolygon(___)
Examples
Load the latitude and longitude coordinates of world coastlines from a MAT file. Display the coordinates using a polygon on a web map.
load coastlines
wmpolygon(coastlat,coastlon)
Input Arguments
Latitude vertices, specified as matrix in the range [-90, 90].
Data Types: single | double
Longitude of vertices, specified as a matrix.
Data Types: single | double
Geographic features, specified as one of the following:
A geospatial table containing
geopolyshapeobjects. For more information about geospatial tables, see Create Geospatial Tables.A
geoshapevector with polygon geometry.
Web map, specified as a handle to a web map.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: wmpolygon(lat,lon,'Autofit',true)
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,wmpolygonadjusts the spatial extent of the map to ensure that all the vector overlays on the map are visible.If
false,wmpolygondoes not adjust the spatial extent of the map when this vector layer is added to the map.
Data Types: single | double | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64 | 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.
If you specify a character vector, the text defines the content displayed in the description balloon, which appears when you click the feature in the web map. Description elements can be either plain text or marked up with HTML markup.
If you specify a cell array, it must be either a scalar or the same length as
P, and specifies the description for each polygon.If the value is a structure (attribute specification),
wmpolygondisplays the attribute fields ofPin the balloon, modified according to the specification.
Data Types: char | struct | cell
Name of overlay layer, specified as the comma-separated pair
consisting of 'OverlayName' and a character vector.
wmpolygon 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 'Polygon
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 when you click the
feature in the web map. The default value is
', where
OverlayName: Polygon
K'OverlayName is the name of the overlay
and K is the number assigned to the
particular polygon.
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
Color of polygon faces, specified as the comma-separated pair
consisting of 'FaceColor' 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 face color to all polygons in
P, specify a single color name or RGB triplet.To apply a different color to each polygon 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.To create polygons with no fill, specify
'none'.
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
Transparency of polygon faces, specified as the comma-separated pair
consisting of 'FaceAlpha' and a numeric scalar or
vector in the range [0, 1]. The default value, 1,
means that the polygon is fully opaque.
If the value is a scalar, it applies to all polygon faces.
If the value is a vector, it must be the same length as
P.
Data Types: single | double | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64
Color of polygon edges, specified as the comma-separated pair
consisting of 'EdgeColor' 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 edge color to all polygons in
P, specify a single color name or RGB triplet.To apply a different edge color to each polygon 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.To create polygons with no edge color, specify
'none'.
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
Transparency of polygon edges, specified the comma-separated pair
consisting of 'EdgeAlpha' and as a numeric scalar or
vector in the range [0, 1].
If the value is a scalar, it applies to all polygon faces.
If the value is a vector, it must be the same length as
P.
Data Types: single | double | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64
Width of polygon edges, specified as the comma-separated pair
consisting of 'LineWidth' and a positive numeric
scalar or vector.
If the value is a scalar, it applies to all polygon faces.
If the value is a vector, it must be the same length as
P.
Data Types: single | double | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64
Output Arguments
Polygon overlay, returned as a handle to the polygon overlay.
Tips
When you move the cursor over the polygons you define on an image and click,
wmpolygondisplays a description balloon and disables panning. If you move the cursor off the polygon, you can still click and pan the image. You can also use the arrow keys to pan the image.
Version History
Introduced in R2016aWeb maps will be removed in a future release,
including the wmpolygon function. Use a geographic axes
object, a geopolyshape 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 wmpolygon
function and how to update your code to use a geographic axes object, a
geopolyshape object, and the geoplot
function.
| To Be Removed | Recommended |
|---|---|
Display a polygon using the specified latitude and longitude coordinates.
wmpolygon(lat,lon) | Create a polygon shape from the latitude and longitude
coordinates. Use the polygon shape as input to
pshape = geopolyshape(lat,lon); geoplot(pshape) |
Display a polygon using the polygon shapes stored in
the geospatial table
wmpolygon(GT) | Display a polygon using the polygon shapes stored in
the geospatial table
geoplot(GT) |
Display a polygon using the coordinates stored in the
wmpolygon(P) | Extract the latitude and longitude coordinates from the
lat = P.Latitude; lon = P.Longitude; pshape = geopolyshape(lat,lon); geoplot(pshape) |
Specify the polygon face color by using the
wmpolygon(GT,FaceColor=colorValue) | Specify the polygon face color by using the
geoplot(GT,FaceColor=colorValue) To use a different face color for each polygon,
display the polygons using a loop. This code shows how to
display each polygon in a geospatial table
geobasemap streets-light hold on for k = 1:height(GT) row = GT(k,:); geoplot(row,FaceColor=colorValue(k)) end |
Specify the polygon face transparency by using the
wmpolygon(GT,FaceAlpha=alphaValue) | Specify the polygon face transparency by using the
geoplot(GT,FaceAlpha=alphaValue) |
Specify the polygon edge color by using the
wmpolygon(GT,EdgeColor=colorValue) | Specify the polygon edge color by using the
geoplot(GT,EdgeColor=colorValue) |
Specify the polygon edge transparency by using the
wmpolygon(GT,EdgeAlpha=alphaValue) | Specify the polygon edge transparency by using the
geoplot(GT,EdgeAlpha=alphaValue) |
Specify the width of the polygon edges by using the
wmline(GT,LineWidth=widthValue) | Specify the width of the polygon edges by using the
geoplot(GT,LineWidth=widthValue) |
Specify information about the feature, for use in
information balloons, by using the
wmline(GT,FeatureName=fn,Description=d) | Display information about the icon data by using custom data tips. For an example that shows how to create custom data tips, see Add Data Tips to Point, Line, and Polygon Shapes. |
When you specify polygon data as input to the geoplot
function, the function creates a Polygon object. For information
about the properties of Polygon objects, see Polygon 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 wmpolygon function accepts geospatial tables as
input.
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.
Sélectionner un site web
Choisissez un site web pour accéder au contenu traduit dans votre langue (lorsqu'il est disponible) et voir les événements et les offres locales. D’après votre position, nous vous recommandons de sélectionner la région suivante : .
Vous pouvez également sélectionner un site web dans la liste suivante :
Comment optimiser les performances du site
Pour optimiser les performances du site, sélectionnez la région Chine (en chinois ou en anglais). Les sites de MathWorks pour les autres pays ne sont pas optimisés pour les visites provenant de votre région.
Amériques
- 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)