'Finds the nearest on-sky matches of this coordinate in a set of
catalog coordinates.
For more on how to use this (and related) functionality, see the
examples in :doc:`/coordinates/matchsep`.
Parameters
catalogcoord : `~astropy.coordinates.SkyCoord` or `~astropy.coordinates.BaseCoordinateFrame`
The base catalog in which to search for matches. Typically this
will be a coordinate object that is an array (i.e.,
``catalogcoord.isscalar == False``)
nthneighbor : int, optional
Which closest neighbor to search for.  Typically ``1`` is
desired here, as that is correct for matching one set of
coordinates to another. The next likely use case is ``2``,
for matching a coordinate catalog against *itself* (``1``
is inappropriate because each point will find itself as the
closest match).
Returns
idx : integer array
Indices into ``catalogcoord`` to get the matched points for
each of this object\'s coordinates. Shape matches this
object.
sep2d : `~astropy.coordinates.Angle`
The on-sky separation between the closest match for each
element in this object in ``catalogcoord``. Shape matches
this object.
dist3d : `~astropy.units.Quantity`
The 3D distance between the closest match for each element
in this object in ``catalogcoord``. Shape matches this
object.
Notes
This method requires `SciPy <http://www.scipy.org>`_ to be
installed or it will fail.
See Also
astropy.coordinates.match_coordinates_sky
SkyCoord.match_to_catalog_3d'

def match_to_catalog_sky(self, catalogcoord, nthneighbor=1):

    from .matching import match_coordinates_sky
    if (isinstance(catalogcoord, (SkyCoord, BaseCoordinateFrame)) and catalogcoord.has_data):
        self_in_catalog_frame = self.transform_to(catalogcoord)
    else:
        raise TypeError(u'Can    only    get    separation    to    another    SkyCoord    or    a    coordinate    frame    with    data')
    res = match_coordinates_sky(self_in_catalog_frame, catalogcoord, nthneighbor=nthneighbor, storekdtree=u'_kdtree_sky')
    return res
