Main Content


Identify current point on axesm-based map using mouse


pt = gcpmap
pt = gcpmap(hndl)


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.


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

axesm robinson
gridm on

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

pt = gcpmap

pt =
       44.171      -69.967            2
       44.171      -69.967            0

  Name      Size                    Bytes  Class         Attributes
  pt        2x3                        48  double array

Map of global land areas


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