Mapping Toolbox | ![]() ![]() |
Construct a map graticule mesh for surface object display
Syntax
[latgrat,longrat] = meshgrat(map,maplegend) [latgrat,longrat] = meshgrat(map,maplegend,npts) [latgrat,longrat] = meshgrat(lat,lon) [latgrat,longrat] = meshgrat(lat,lon,units
) [latgrat,longrat] = meshgrat(latlim,lonlim,npts) [latgrat,longrat] = meshgrat(latlim,lonlim,npts,units
)
Description
The graticule mesh is a grid of points that are projected on a map axes and to which surface map objects are warped. The fineness, or resolution, of this grid determines the quality of the projection and the speed of plotting. There is no hard and fast rule for sufficient graticule resolution, but in general, cylindrical projections need very few graticules in the longitudinal direction, while complex curve-generating projections require more.
[latgrat,longrat] = meshgrat(map,maplegend) constructs a graticule for the regular matrix map, map
, with the associated map legend vector maplegend
. The default graticule size is equal to the size of the map matrix.
[latgrat,longrat] = meshgrat(map,maplegend,npts) returns a graticule mesh of size npts
. The input npts
is a two-element vector of the form [latitude-points longitude-points]
. If npts
is set to an empty matrix, then the graticule returned is the Mapping Toolbox default graticule size [50 100]
.
[latgrat,longrat] = meshgrat(lat,lon) can be used for matrix maps that are not regular in spacing (e.g., row one represents 1º, row two represents 1.34º) but are regular in orientation (rows are north-south, columns are east-west). The inputs lat
and lon
are vectors describing the latitudes and longitudes on a row-by-row and column-by-column basis for the matrix map to be displayed. Regardless of the variable spacing of the matrix, the graticule will be evenly spaced. In this form, meshgrat
is similar to the MATLAB function meshgrid
.
[latgrat,longrat] = meshgrat(latlim,lonlim,npts) returns a graticule mesh, of size npts
. The input vectors latlim
and lonlim
are two-element vectors specifying the graticule latitude and longitude limits. The input npts
is a two-element vector of the form [latitude-points longitude-points]
. If npts
is set to an empty matrix, then the graticule returned is the Mapping Toolbox default graticule size [50 100].
[latgrat,longrat] = meshgrat(lat,lon,units
) and [latgrat,longrat] = meshgrat(latlim,lonlim,npts,units
) use the input units
to specify the angle units of the input and output parameters. If omitted, 'degrees'
are assumed.
Examples
Make a (coarse) graticule for the entire world:
latlim = [-90 90]; longlim = [-180 180]; [latgrat,longrat] = meshgrat(latlim,longlim,[3 6]) latgrat = -90.0000 -90.0000 -90.0000 -90.0000 -90.0000 -90.0000 0 0 0 0 0 0 90.0000 90.0000 90.0000 90.0000 90.0000 90.0000 longrat = -180.0000 -108.0000 -36.0000 36.0000 108.0000 180.0000 -180.0000 -108.0000 -36.0000 36.0000 108.0000 180.0000 -180.0000 -108.0000 -36.0000 36.0000 108.0000 180.0000
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
meshm |
Regular matrix map warped to projected graticule mesh |
pcolorm |
Project a matrix map in the z = 0 plane |
surfacem |
Matrix map warped to projected graticule mesh |
surfm |
Matrix map projected a map axes |
![]() | meanm | meshlsrm | ![]() |