Spatial

class pyvo.registry.Spatial(geom_spec, order=6, intersect='covers')[source]

Bases: Constraint

A RegTAP constraint selecting resources covering a geometry in space.

This is a RegTAP 1.2 extension not yet available on all Registries (in 2022). Also note that not all data providers give spatial coverage for their resources.

To find resources having data for RA/Dec 347.38/8.6772:

>>> from pyvo import registry
>>> resources = registry.Spatial((347.38, 8.6772))

To find resources claiming to have data for a spherical circle 2 degrees around that point:

>>> resources = registry.Spatial((347.38, 8.6772, 2))

To find resources claiming to have data for a polygon described by the vertices (23, -40), (26, -39), (25, -43) in ICRS RA/Dec:

>>> resources = registry.Spatial([23, -40, 26, -39, 25, -43])

To find resources claiming to cover a MOC, pass an ASCII MOC:

>>> resources = registry.Spatial("0/1-3 3/")

To find resources which coverage is enclosed in a region,

>>> enclosed = registry.Spatial("0/0-11", intersect="enclosed")

To find resources which coverage intersects a region,

>>> overlaps = registry.Spatial("0/0-11", intersect="overlaps")

When you already have an astropy SkyCoord:

>>> from astropy.coordinates import SkyCoord
>>> resources = registry.Spatial(SkyCoord("23d +3d"))

SkyCoords also work as circle centers (plain floats for the radius are interpreted in degrees):

>>> resources = registry.Spatial((SkyCoord("23d +3d"), 3))
Parameters
geom_specobject

For now, this is DALI-style: a 2-sequence is interpreted as a DALI point, a 3-sequence as a DALI circle, a 2n sequence as a DALI polygon. Additionally, strings are interpreted as ASCII MOCs, SkyCoords as points, and a pair of a SkyCoord and a float as a circle. Other types (proper geometries or MOCPy objects) might be supported in the future.

orderint, optional

Non-MOC geometries are converted to MOCs before comparing them to the resource coverage. By default, this constraint uses order 6, which corresponds to about a degree of resolution and is what RegTAP recommends as a sane default for the order actually used for the coverages in the database.

intersectstr, optional

Allows to specify the connection between the resource coverage and the geom_spec. The possible values are ‘covers’ for services that completely cover the geom_spec region, ‘enclosed’ for services completely enclosed in the region and ‘overlaps’ for services which coverage intersect the region.

Attributes Summary

takes_sequence

Methods Summary

get_search_condition(service)

Formats this constraint to an ADQL fragment.

Attributes Documentation

takes_sequence = True

Methods Documentation

get_search_condition(service)[source]

Formats this constraint to an ADQL fragment.

This takes the service the constraint is being executed on as an argument because constraints may be written differently depending on the service’s features or refuse to run altogether.

Parameters
serviceTAPService

The RegTAP service the query is supposed to be run on (that is relevant because we adapt to the features available on given services).

Returns
str

A string ready for inclusion into a WHERE clause.