@@ -325,7 +325,7 @@ def query_object_async(self, object_name, catalog=None, radius=None,
325
325
326
326
def query_region_async (self , coordinates , radius = None , inner_radius = None ,
327
327
width = None , height = None , catalog = None ,
328
- get_query_payload = False , cache = True ,
328
+ get_query_payload = False , frame = 'fk5' , cache = True ,
329
329
return_type = 'votable' , column_filters = {}):
330
330
"""
331
331
Serves the same purpose as `query_region` but only
@@ -354,6 +354,9 @@ def query_region_async(self, coordinates, radius=None, inner_radius=None,
354
354
catalog : str or list, optional
355
355
The catalog(s) which must be searched for this identifier.
356
356
If not specified, all matching catalogs will be searched.
357
+ frame : str, optional
358
+ The frame to use for the request: can be 'galactic' or 'fk5'.
359
+ It influences the orientation of box requests.
357
360
column_filters: dict, optional
358
361
Constraints on columns of the result. The dictionary contains
359
362
the column name as keys, and the constraints as values.
@@ -370,22 +373,35 @@ def query_region_async(self, coordinates, radius=None, inner_radius=None,
370
373
371
374
# Process coordinates
372
375
if isinstance (coordinates , (commons .CoordClasses ,) + six .string_types ):
373
- c = commons .parse_coordinates (coordinates ).transform_to ('fk5' )
376
+ c = commons .parse_coordinates (coordinates ).transform_to (frame )
374
377
375
378
if not c .isscalar :
376
379
center ["-c" ] = []
377
380
for pos in c :
378
- ra_deg = pos .ra .to_string (unit = "deg" , decimal = True ,
379
- precision = 8 )
380
- dec_deg = pos .dec .to_string (unit = "deg" , decimal = True ,
381
+ if frame == 'galactic' :
382
+ glon_deg = pos .l .to_string (unit = "deg" , decimal = True ,
383
+ precision = 8 )
384
+ glat_deg = pos .b .to_string (unit = "deg" , decimal = True ,
381
385
precision = 8 , alwayssign = True )
382
- center ["-c" ] += ["{}{}" .format (ra_deg , dec_deg )]
386
+ center ["-c" ] += ["B{}{}" .format (glon_deg , glat_deg )]
387
+ else :
388
+ ra_deg = pos .ra .to_string (unit = "deg" , decimal = True ,
389
+ precision = 8 )
390
+ dec_deg = pos .dec .to_string (unit = "deg" , decimal = True ,
391
+ precision = 8 , alwayssign = True )
392
+ center ["-c" ] += ["{}{}" .format (ra_deg , dec_deg )]
383
393
columns += ["_q" ] # Always request reference to input table
384
394
else :
385
- ra = c .ra .to_string (unit = 'deg' , decimal = True , precision = 8 )
386
- dec = c .dec .to_string (unit = "deg" , decimal = True , precision = 8 ,
387
- alwayssign = True )
388
- center ["-c" ] = "{ra}{dec}" .format (ra = ra , dec = dec )
395
+ if frame == 'galactic' :
396
+ glon = c .l .to_string (unit = 'deg' , decimal = True , precision = 8 )
397
+ glat = c .b .to_string (unit = "deg" , decimal = True , precision = 8 ,
398
+ alwayssign = True )
399
+ center ["-c" ] = "G{glon}{glat}" .format (glon = glon , glat = glat )
400
+ else :
401
+ ra = c .ra .to_string (unit = 'deg' , decimal = True , precision = 8 )
402
+ dec = c .dec .to_string (unit = "deg" , decimal = True , precision = 8 ,
403
+ alwayssign = True )
404
+ center ["-c" ] = "{ra}{dec}" .format (ra = ra , dec = dec )
389
405
elif isinstance (coordinates , tbl .Table ):
390
406
if (("_RAJ2000" in coordinates .keys ()) and ("_DEJ2000" in
391
407
coordinates .keys ())):
0 commit comments