next up previous 264
Next: ...Display Coordinates as they are Transformed
Up: How To...
Previous: ...Test if a WCS is a Spectral Coordinate System


...Format Coordinates for Display

Once you have converted pixel coordinates into world coordinates ([*]), you may want to format them as text before displaying them. Typically, this would convert from (say) radians into something more comprehensible. Using the FrameSet pointer WCSINFO obtained in [*] and a pair of world coordinates XW and YW (e.g. see [*]), you could proceed as follows:

      CHARACTER * ( 20 ) XTEXT, YTEXT
      DOUBLE PRECISION XW, YW

      ...

      XTEXT = AST_FORMAT( WCSINFO, 1, XW, STATUS )
      YTEXT = AST_FORMAT( WCSINFO, 2, YW, STATUS )

      WRITE ( *, 199 ) XTEXT, YTEXT
 199  FORMAT( 'Position = ', A, ', ', A )

Here, the second argument to AST_FORMAT is the axis number.

With celestial coordinates, this will usually result in sexagesimal notation, such as ``12:34:56.7''. However, the same method may be applied to any type of coordinates and appropriate formatting will be employed.

For more information about formatting coordinate values and how to control the style of formatting used, see [*] and [*]. If necessary, also see [*] for details of how to ``normalise'' a set of coordinates so that they lie within the standard range (e.g. 0 to 24 hours for right ascension and $\pm 90^\circ$ for declination).


next up previous 264
Next: ...Display Coordinates as they are Transformed
Up: How To...
Previous: ...Test if a WCS is a Spectral Coordinate System

AST A Library for Handling World Coordinate Systems in Astronomy
Starlink User Note 210
R.F. Warren-Smith & D.S. Berry
24th May 2011
E-mail:ussc@star.rl.ac.uk

Copyright (C) 2009 Science \& Technology Facilities Council