NAME:
  starchart
 PURPOSE:   (one line only)
  Generate a star chart graphic
 DESCRIPTION:
 CATEGORY:
  Astronomy
 CALLING SEQUENCE:
  starchart,ra,dec,width,height,scale,outfile
 INPUTS:
  ra    - Right ascension of center of plot (J2000, radians)
  dec   - Declination of center of plot (J2000, radians)
  width - width of plot in units native to output format
            use pixels for any bitmap output and use centimeters for
            postscript
  height - height of plot (same units as width)
  scale  - scale of image in arcsec/plot unit (eg., arcsec/pixel or arcsec/cm)
            The scale is forced to be the same in both directions.
  outfile - Name of the file where the graphic is to be saved.  The suffix
              of the file will determine the output file type.
              To get the plot shown on the display, use ''.
              Uses plot function graphic calls.
 OPTIONAL INPUT PARAMETERS:
 KEYWORD INPUT PARAMETERS:
  CATALOG - Name of the catalog to use
              GDR2 (default)
              UCAC2 (not implemented)
              USNOB (not implemented)
              URAT1 (not implemented)
              USNO (implemented)
  MAGLIM  - Limiting magnitude of finder chart (default=20)
  EWFLIP  - Flag, if set, plot is flipped east-west
  ORIENT  - Position angle of north on plot measured
               (angle is CCW from up), value given in degrees.
  OBJMARK - If specified, this is a [2,N] array of ra,dec.  Each position
              is marked on the plot.
  FOV     - If provided, specifies an anonymous structure that defines a
              camera field of view.   The following tags must be defined.
                 type='R'   (rectangular)
                   width: width of FOV in arcsec
                   height: height of FOV in arcsec
                   pang: position angle of up in FOV, degrees measured
                           eastward from north
                 type='C'  (circular)
                   radius: radius of FOV in arcsec
 OUTPUTS:
  The generated graphic is saved to the output file desired.
    This routine uses the hidden graphics mode of the plot functions and
    can be run in detached batch processes.  Using the display mode only
    work interactively.
 KEYWORD OUTPUT PARAMETERS:
 COMMON BLOCKS:
 SIDE EFFECTS:
 RESTRICTIONS:
 PROCEDURE:
 MODIFICATION HISTORY:
  Written by Marc W. Buie, Southwest Research Institute, 2015/04/14
  2016/06/16, MWB, changed plot algorithm to discretize the star symbol
                   sizes and make fewer plot calls.  This speeds the program
                   up a phenomenal amount.
  2019/01/23, RL, Implementation of CATALOG (including support to Gaia DR2),
                  EWFLIP and ORIENT
  2020/01/06, RL, Remove plot of additional bright stars when catalog=GDR2 
  2024/11/19, MWB, changed to protect input ra,dec from being modified