Main Content

gcpmap

Identify current point on axesm-based map using mouse

Syntax

pt = gcpmap
pt = gcpmap(hndl)

Description

pt = gcpmap returns the current point (the location of last button click) of the current axesm-based map in the form [latitude longitude z-altitude].

pt = gcpmap(hndl) specifies the axesm-based map in question by its handle.

Examples

Set up an axesm-based map with a graticule and display a world map:

axesm robinson
gridm on
geoshow('landareas.shp')

Click somewhere near Boston, Massachusetts to obtain a current point:

pt = gcpmap

pt =
       44.171      -69.967            2
       44.171      -69.967            0
whos

  Name      Size                    Bytes  Class         Attributes
  pt        2x3                        48  double array

Tips

gcpmap works much like the standard MATLAB® function get(gca,'CurrentPoint'), except that the returned matrix is in [lat lon z], not [x y z].

You must use view(2) and an ordinary projection (not the Globe projection) when working with the gcpmap function.

The CurrentPoint property is updated whenever a button-click event occurs in a MATLAB figure window. The pointer does not have to be within the axes, or even the figure window. Coordinates with respect to the requested axes are returned regardless of the pointer location. Likewise, gcpmap will return values that may look reasonable whether the current point is within the graticule bounds or not, and thus must be used with care.

Version History

Introduced before R2006a

See Also