idlastro / Web Socket Procedures: QUERYSIMBAD

[Source code]

NAME
QUERYSIMBAD
PURPOSE
Query the SIMBAD/NED/Vizier astronomical name resolver to obtain coordinates
EXPLANATION
Uses the IDL SOCKET command to query either the SIMBAD or NED nameserver 
over the Web to return J2000 coordinates.  By default, QuerySimbad 
first queries the Simbad database, then (if no match found) the NED 
database, and then the Vizier database.
For details on the SIMBAD service, see http://simbad.u-strasbg.fr/Simbad 
and for the NED service, see http://ned.ipac.caltech.edu/
CALLING SEQUENCE
QuerySimbad, name, ra, dec, [ id, Found=, /NED, /CADC, ERRMSG=, /VERBOSE]
    /PRINT, Vmag=V, Jmag=J, Hmag=H, Kmag=Kmag, parallax=parallax
INPUTS
name - a scalar string containing the target name in SIMBAD (or NED)
       nomenclature. For SIMBAD details see
       http://vizier.u-strasbg.fr/cgi-bin/Dic-Simbad .
OUTPUTS
ra -  Right ascension of the target in J2000.0 in *degrees*, scalar 
dec - declination of the target in degrees, scalar
OPTIONAL INPUT KEYWORD
/CFA - if set, then use the Simbad server at the Center for Astrophysics
        rather than the default server in Strasbourg, France.
ERRMSG   = If defined and passed, then any error messages will be
             returned to the user in this parameter rather than
             depending on the MESSAGE routine in IDL.  If no errors are
             encountered, then a null string is returned. 
/NED - if set, then only the nameserver of the NASA Extragalactic database
       is used to resolve the name and return coordinates.   Note that
      /NED cannot be used with Galactic objects
/VERBOSE - If set, then the HTTP-GET command is displayed
/PRINT - if set, then output coordinates are displayed at the terminal 
       By default, the coordinates are displayed if no output parameters
      are supplied to QUERYSIMBAD
/SILENT - If set, then don't print warnings if multiple SIMBAD objects
        correspond to the supplied name.
OPTIONAL OUTPUT
id - the primary SIMBAD (or NED) ID of the target, scalar string
     As of June 2009, a more reliable ID seems to be found when using 
     CFA (/CFA) server.
OPTIONAL KEYWORD OUTPUTS
found - set to 1 if the translation was successful, or to 0 if the
      the object name could not be translated by SIMBAD or NED
Errmsg - if supplied, then any error messages are returned in this
       keyword, rather than being printed at the terminal.   May be either
       a scalar or array.
Server - Character indicating which server was actually used to resolve
      the object, 'S'imbad, 'N'ed or 'V'izier
Vmag - supply to receive the SIMBAD V magnitude 
Jmag - supply to receive the SIMBAD J magntiude
Hmag - supply to receive the SIMBAD H magnitude 
Kmag - supply to receive the SIMBAD K magnitude 
Parallax - supply to receive the SIMBAD parallax in milliarcseconds
EXAMPLES
(1) Display the J2000 coordinates for the ultracompact HII region
    G45.45+0.06 
 IDL> QuerySimbad,'GAL045.45+00.06'
      ===>19 14 20.77  +11 09  3.6
PROCEDURES USED
REPSTR(), WEBGET()
NOTES
The actual  query is made to the Sesame name resolver 
( see http://cdsweb.u-strasbg.fr/doc/sesame.htx ).     The Sesame
resolver first searches the Simbad name resolver, then  NED and then
Vizier.   
MODIFICATION HISTORY
Written by M. Feldt, Heidelberg, Oct 2001   
Minor updates, W. Landsman   August 2002
Added option to use NED server, better parsing of SIMBAD names such as 
     IRAS F10190+5349    W. Landsman  March 2003
Turn off extended name search for NED server, fix negative declination
with /NED    W. Landsman  April 2003
Use Simbad Sesame sever, add /Verbose, /CADC keywords 
  B. Stecklum, TLS Tautenburg/ W. Landsman, Feb 2007
pdate NED query to account for new IPAC format, A. Barth  March 2007
pdate NED query to account for another new IPAC format, A. Barth  
                                              July 2007
Update message when NED does not find object  W.L.  October 2008
Remove CADC keyword, add CFA keyword, warning if more than two
    matches  W.L. November 2008 
Make NED queries through the Sesame server, add Server output 
     keyword  W.L.  June 2009
Don't get primary name if user didn't ask for it  W.L. Aug 2009
Added /SILENT keyword W.L. Oct 2009
Added /PRINT keyword W.L.   Oct 2011
Added ability to get V, J, H, and K magnitudes as well as
a parallax - jswift, Jan 2014