meshgrat
(Removed) Construct map graticule for surface object display
The meshgrat
function has been removed. Use the geographicGrid
, linspace
, or ndgrid
function instead. For more
information, see Version History.
Syntax
[lat, lon] = meshgrat(Z, R)
[lat, lon] = meshgrat(Z, R, gratsize)
[lat, lon] = meshgrat(lat, lon)
[lat, lon] = meshgrat(latlim, lonlim,
gratsize)
[lat, lon] = meshgrat(lat, lon, angleunits)
[lat,
lon] = meshgrat(latlim, lonlim,
angleunits)
[lat, lon] = meshgrat(latlim, lonlim, gratsize, angleunits)
Description
[lat, lon] = meshgrat(Z, R)
constructs a graticule for use in
displaying a regular data grid, Z
. In typical usage, a
latitude-longitude graticule is projected, and the grid is warped to the graticule
using MATLAB® graphics functions. In this two-argument calling form, the graticule
size is equal to the size of Z
. R
can be a
geographic raster reference object, a referencing vector, or a referencing matrix.
If R
is a geographic raster reference object, its
RasterSize
property must be consistent with
size(Z)
.
If R
is a referencing vector, it must be 1-by-3 with elements:
[cells/degree northern_latitude_limit western_longitude_limit]
R
is a referencing matrix, it must be 3-by-2 and
transform raster row and column indices to/from geographic coordinates according
to: [lon lat] = [row col 1] * R
R
is a referencing matrix, it must define a
(non-rotational, non-skewed) relationship in which each column of the data grid
falls along a meridian and each row falls along a parallel.[lat, lon] = meshgrat(Z, R, gratsize)
produces a graticule of
size gratsize
. gratsize
is a two-element
vector of the form [number_of_parallels number_of_meridians]
.
If gratsize = []
, 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.
[lat, lon] = meshgrat(lat, lon)
takes the
vectors lat
and lon
and returns graticule
arrays of size numel(lat)-by-numel(lon)
. In this form,
meshgrat
is similar to the MATLAB function meshgrid
.
[lat, lon] = meshgrat(latlim, lonlim,
gratsize)
returns a graticule mesh of size gratsize
that
covers the geographic limits defined by the two-element vectors
latlim
and lonlim
.
[lat, lon] = meshgrat(lat, lon, angleunits)
,
[lat,
lon] = meshgrat(latlim, lonlim,
angleunits)
, and
[lat, lon] = meshgrat(latlim, lonlim, gratsize, angleunits)
where angleunits
can be either 'degrees'
(the default) or 'radians'
.
The graticule mesh is a grid of points that are projected on an
axesm
-based map 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.
Examples
Make a (coarse) graticule for the entire world:
latlim = [-90 90]; lonlim = [-180 180]; [lat,lon] = meshgrat(latlim,lonlim,[3 6])
lat = -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 lon = -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 data such as the elevation
data in topo60c
can be warped to the grid.