diff --git a/astroquery/esa/hsa/core.py b/astroquery/esa/hsa/core.py
index d440bf3f7a..79c11f502d 100644
--- a/astroquery/esa/hsa/core.py
+++ b/astroquery/esa/hsa/core.py
@@ -379,7 +379,7 @@ def get_columns(self, table_name, *, only_names=True, verbose=False):
else:
return columns
- def query_observations(self, coordinate, radius, *, n_obs=10):
+ def query_observations(self, coordinate, radius, *, n_obs=10, **kwargs):
"""
Get the observation IDs from a given region
@@ -391,6 +391,31 @@ def query_observations(self, coordinate, radius, *, n_obs=10):
the radius of the region
n_obs : int, optional
the number of observations
+ kwargs : dict
+ passed to `query_hsa_tap`
+
+ Returns
+ -------
+ A table object with the list of observations in the region
+ """
+ return self.query_region(coordinate, radius, n_obs=n_obs, columns="observation_id", **kwargs)
+
+ def query_region(self, coordinate, radius, *, n_obs=10, columns='*', **kwargs):
+ """
+ Get the observation metadata from a given region
+
+ Parameters
+ ----------
+ coordinate : string / `astropy.coordinates`
+ the identifier or coordinates around which to query
+ radius : int / `~astropy.units.Quantity`
+ the radius of the region
+ n_obs : int, optional
+ the number of observations
+ columns : str, optional
+ the columns to retrieve from the data table
+ kwargs : dict
+ passed to `query_hsa_tap`
Returns
-------
@@ -401,11 +426,11 @@ def query_observations(self, coordinate, radius, *, n_obs=10):
r = radius*u.deg
coord = commons.parse_coordinates(coordinate).icrs
- query = (f"select top {n_obs} observation_id from hsa.v_active_observation "
+ query = (f"select top {n_obs} {columns} from hsa.v_active_observation "
f"where contains("
f"point('ICRS', hsa.v_active_observation.ra, hsa.v_active_observation.dec), "
f"circle('ICRS', {coord.ra.degree},{coord.dec.degree},{r.to(u.deg).value}))=1")
- return self.query_hsa_tap(query)
+ return self.query_hsa_tap(query, **kwargs)
HSA = HSAClass()
diff --git a/astroquery/esa/hsa/tests/test_hsa.py b/astroquery/esa/hsa/tests/test_hsa.py
index c08dc1078f..4409c0f429 100644
--- a/astroquery/esa/hsa/tests/test_hsa.py
+++ b/astroquery/esa/hsa/tests/test_hsa.py
@@ -57,3 +57,12 @@ def test_query_observations(self):
hsa = HSAClass(self.get_dummy_tap_handler())
hsa.query_observations(**parameters)
dummyTapHandler.check_call("query_observations", parameters)
+
+ def test_query_region(self):
+ c = SkyCoord(ra=100.2417*u.degree, dec=9.895*u.degree, frame='icrs')
+ parameters = {'coordinate': c,
+ 'radius': 0.5}
+ dummyTapHandler = DummyHSATapHandler("query_region", parameters)
+ hsa = HSAClass(self.get_dummy_tap_handler())
+ hsa.query_region(**parameters)
+ dummyTapHandler.check_call("query_region", parameters)
diff --git a/docs/esa/hsa.rst b/docs/esa/hsa.rst
index 025155828e..9212aaa6c9 100644
--- a/docs/esa/hsa.rst
+++ b/docs/esa/hsa.rst
@@ -12,7 +12,7 @@ space missions and groundbased facilities. Herschel successfully performed ~3700
~6600 science calibration observations which are publicly available to the worldwide astronomical community
through the Herschel Science Archive.
-This package allows the access to the `Herschel Science Archive `__.
+This package allows the access to the `Herschel Science Archive `_.
Examples
========
@@ -109,7 +109,7 @@ Query Language (`ADQL >> from astroquery.esa.hsa import HSA
+ >>> from astropy.coordinates import SkyCoord
+ >>> from astropy import units as u
+ >>>
+ >>> c = SkyCoord(ra=100.2417*u.degree, dec=9.895*u.degree, frame='icrs')
+ >>> result = HSA.query_region(c, 0.5)
+ >>> result.pprint(max_width=100)
+ aor bii ... target_name urn_version
+ ...
+ ------------------------------------------- ------------------ ... ---------------- -----------
+ KPOT_wlanger_1-HPoint-0007 - CII_G202.6+2.0 10.062774289985356 ... CII_G202.6+2.0-1 921022
+ n2264-o 9.45754288889945 ... NGC2264 919399
+ n2264-n 9.45754288889945 ... NGC2264 919398
+ n2264-n 9.450299102175919 ... NGC2264 898497
+ n2264-o 9.450499719127244 ... NGC2264 898535
+
+Retrieve a VOTable with the observations metadata of a given region.
+
+
+8. Query Observations
---------------------
-.. doctest-skip::
+.. doctest-remote-data::
>>> from astroquery.esa.hsa import HSA
>>> from astropy.coordinates import SkyCoord
@@ -166,15 +191,15 @@ This will show the column details of the table 'hsa.v_active_observation' in HSA
1342205056
1342205057
-Retrieve a VOTable with the observation IDs of a given region
+Retrieve a VOTable with the observation IDs of a given region.
-8. Procedure example
+9. Procedure example
--------------------
First retrieve the observation IDs based on a position on the sky. To achive this, query the TAP service.
-.. doctest-skip::
+.. doctest-remote-data::
>>> from astroquery.esa.hsa import HSA
>>>