rts
is intended to people who need to compute the rise, transit and
set of the major Solar system objects at a given epoch for a given geographic location.
HTTP Request
rts
service into your application. This can be done by using the Web service method or by
using the following HTTP request:
- https://ssp.imcce.fr/webservices/miriade/api/rts.php?[parameters]
&
.
The allowed parameters are:
Parameter | Definition | Limits or value |
---|---|---|
-body=<integer> |
The number, or a comma separated list of numbers, of the requested solar system body (default 11) |
See list of recognized bodies |
-ep=<dateTime> |
Requested epoch, expressed in Julian day, ISO format, or formatted as any English textual datetime (default now) |
2433647.0 .. 2460676.0 (1951-01-01 12h .. 2024-12-31 12h) |
-nbd=<integer> |
The number of dates to compute (default 1) | 1 ≤ nbd < 731 |
-step=<integer> |
Step between dates, in day (default 1) | 1 ≤ step ≤ 100 |
-observer=<string> |
Code or geographic coordinates of the observer's location | Ex.: 500 (geocenter), 007 (Paris), -2.23124 %2B48.45125 |
-twilight=<int> |
Provide (1) or not (0) the dawn and dusk timings for the Sun (default 0) | 0 | 1 |
-tz=<real> |
Timezone of the observer location, in hours (default 0) | -12 ≤ tz ≤ +14 |
-mime=<string> |
Mime type of the results (default votable) | votable | html | text | text/csv | json |
-extrap=<int> |
Number of significant digits of output parameters (default 1) | 0 to 9 |
-fmt=<string> |
Coma-separated list of formatting options (default "timerep:sexagesimal, time:second,coordrep:decimal,coord:arcmin,az:North ") |
See formatting options |
-from=<string> |
Word which definite the name of the caller application, or which describes the request (optional) |
any short string (no space character) |
The parameters with a default value are optionnal, and they can be omitted (just left blank the value, e.g.
...&-mime=&...
). The other input parameters are mandatory. The value of the -extrap
parameter defines the number of decimals of the second of time of the rise, transit and setting events, and
extrap+1
defines the number of decimal of the local coordinates (azimuth or elevation) of the body
at the time of events.
The output results are described in the following section, and are available in VOTable (default), HTML, comma-separated values (CSV), plain text format, and JSON object (cf. examples).
Web service
rts
method:
- Web Service URI:
- https://ssp.imcce.fr/webservices/miriade/miriade.php
- Namespace:
- https://ssp.imcce.fr/webservices/miriade
- WSDL:
- https://ssp.imcce.fr/webservices/miriade/miriade.php?wsdl
- SOAP header:
- name of the SOAP header element:
clientID
- SOAP header's content:
array('from' => 'YourName', 'hostip'=>'', 'lang'=>'en|fr')
- Method:
- rts (inputArray)
Variable | Type | Units | Limits or values | Default | Comment |
---|---|---|---|---|---|
body |
integer | - | 1,2,4,5,6,7,8,10,11 | 11 | The number (or a comma separated list of numbers) of the requested solar system body |
epoch |
string | epoch | 2433647.0 .. 2460676.0 (1951-01-01 12h .. 2024-12-31 12h) |
now | Requested epoch (julian day, ISO format, English textual datetime) |
nbd |
integer | - | 1 .. 730 | 1 | The number of date of computation |
observer |
string | - | IAU code or geographic coordinates of the observer's location | - | IAU codes of observatories; Geographic coordinates must be expressed in degrees (longitude, latitude) |
twilight |
int | - | 0 | 1 | 0 | Provide (1) or not (0) the dawn and dusk timings for the Sun |
tz |
double | hour | - | 0 | Timezone of the observer location |
mime |
string | - | votable | html | text | text/csv | json | votable | Mime type of the results |
extrap |
int | - | Positive integer | 0 | Number of significant digits of output parameters |
fmt |
string | - | See formatting options | timerep:sexagesimal |
Coma-separated list of formatting options |
The output of the method is an object containing the following attributes:
- 'flag'
- the status of the response:
flag=1
means ok;flag=0
orflag=-1
mean that an error occured - 'status'
- the HTTP status-code of the response (e.g.
400: bad request
,422: Unprocessable Entity
,500: internal error
) - 'ticket'
- the Unix timestamp of the response which can be useful to stamp the request
- 'result'
- a string containing the ephemeris of the requested solar system bodies.
- votable
- the data are written in the IVOA standard VOTable format
- html
- the data are transformed from VOTable to HTML by XSLT processing (Miriade XSL style sheet)
- text
- the data are returned in plain text where each block of data is separated by the semi-colon character '
;
', and fields are separated by one or more blank character. The first block is the keyword '#! ephem
' which marks the beginning of the data. - text/csv
- the data are returned in plain text where each block of data is separated by the semi-colon character '
;
', and fields are separated by a comma. The first line provides the ticket (Unix timestamp of the response) and the flag of the response, and the second line provides the field headers. - json
- the data are written in a JSON object.
List of bodies recognized by Miriade.rts
- Mercury
- Venus
- Mars
- Jupiter
- Saturn
- Uranus
- Neptune
- Moon
- Sun
The ephemerides of several bodies can be requested by submitting a list of numbers separated
by a comma, e.g. -body=11,10,4,5
Formatting options
key:value
throught
the argument fmt
. The list of keys and values are given in the following table, the first
column providing the formatting key (case insensitive), and the second column explaining what it does.
The default values are: timerep:sexagesimal, time:second, coord:decimal, az:North
.
Key | Action |
---|---|
timerep:<sexagesimal|decimal> | Representation of timings sets to sexagesimal or decimal |
time:<minute|second> | Precision of timings sets to minute or second |
coordrep:<sexagesimal|decimal> | Representation of azimuth and elevation coordinates sets to sexagesimal or decimal |
coord:<arcmin|arcsec> | Precision of azimuth and elevation coordinates sets to arcminute or arcsecond. |
az:<North|South> | Origin of the azimuth: North or South |
By default, when the argument extrap
is not defined (or sets to zero), the numerical precision of
timings and angles is set to rounded (arc)minute and (arc)second in sexagesimal representation, and to the level of
(arc)minute (4 digits) and (arc)second (5 digits) in decimal representation. Defining extrap=x
will
display all the decimal numbers with x
digits, and the (arc)second with x
digits in
sexagesimal representation. Example: extrap=2
will set the precision to the tenth of a (arc)second
for timings and angles in sexagesimal representation (only if time:second
and coord:arcsec
are used), and will display the timings and angles with 2 digits in decimal representation.
Query examples
Output parameters
The output parameters of the rts
method are described in the following table.
Col. | Definition | Representation | Comment |
---|---|---|---|
1 | Name or Id of the solar system body | - | |
2 | Date of the event | year‑month‑day | |
3 | Rise time | hh:mm[:ss.s] or h.hh | (1) |
4 | Azimuth of the rising | ° : ′ or degrees | (2) |
5 | Transit time | hh:mm[:ss.s] or h.hh | (1) |
6 | Elevation of the transit | ° : ′ or degrees | (2) |
7 | Set time | hh:mm[:ss.s] or h.hh | (1) |
8 | Azimuth of the setting | ° : ′ or degrees | (2) |
9 | Astronomical dawn | hh:mm[:ss.s] or h.hh | Sun only (1,3) |
10 | Nautical dawn | hh:mm[:ss.s] or h.hh | Sun only (1,3) |
11 | Civil dawn | hh:mm[:ss.s] or h.hh | Sun only (1,3) |
12 | Civil dusk | hh:mm[:ss.s] or h.hh | Sun only (1,3) |
13 | Nautical dusk | hh:mm[:ss.s] or h.hh | Sun only (1,3) |
14 | Astronomical dusk | hh:mm[:ss.s] or h.hh | Sun only (1,3) |
Notes:
- The representation and precision of timings depend on the following optional arguments:
fmt=timerep:sexagesimal|decimal
to display timings in sexagesimal or decimal format,fmt=time:minute|second
to display only minute of time, or minute and seconds,extrap
to define the number of digits of the seconds of time in sexagesimal format, or to define the number of digits of hours in decimal format.
- The representation and precision of azimuth and elevation depend on the following optional arguments:
fmt=coord:sexagesimal|decimal
to display angles in sexagesimal or decimal format,fmt=time:minute|second
to display only minute of time, or minute and seconds,extrap+1
to define the number of digits of degrees in decimal format.
- the timings of the dawn and dusk are provided only for the Sun if argument
twilight=1
. In this case, depending on the mime type, the twilight timings are empty (text
andtext/csv
) or null (json
) for other bodies. If the mime type isvotable
then a dedicated table with the twilight timings is provided in the main resource of the VOTable.
Remark: the number of digits does not define, in any case, the uncertainty of the computed values. It has to be taken as a computational precision.
Structure of the output JSON object
{ "id": [ { date_i }, { date_i+1 }, ... ], ... }
where id is the body's id, and where datei
provides the
ephemerides of a given date, such as:{
"name": string,
"date": string,
"dawn-astronomical": [ {} ],
"dawn-civil": [ {} ],
"dawn-nautical": [ {} ],
"rising": [ {} ],
"transit-sup": [ {} ],
"setting": [ {} ],
"dusk-civil": [ {} ],
"dusk-nautical": [ {} ],
"dusk-astronomical": [ {} ]
},
where name
is the body's name, where the date is formatted as
year‑month‑day
, and where other elements are arrays containing the time
and coordinate of the events, in sexagesimal representation:"<event_name>": { "hour": string, "coord": string }
or in decimal representation:"<event_name>": { "hour": float, "coord": float }
The coordinate of the dawn, the transit and the dusk is the elevation relatively to the observer's
horizon, and the coordinate of the rise and the setting is the azimuth angle. Depending on the
formatting options, the timings and angles are expressed in sexagesimal
(string) or decimal (float) representation. If an event does not occur at a given date, its value is
set to null, e.g.:"<event_name>": null
How to consume
curl
or wget
.
For that, just execute one of the following commands in a console:$> curl "<URL>"
or
$> wget "<URL>"
where <URL>
is described in section HTTP request.
In order to help you to invoke the Miriade web service, we provide some clients
written in differents languages. Here are some detailed explanations to write a client with PHP
and SOAP which invokes the rts
method:
1/ Provide the input parameters which are mandatory for the service:
// Client's ID: provide the name of your project or organisation or yourself
$from = 'MyName';
// Input parameters
$param = array('body' => '11,10,4',
'epoch' => 2454579.5,
'nbd' => 1,
'step' => 1,
'longitude' => -2.3511111,
'latitude' => 48.8566667,
'tz' => 0,
'mime' => 'text',
'extrap' => 1,
'fmt' => "twilight:1,timerep:sexagesimal,time:second,coordrep:decimal,coord:arcmin,az:North"
);
2/ Define the SOAP options, the namespace and the WSDL URI of Miriade web service:
// Enables or disables the WSDL caching feature
ini_set('soap.wsdl_cache_enabled', 1);
// Miriade namespace
$namespace = 'https://ssp.imcce.fr/webservices/miriade';
// Miriade WSDL
$uriwsdl = $namespace.'/miriade.wsdl';
3/ Create a SoapClient object in WSDL mode, set the SOAP header, then call the method and catch exceptions:
try {
// Constructs the client
$client = new SoapClient($uriwsdl, array('exceptions'=>1));
// SOAP header
$header = array('from'=>$from, 'hostip'=>'', 'lang'=>'en');
$client->__setSoapHeaders(array(new SOAPHeader($namespace, 'clientID', $header)));
// Call the resolver method
$response = $client->__soapCall('rts',array($param));
// Display the results
if ($param['mime'] == 'text') {
$res = explode(';', $response->result);
$nbr = count($res);
$newkey = array_keys($res);
header("HTTP/1.0 ".$response->status);
header("Content-Type: text/plain");
echo "# Flag: ".$response->flag.PHP_EOL;
echo "# Ticket: ".$response->ticket.PHP_EOL;
for ($i=0; $i<$nbr; $i++) { echo $res[$newkey[$i]],PHP_EOL; }
} else if ($param['mime'] == 'text/csv') {
$res = explode(';', $response->result);
$nbr = count($res);
$newkey = array_keys($res);
header("HTTP/1.0 ".$response->status);
if ($response->status < 300) {
header("Content-Type: text/csv");
header('Content-disposition: attachment;filename="rts.csv"');
} else {
header("Content-Type: text/plain");
}
echo "# Flag: ".$response->flag.PHP_EOL;
echo "# Ticket: ".$response->ticket.PHP_EOL;
for ($i=0; $i<$nbr; $i++) { echo $res[$newkey[$i]],PHP_EOL; }
} else if ($param['mime'] == 'json') {
header("HTTP/1.0 ".$response->status);
header("Content-Type: application/json");
echo $response->result;
} else {
header("HTTP/1.0 ".$response->status);
header("Content-Type: text/xml;content=x-votable");
echo $response->result;
}
}
catch (SoapFault $fault)
{
trigger_error("SOAP Fault: {$fault->getTraceAsString()} (faultcode: {$fault->faultcode},
faultstring: {$fault->faultstring})", E_USER_ERROR);
}