Author image Graham Bell
and 3 contributors


Astro::Catalog::Query - Base class for Astro::Catalog query objects


  use base qw/ Astro::Catalog::Query /;


This class forms a base class for all the query classes provided in the Astro::Catalog distribution (eg Astro::Catalog::GSC::Query).




Create a new instance from a hash of options

  $q = new Astro::Catalog::Query( Coords    => new Astro::Coords(),
                                  Radius    => $radius,
                                  Bright    => $magbright,
                                  Faint     => $magfaint,
                                  Sort      => $sort_type,
                                  Number    => $number_out );

returns a reference to an query object. Must only called from sub-classed constructors.

RA and Dec are also allowed but are deprecated (since with only RA/Dec the coordinates must always be supplied as J2000 space-separated sexagesimal format).

Accessor Methods


Hash representing the query options to be used to query the catalog server. This keys in this hash are restricted by the subclass. Some keys are not usable by all catalogues.

Returns a copy of the options hash when.

  %options = $q->query_options();

Note that the hash keys included here are not necessarily the keys used to form a remote query.

If an argument is supplied, the value for that option is returned if the option is supported.

  $ra = $q->query_options( "ra" );

Values can not be set directly. Please use the provided accessor methods.


Return (or set) the current target R.A. defined for the query

   $ra = $usno->ra();
   $usno->ra( $ra );

where $ra should be a string of the form "HH MM SS.SS", e.g. 21 42 42.66


Return (or set) the current target Declination defined for the query

   $dec = $q->dec();
   $q->dec( $dec );

where $dec should be a string of the form "+-HH MM SS.SS", e.g. +43 35 09.5 or -40 25 67.89


Instead of querying by R.A. and Dec., you may also query it by object name. Return (or set) the current target object defined for the USNO-A2.0 query, will query SIMBAD for object name resolution.

   $ident = $usno->target();
   $usno->target( "HT Cas" );

using an object name will override the current R.A. and Dec settings for the Query object (if currently set) and the next querydb() method call will query using this identifier rather than any currently set co-ordinates.


The radius to be searched for objects around the target R.A. and Dec in arc minutes, the radius defaults to 5 arc minutes.

   $radius = $query->radius();
   $query->radius( 20 );

Set (or query) the faint magnitude limit for inclusion on the results

   $faint = $query->faint();
   $query->faint( 50 );

Set (or query) the bright magnitude limit for inclusion on the results

   $faint = $query->bright();
   $query->bright( 2 );

Set or query the order in which the stars are listed in the catalogue

   $sort = $query->sort();
   $query->sort( 'RA' );

valid options are RA, DEC, RMAG, BMAG, DIST (distance to centre of the requested field) and POS (the position angle to the centre of the field).


The number of objects to return, defaults to 2000 which should hopefully be sufficent to return all objects of interest. This value should be increased if a (very) large sample radius is requested.

   $num = $query->number();
   $query->nout( 100 );

General Methods


Configures the object, takes an options hash as an argument

  $dss->configure( %options );

Does nothing if the array is not supplied.


Copyright (C) 2001 University of Exeter. All Rights Reserved. Some modifications copyright (C) 2003 Particle Physics and Astronomy Research Council. All Rights Reserved.

This program was written as part of the eSTAR project and is free software; you can redistribute it and/or modify it under the terms of the GNU Public License.


Alasdair Allan <>, Tim Jenness <>