next up previous
Next: ...Test if a WCS is a Celestial Coordinate System
Up: How To...
Previous: ...Display AST Data

...Convert Between Pixel and World Coordinates  

You may use a pointer to a FrameSet, such as we read in [*], to transform a set of points between the pixel coordinates of an image and the associated world coordinates. If you are working in two dimensions, proceed as follows:

      INTEGER N
      DOUBLE PRECISION XPIXEL( N ), YPIXEL( N )
      DOUBLE PRECISION XWORLD( N ), YWORLD( N )

      ...

      CALL AST_TRAN2( WCSINFO, N, XPIXEL, YPIXEL, .TRUE.,
     :                            XWORLD, YWORLD, STATUS )

Here, N is the number of points to be transformed, XPIXEL and YPIXEL hold the pixel coordinates, and XWORLD and YWORLD receive the returned world coordinates.[*] To transform in the opposite direction, interchange the two pairs of arrays (so that the world coordinates are given as input) and change the fifth argument of AST_TRAN2 to .FALSE..

To transform points in one dimension, use AST_TRAN1. In any other number of dimensions (or if the number of dimensions is initially unknown), use AST_TRANN. These routines are described in [*].

For more information about transforming coordinates, see [*] and [*]. For details of how to handle missing coordinates, see [*].



next up previous
Next: ...Test if a WCS is a Celestial Coordinate System
Up: How To...
Previous: ...Display AST Data

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

Copyright (C) 2003 Central Laboratory of the Research Councils