TileImageRequest

class wwt_api_client.TileImageRequest(client)[source]

Bases: APIRequest

Tile a large image on the server and obtain a WTML XML document suitable for displaying it in a client. FITS images are not supported.

This request connects to the TileImage endpoint. This API fetches an image from the web, breaks it into tiles on the server, and returns a WTML collection XML document describing the resulting dataset.

If the input image has correct AVM tags, only the image_url parameter is essential:

>>> from wwt_api_client import Client
>>> req = Client().tile_image('http://www.spitzer.caltech.edu/uploaded_files/images/0009/0848/sig12-011.jpg')
>>> print(req.send()[:10])  # prints start of a WTML XML document
<?xml vers

However, the server-side AVM parsing can fail even when the image has AVM tags that look correct, and there is no feedback about where exactly the error occurs. Specifying the astrometric information through parameters to this API call is safer.

For details, see the documentation of the TileImage endpoint.

Attributes Summary

credits

Free text describing where the image came from.

credits_url

Absolute URL of a webpage with more information about the image.

dec_deg

The declination at which to center the view, in degrees.

image_url

Absolute URL of the image to tile.

ra_deg

The right ascension at which to center the view, in degrees.

rotation_deg

How much to rotate the image in an east-from-north sense, in degrees.

scale_deg

The angular size of each image pixel, in degrees.

thumbnail_url

Absolute URL of a 96×45 pixel image thumbnail used to represent the <Place>.

x_offset_deg

The horizontal offset between the image and view centers.

y_offset_deg

The vertical offset between the image and view centers.

Methods Summary

invalidity_reason()

Check whether the parameters of this request are valid.

make_request()

Generate a requests.Request from the current parameters.

Attributes Documentation

credits = None

Free text describing where the image came from.

credits_url = None

Absolute URL of a webpage with more information about the image.

dec_deg = None

The declination at which to center the view, in degrees.

image_url = None

Absolute URL of the image to tile.

Images supported by the C# System.Drawing.Bitmap class are allowed. These are BMP, GIF, JPG, PNG, and TIF.

ra_deg = None

The right ascension at which to center the view, in degrees.

rotation_deg = None

How much to rotate the image in an east-from-north sense, in degrees.

scale_deg = None

The angular size of each image pixel, in degrees. Pixels must be square.

thumbnail_url = None

Absolute URL of a 96×45 pixel image thumbnail used to represent the <Place>.

If unspecified, a URL that resolves to a small version of the uploaded image will be used.

x_offset_deg = None

The horizontal offset between the image and view centers.

Positive numbers move the image to the right relative to the viewport center.

y_offset_deg = None

The vertical offset between the image and view centers.

Positive numbers move the image up relative to the viewport center.

Methods Documentation

invalidity_reason()[source]

Check whether the parameters of this request are valid.

Returns:
reasonstring or None

If None, indicates that this request is valid. Otherwise, the returned string explains what about the request’ parameters is invalid.

Examples

You can manually check if a request is correctly set up:

>>> from wwt_api_client import Client
>>> req = Client().show_image('http://example.com/space.jpg', 'My Image')
>>> assert req.invalidity_reason() is None
make_request()[source]

Generate a requests.Request from the current parameters.

This method returns a requests.Request object ready for sending to the API server.

Returns:
requestrequests.Request object

The HTTP request.

Examples

Get the URL that will be accessed for a request:

>>> from urllib.parse import urlparse
>>> from wwt_api_client import Client
>>> req = Client().show_image('http://example.com/space.jpg', 'My Image')
>>> parsed_url = urlparse(req.make_request().prepare().url)
>>> print(parsed_url.path)
/WWTWeb/ShowImage.aspx