Main Content


Current mouse point from map axes


pt = gcpmap
pt = gcpmap(hndl)


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

pt = gcpmap(hndl) specifies the map axes in question by its handle.


Set up a map axes 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


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.

See Also

Introduced before R2006a