<p>The <a href="https://en.wikipedia.org/wiki/Longitude_of_the_ascending_node" rel="nofollow noreferrer">longitude of the ascending node</a> is a standard orbital element, usually given the symbol <span class="math-container">$\Omega$</span> (upper-case omega). You can request osculating orbital elements of many solar system bodies from JPL <a href="https://ssd.jpl.nasa.gov/horizons/" rel="nofollow noreferrer">Horizons</a>.</p>
<p>For lunar elements, Horizons gives you two choices of reference plane: the ICRF frame XY plane, which is essentially the Earth equatorial plane of the J2000.0 epoch, or the J2000.0 ecliptic plane. If you use the ecliptic plane, the resulting longitude is the ecliptic longitude of the node. If you use the equatorial plane, the resulting longitude is the RA of the node.</p>
<p>Orbit elements are calculated using TDB (<a href="https://en.wikipedia.org/wiki/Ephemeris_time#JPL_ephemeris_time_argument_Teph" rel="nofollow noreferrer">Barycentric Dynamical Time</a>). Currently, delta_T = TDB - UT is ~69 seconds. You can query Horizons for a more accurate value of delta_T when requesting an Observer or Vector table, but not when requesting an Elements table.</p>
<p>Here is a typical Horizons batch file that requests the Moon's elements relative to the center of the Earth, using the ecliptic plane. The center of the Earth has ID number 399, the Moon has ID number 301 (the Earth-Moon barycenter has ID 3).</p>
<pre><code>!<span class="math-container">$$SOF
MAKE_EPHEM = 'YES'
OBJ_DATA = 'NO'
COMMAND = '301'
CENTER = '@399'
EPHEM_TYPE = 'ELEMENTS'
CAL_TYPE = 'GREGORIAN'
CSV_FORMAT = 'YES'
REF_PLANE= 'Ecliptic'
START_TIME = '2023-Aug-1'
STOP_TIME = '2023-Aug-8'
STEP_SIZE = '1d'
!$$</span>EOF
</code></pre>
<p>Here's some Python / Sage code that makes the request using the Horizons <a href="https://ssd-api.jpl.nasa.gov/doc/horizons_file.html" rel="nofollow noreferrer">file API</a> and prints the results. The code is mostly plain Python, it just uses some Sage features to get the input arguments. You can select geocentric or heliocentric data, and you can select the reference plane. And you can select the time span. Please see the <a href="https://ssd.jpl.nasa.gov/horizons/manual.html#time" rel="nofollow noreferrer">Horizons docs</a> for info on all of the time specification options.</p>
<pre><code>&quot;&quot;&quot; Retrieve orbital elements of the Moon from Horizons,
    relative to the Earth or the Sun.

    Written by PM 2Ring 2023.08.13
&quot;&quot;&quot;

import re, requests

url = &quot;https://ssd.jpl.nasa.gov/api/horizons_file.api&quot;
api_version = &quot;1.0&quot;

base_cmd = &quot;&quot;&quot;
MAKE_EPHEM = 'YES'
OBJ_DATA = 'NO'
COMMAND = '301'
EPHEM_TYPE = 'ELEMENTS'
CAL_TYPE = 'GREGORIAN'
CSV_FORMAT = 'YES'
&quot;&quot;&quot;

def fetch_data(center, plane, start, stop, step, verbose=False):
    cmd = f&quot;&quot;&quot;
!<span class="math-container">$$SOF
{base_cmd}
CENTER = '{center}'
REF_PLANE= '{plane}'
START_TIME = '{start}'
STOP_TIME = '{stop}'
STEP_SIZE = '{step}'
!$$</span>EOF
&quot;&quot;&quot;
    #print(cmd)
    req = requests.post(url, data={'format': 'text'}, files={'input': ('cmd', cmd)})
    version = re.search(r&quot;API VERSION:\s*(\S*)&quot;, req.text).group(1)
    if version != api_version:
        print(f&quot;Warning: API version is {version}, but this script is for {api_version}&quot;)

    m = re.search(r&quot;(?s)\\\$\\\$SOE(.*)\\\$\\\$EOE&quot;, req.text)
    if m is None:
        print(&quot;NO EPHEMERIS&quot;)
        print(req.text)
        return None

    if verbose:
        print(req.text)
    else:
        lines = req.text.splitlines()
        print(&quot;\n&quot;.join(lines[5:16]))

    return m.group(1)[1:]

@interact
def main(txt=HtmlBox(&quot;The Moon's orbital elements&quot;),
  center=Selector([(&quot;@399&quot;, &quot;Earth&quot;), (&quot;@10&quot;, &quot;Sun&quot;)], selector_type='radio'),
  plane = Selector([(&quot;Ecliptic&quot;, &quot;Ecliptic&quot;), (&quot;Frame&quot;, &quot;Equator&quot;)], selector_type='radio'),
  start=&quot;2023-Aug-1&quot;, stop=&quot;2023-Aug-8&quot;, step=&quot;1d&quot;,
  verbose=True, auto_update=False):

    result = fetch_data(center, plane,
      start.strip(), stop.strip(), step.strip(), verbose=verbose)
    if result is None:
        print(&quot;No ephemeris data found!&quot;)
        return

    print(result)
</code></pre>
<p>Here's a <a href="https://sagecell.sagemath.org/?z=eJyFVf1v2jgY_h2J_8H1VUpSsZS0utOGhG7ZZlZ2haAEbdqVKjJgiqckTm2n6g7xv99rJ6Fc0XSRyMfj18_7-P0CY4xipiVnTwwJueSaZohlLGeFVkhskN4yNBGiQBspcnQjJP9HFKrX7SC4JMuo5rBTC2tIqNRboLEfSVX43U5t-E1yrVmBlj_RbIKuYl48oKv-1bXff-sH190OxtiY8rwUUgNtD36PFVNaGbiSGRoivNW6VIPLS6XW_o8y8wuqqP8gni5pyS-3jbJ0wzPmAwKEcE-fmFQc5MP-wO9bL0uqWLrK1wYzfifhXyQlsxsyAcT5ThKn24k-fEk_hfPQINMIgI_RZBJOP5nv634AgN2Qzr_PiMHILZmQ6dxs_RjeHuDPMfkcxeNwavDkazqK4kk4f3HTnHvNNmjD9Gqbrqmm7gqCz2QPlRktIBRKQ1jNQ5TmzuAOp1oKxYYjminmDeog10faWM6z8_MkGnU7u_awexAAAklsnO9qD3tQEJNROrsNp8TA1qFBk3kYz9P5eGJPsbMKajyaHcOirFEyS5Px3y3KLAoSiJFg9Rh9v5WSF9oFMV5bPo-wo820XwqlXch1D5koDHfORsicameAHM2etbPvIZNcBSu8KCuz4DrA5vTM0b19w_qSccl8xahcbV2Jw9kYfSVxMo6mg4W6cBfJhYdtmfmG3PMfpKhKN2hI-ObAczZER4XUxNpc9XE2-BuVBRT0ABkf7S6u0K55B93LSkNPAKZWkpfarMLh0O6IeI-9tlvyV9rdP5W3OF9ARonrX9hXEpFj9QfRuaGeioKd6MTTCNmaJfE4wd7r5VdUdXp0JQvL1iqrw2JK74T_FQHL_mOT8YKpOtnWyldlxrVF3RMteFFg_4fghWsN7n4fBH_ce4fwNLryQ8rugsG9WXzPTVXTla47KqfAoJ_18Ebn2Qfx7OJ5M8wcdTLrsGdnWt0YwwTglRbSvXPx--t37yDW2A43MEMABX2DwITD3j30ZGOd6p8lGzqSrrlwaj7bUXDuY0KyyqAG-MqStu-WdyRpziz8WFGw_j9225dDbCbpm7B6eBPgekwcQW9xPTOGOFhju6mdHXNZwXChlRZpVULHHU2TNs6qyrQZKb8aTW3irA5fwd9I6Xq1hOMvdvTVem-eL5XbePt1-QrEyi0kS4KJ0QIdVBXrM3xSsa3-ti4Nr_cviIgE9A==&amp;lang=sage" rel="nofollow noreferrer">live version of that script</a>, running on the SageMathCell server.</p>
<p>The query returns results in plain ASCII form. Here's the ephemeris portion of the results.</p>
<pre><code>            JDTDB,            Calendar Date (TDB),                     EC,                     QR,                     IN,                     OM,                      W,                     Tp,                      N,                     MA,                     TA,                      A,                     AD,                     PR,
**************************************************************************************************************************************************************************************************************************************************************************************************************************************************
<span class="math-container">$$SOE
2460157.500000000, A.D. 2023-Aug-01 00:00:00.0000,  7.445758991458748E-02,  3.571365862619948E+05,  5.008652258592002E+00,  2.822256182533066E+01,  2.900634646762910E+02,  2.460158888058302E+06,  1.518410206123902E-04,  3.417899740459997E+02,  3.388674616251798E+02,  3.858673382984544E+05,  4.145980903349139E+05,  2.370900818158910E+06,
2460158.500000000, A.D. 2023-Aug-02 00:00:00.0000,  7.442018378647541E-02,  3.573039656944939E+05,  5.010438148654570E+00,  2.804632484702357E+01,  2.884738888530200E+02,  2.460158772626169E+06,  1.517435366605044E-04,  3.564256960231063E+02,  3.558398892112612E+02,  3.860325813458171E+05,  4.147611969971404E+05,  2.372423945841116E+06,
2460159.500000000, A.D. 2023-Aug-03 00:00:00.0000,  7.340284302854846E-02,  3.572496770205199E+05,  5.016123674133671E+00,  2.788500405977741E+01,  2.869024014201097E+02,  2.460158658978031E+06,  1.520284336503910E-04,  1.104703942319290E+01,  1.281728923915146E+01,  3.855501544901964E+05,  4.138506319598729E+05,  2.367978090387134E+06,
2460160.500000000, A.D. 2023-Aug-04 00:00:00.0000,  7.162883937549905E-02,  3.569891829431704E+05,  5.024686604357866E+00,  2.775623512602453E+01,  2.850820375305457E+02,  2.460158530548510E+06,  1.526321490973527E-04,  2.597197940124664E+01,  2.987693813420488E+01,  3.845328227376530E+05,  4.120764625321357E+05,  2.358611879142072E+06,
2460161.500000000, A.D. 2023-Aug-05 00:00:00.0000,  6.957637835472257E-02,  3.565535202363541E+05,  5.034473963517143E+00,  2.766974414675761E+01,  2.829331038624139E+02,  2.460158382784924E+06,  1.534193512592334E-04,  4.132003231720461E+01,  4.694188100651857E+01,  3.832163242006440E+05,  4.098791281649340E+05,  2.346509726740445E+06,
2460162.500000000, A.D. 2023-Aug-06 00:00:00.0000,  6.771479272345840E-02,  3.560319643831986E+05,  5.043614138526157E+00,  2.762519150265715E+01,  2.806633899532325E+02,  2.460158229386336E+06,  1.542182772497700E-04,  5.690361733634386E+01,  6.370248607985509E+01,  3.818916803617047E+05,  4.077513963402107E+05,  2.334353660409191E+06,
2460163.500000000, A.D. 2023-Aug-07 00:00:00.0000,  6.625425330791064E-02,  3.556004033547897E+05,  5.050458943166362E+00,  2.761268189373863E+01,  2.787078308606339E+02,  2.460158097611625E+06,  1.548623091365481E-04,  7.228451565776196E+01,  7.968276040122535E+01,  3.808321533078448E+05,  4.060639032608998E+05,  2.324645693372517E+06,
2460164.500000000, A.D. 2023-Aug-08 00:00:00.0000,  6.507275768816487E-02,  3.554955131298805E+05,  5.053938392861703E+00,  2.761547227317707E+01,  2.775232172597620E+02,  2.460158014454506E+06,  1.552250039753550E-04,  8.698050648988226E+01,  9.443786013757804E+01,  3.802386934953690E+05,  4.049818738608575E+05,  2.319213984733781E+06,
$$</span>EOE
**************************************************************************************************************************************************************************************************************************************************************************************************************************************************
</code></pre>
<p>Here's a URL for the same request using the <a href="https://ssd-api.jpl.nasa.gov/doc/horizons.html" rel="nofollow noreferrer">GET-based API</a>:</p>
<p><a href="https://ssd.jpl.nasa.gov/api/horizons.api?format=text&amp;MAKE_EPHEM=YES&amp;OBJ_DATA=NO&amp;COMMAND=301&amp;EPHEM_TYPE=ELEMENTS&amp;CAL_TYPE=GREGORIAN&amp;CSV_FORMAT=YES&amp;CENTER=%40399&amp;REF_PLANE=Ecliptic&amp;START_TIME=2023-Aug-1&amp;STOP_TIME=2023-Aug-8&amp;STEP_SIZE=1d" rel="nofollow noreferrer">https://ssd.jpl.nasa.gov/api/horizons.api?format=text&amp;MAKE_EPHEM=YES&amp;OBJ_DATA=NO&amp;COMMAND=301&amp;EPHEM_TYPE=ELEMENTS&amp;CAL_TYPE=GREGORIAN&amp;CSV_FORMAT=YES&amp;CENTER=%40399&amp;REF_PLANE=Ecliptic&amp;START_TIME=2023-Aug-1&amp;STOP_TIME=2023-Aug-8&amp;STEP_SIZE=1d</a></p>
<p>Here's a <a href="https://sagecell.sagemath.org/?z=eJyFVmtv2kgU_R4p_2EyiWo7Ig5O1FVrCW1paxq64SFArboEWRMYwlTG48yM02QR_33vHdvECVstUgCfuXPuuU9CKSUjbpTgD5yYFSdMz3m6EOkdSeWCE7m0aE_KlCyVXJMrqcQ_MtWNwwMCL8UTZgTeldYwYsqsiFT2YZyn_uFBYfhdCWN4Sm6fyLBHLkbo4aJ5cek33_nB5eEBpRRNxTqTygBtA_7uc66NRjhXCWkRujIm0-H5udYL_2eW-CnTzL-TD-csE-erUlm8FAn3AQFCeI8fuNIC5MP9wG9aL7dM83i-XiCGfnvtv6I4Gl5FPUCcH9HYOTwYfPwaf25P2oj0BwB8GvR67f5nfL5sBgDYC_HkxzBCLLqOelF_glc_ta938JdR9GUw6rb7iI-_xZ3BqNeePLsp417wJVlyM1_FC2aYCzUwXDVIlrAUUqENpBU_ZIbvHN4hqlupeavDEs29sEhyEdLSch6dnIwHncODTRXsFgSAwGiEzjeFhy0oGEWdeHjd7kcIW4eIjift0SSedHs2io1VUOCDYR2WWYFGw3jc_btCuUVBQoQSrB7Ud5wpkRoXxHhV-9zDjarSfia1caHWDYJZaG2cpVRrZpyQOIY_GmfbIFhcDScizXI8cB1gcxoYurctWZ8rrrivOVPzlatoe9gl36LRuDvohzf61L0Zn3rUtpmP5J5_p2SeuUFJIpY7nqMWqTVSmWt8FeEs6XemUmjokKCP6pbQZFN-B923uYGZAEzPlcgMnkJwZFMj3lKvmpb1K-3un9q7ObmBikauf2q_RoOorn4neo3UfZnyPZ20PyC2Z6NRd0y918evqIrymFyllq1SVqQFW2-P_xUBT17YJCLluii2tfJ1lghjUXdPC71Jqf9TitS1BtO3YfDHzNulp9S13pVsGoQzPPwgsKvZ3BQTtWbAYB5N68qsk4_y0aWTcpk5-tWmo57daMVYtMY84XMjlTt16YfL9-8h09SuNjAjAAVNRGC_UW8GE1lax-Yp4y1HsYWQTsFn5wmirhNG8wQ6QMwtafXd8nYUW3ML3-cMrP-P3U5li-IePWvnd2cBLZZEDXpHi43RosGC2ksvNkeDsNzIOM9g4GrLpEqzzhODG-V3m6mqmxXia_gdyVyv0FB_4rWnyn35-dy4pbffd68kPFvxNVdgglpggPJ0cUT3GrbSf1z1JRKXVvZiq3T2Hz1Ynk91ceY6DcebhmfBzI6rJiK1JrMXHk4RwkpBmqFzPbJTQIZoUOSHvLGJIV_zRDCkedIAYeJ1YV0G2oHf2RDKZlmnzdk0vJh5LywmMiRkZwHi9kyWdIgFCkm50VFVJQoDEbA65C-Mhqc5pBREuEUQgVdL_TGJHg3OU0007FqWwOQwZbVDB6ULksj0Tpj8-T-Gl9NVqxB4hfQuE8mgMvIXxOdZLdMAev0ZfjvzZvuLdiPCi63NDdh4_wJY_IxM&amp;lang=sage" rel="nofollow noreferrer">slightly longer script</a> that extracts the longitude of the node and converts it to a float.</p>

CC BY-SA 4.0
2023-08-13T15:17:50.247Z
Thank you for introducing me to several new technologies, which in turn have improved my understanding as well as providing an answer to my question.
kh_model
CC BY-SA 4.0
2023-08-13T21:50:01.063Z
@kh_model My pleasure! I should mention that when you specify the equator as the reference plane you get the longitude of where the Moon's orbit passes northward through the equatorial plane. This is generally different to the RA of the point where the orbit passes through the ecliptic.
PM 2Ring
CC BY-SA 4.0
2023-08-14T02:41:33.093Z
While the subject of longitude has been well addressed by the generous answers already given here, I am still wondering how to get latitude. As the Swiss Ephemeris has no trouble providing geocentric right ascension and declination for the lunar north node, maybe someone could clarify if that information can be converted somehow to geocentric latitude. I hope that someone can also comment about how to get heliocentric latitude, and or heliocentric declination.
kh_model
CC BY-SA 4.0
2023-08-14T03:30:17.827Z
@kh_model https://en.wikipedia.org/wiki/Astronomical_coordinate_systems has info on converting between ecliptic & equatorial coordinates. Converting between geocentric and heliocentric is harder, because you need to know the position of the Earth on its orbit.
PM 2Ring
CC BY-SA 4.0
2023-08-14T03:34:00.077Z
@kh_model The usual geocentric north node is relative to the ecliptic, so it has (by definition) ecliptic latitude = 0°. Similarly, the geocentric north node relative to the equatorial plane has declination = 0°.
PM 2Ring
CC BY-SA 4.0
2023-08-13T06:13:51.643Z
2023-08-13T06:13:51.643Z
PM 2Ring
<p>I am wondering how to get the heliocentric longitude and latitude for the Lunar North Node, for example.</p>
<p>I have been able to extract from the Swiss Ephemeris api the geocentric and heliocentric longitude and latitude of the Earth's moon, as well as the geocentric Right Ascension and Declination of the Earth's moon.</p>
<p>Unfortunately, it seems to me that the Swiss Ephemeris api consistently reports a value of zero for the heliocentric and geocentric longitude and latitude of the Lunar North Node and South Node. I have been able to extract from the Swiss Ephemeris api the geocentric Right Ascension and Declination for the Lunar North Node and South Node, but the heliocentric values are zero.</p>
<p>I suspect that guidance has already been provided on this forum about how to transform Right Ascension and Declination values to Longitude and Latitude, but if I succeeded in doing that for the Lunar North Node, then I would expect my results to be expressed in terms of geocentric Longitude and Latitude only.</p>
<p>Does anyone have a suggestion about how to get the heliocentric Longitude and Latitude, or alternatively the heliocentric Right Ascension and Declination of the Lunar North Node?</p>

CC BY-SA 4.0
2023-08-13T12:34:35.497Z
This doesn't make sense to me.  The North (ie ascending) node is defined in terms of the moon's orbit around the Earth. It doesn't have a heliocentric position in any meaningful way. I suppose you could talk about the moon's orbit around the sun, But this isn't usefully a Keplarian orbit, since it is so perturbed by the Earth.
James K
CC BY-SA 4.0
2023-08-13T21:34:00.133Z
@JamesK I agree that the Moon's solar orbit is complicated, and it's not clear why the OP wants the Moon's heliocentric nodes. OTOH, the points where the Moon's trajectory crosses the reference planes are well-defined.
PM 2Ring
CC BY-SA 4.0
2023-08-13T22:08:00.810Z
I still don't think it makes sense.  The whole point of the Keplarian elements is to approximate an orbit.  But the moon's orbit around the sun isn't usefully approximated by a Keplarian orbit, except approximating it as the barycentere of the Earth-moon system.  It's all nonsense, and probably just for some astrology to boot, so
James K
<the-sun>
lunar north node in heliocentric terms?
kh_model
# lunar north node in heliocentric terms?

(Asked by: username_0 on 2023-08-13)

I am wondering how to get the heliocentric longitude and latitude for the Lunar North Node, for example.

I have been able to extract from the Swiss Ephemeris api the geocentric and heliocentric longitude and latitude of the Earth's moon, as well as the geocentric Right Ascension and Declination of the Earth's moon.

Unfortunately, it seems to me that the Swiss Ephemeris api consistently reports a value of zero for the heliocentric and geocentric longitude and latitude of the Lunar North Node and South Node. I have been able to extract from the Swiss Ephemeris api the geocentric Right Ascension and Declination for the Lunar North Node and South Node, but the heliocentric values are zero.

I suspect that guidance has already been provided on this forum about how to transform Right Ascension and Declination values to Longitude and Latitude, but if I succeeded in doing that for the Lunar North Node, then I would expect my results to be expressed in terms of geocentric Longitude and Latitude only.

Does anyone have a suggestion about how to get the heliocentric Longitude and Latitude, or alternatively the heliocentric Right Ascension and Declination of the Lunar North Node?

**Tags:** the-sun

> **Comments:**
> **username_1**: This doesn't make sense to me.  The North (ie ascending) node is defined in terms of the moon's orbit around the Earth. It doesn't have a heliocentric position in any meaningful way. I suppose you could talk about the moon's orbit around the sun, But this isn't usefully a Keplarian orbit, since it is so perturbed by the Earth.  
> **username_2**: @JamesK I agree that the Moon's solar orbit is complicated, and it's not clear why the OP wants the Moon's heliocentric nodes. OTOH, the points where the Moon's trajectory crosses the reference planes are well-defined.  
> **username_1**: I still don't think it makes sense.  The whole point of the Keplarian elements is to approximate an orbit.  But the moon's orbit around the sun isn't usefully approximated by a Keplarian orbit, except approximating it as the barycentere of the Earth-moon system.  It's all nonsense, and probably just for some astrology to boot, so  

---

## 1 answers

### Answer by username_2 on 2023-08-13. Score: 2 | Accepted answer

The longitude of the ascending node is a standard orbital element, usually given the symbol $\Omega$ (upper-case omega). You can request osculating orbital elements of many solar system bodies from JPL Horizons.
For lunar elements, Horizons gives you two choices of reference plane: the ICRF frame XY plane, which is essentially the Earth equatorial plane of the J2000.0 epoch, or the J2000.0 ecliptic plane. If you use the ecliptic plane, the resulting longitude is the ecliptic longitude of the node. If you use the equatorial plane, the resulting longitude is the RA of the node.
Orbit elements are calculated using TDB (Barycentric Dynamical Time). Currently, delta_T = TDB - UT is ~69 seconds. You can query Horizons for a more accurate value of delta_T when requesting an Observer or Vector table, but not when requesting an Elements table.
Here is a typical Horizons batch file that requests the Moon's elements relative to the center of the Earth, using the ecliptic plane. The center of the Earth has ID number 399, the Moon has ID number 301 (the Earth-Moon barycenter has ID 3).
!$$SOF
MAKE_EPHEM = 'YES'
OBJ_DATA = 'NO'
COMMAND = '301'
CENTER = '@399'
EPHEM_TYPE = 'ELEMENTS'
CAL_TYPE = 'GREGORIAN'
CSV_FORMAT = 'YES'
REF_PLANE= 'Ecliptic'
START_TIME = '2023-Aug-1'
STOP_TIME = '2023-Aug-8'
STEP_SIZE = '1d'
!$$EOF

Here's some Python / Sage code that makes the request using the Horizons file API and prints the results. The code is mostly plain Python, it just uses some Sage features to get the input arguments. You can select geocentric or heliocentric data, and you can select the reference plane. And you can select the time span. Please see the Horizons docs for info on all of the time specification options.
""" Retrieve orbital elements of the Moon from Horizons,
    relative to the Earth or the Sun.

    Written by username_2 2023.08.13
"""

import re, requests

url = "https://ssd.jpl.nasa.gov/api/horizons_file.api"
api_version = "1.0"

base_cmd = """
MAKE_EPHEM = 'YES'
OBJ_DATA = 'NO'
COMMAND = '301'
EPHEM_TYPE = 'ELEMENTS'
CAL_TYPE = 'GREGORIAN'
CSV_FORMAT = 'YES'
"""

def fetch_data(center, plane, start, stop, step, verbose=False):
    cmd = f"""
!$$SOF
{base_cmd}
CENTER = '{center}'
REF_PLANE= '{plane}'
START_TIME = '{start}'
STOP_TIME = '{stop}'
STEP_SIZE = '{step}'
!$$EOF
"""
    #print(cmd)
    req = requests.post(url, data={'format': 'text'}, files={'input': ('cmd', cmd)})
    version = re.search(r"API VERSION:\s*(\S*)", req.text).group(1)
    if version != api_version:
        print(f"Warning: API version is {version}, but this script is for {api_version}")

    m = re.search(r"(?s)\\\$\\\$SOE(.*)\\\$\\\$EOE", req.text)
    if m is None:
        print("NO EPHEMERIS")
        print(req.text)
        return None

    if verbose:
        print(req.text)
    else:
        lines = req.text.splitlines()
        print("\n".join(lines[5:16]))

    return m.group(1)[1:]

@interact
def main(txt=HtmlBox("The Moon's orbital elements"),
  center=Selector([("@399", "Earth"), ("@10", "Sun")], selector_type='radio'),
  plane = Selector([("Ecliptic", "Ecliptic"), ("Frame", "Equator")], selector_type='radio'),
  start="2023-Aug-1", stop="2023-Aug-8", step="1d",
  verbose=True, auto_update=False):

    result = fetch_data(center, plane,
      start.strip(), stop.strip(), step.strip(), verbose=verbose)
    if result is None:
        print("No ephemeris data found!")
        return

    print(result)

Here's a live version of that script, running on the SageMathCell server.
The query returns results in plain ASCII form. Here's the ephemeris portion of the results.
            JDTDB,            Calendar Date (TDB),                     EC,                     QR,                     IN,                     OM,                      W,                     Tp,                      N,                     MA,                     TA,                      A,                     AD,                     PR,
**************************************************************************************************************************************************************************************************************************************************************************************************************************************************
$$SOE
2460157.500000000, A.D. 2023-Aug-01 00:00:00.0000,  7.445758991458748E-02,  3.571365862619948E+05,  5.008652258592002E+00,  2.822256182533066E+01,  2.900634646762910E+02,  2.460158888058302E+06,  1.518410206123902E-04,  3.417899740459997E+02,  3.388674616251798E+02,  3.858673382984544E+05,  4.145980903349139E+05,  2.370900818158910E+06,
2460158.500000000, A.D. 2023-Aug-02 00:00:00.0000,  7.442018378647541E-02,  3.573039656944939E+05,  5.010438148654570E+00,  2.804632484702357E+01,  2.884738888530200E+02,  2.460158772626169E+06,  1.517435366605044E-04,  3.564256960231063E+02,  3.558398892112612E+02,  3.860325813458171E+05,  4.147611969971404E+05,  2.372423945841116E+06,
2460159.500000000, A.D. 2023-Aug-03 00:00:00.0000,  7.340284302854846E-02,  3.572496770205199E+05,  5.016123674133671E+00,  2.788500405977741E+01,  2.869024014201097E+02,  2.460158658978031E+06,  1.520284336503910E-04,  1.104703942319290E+01,  1.281728923915146E+01,  3.855501544901964E+05,  4.138506319598729E+05,  2.367978090387134E+06,
2460160.500000000, A.D. 2023-Aug-04 00:00:00.0000,  7.162883937549905E-02,  3.569891829431704E+05,  5.024686604357866E+00,  2.775623512602453E+01,  2.850820375305457E+02,  2.460158530548510E+06,  1.526321490973527E-04,  2.597197940124664E+01,  2.987693813420488E+01,  3.845328227376530E+05,  4.120764625321357E+05,  2.358611879142072E+06,
2460161.500000000, A.D. 2023-Aug-05 00:00:00.0000,  6.957637835472257E-02,  3.565535202363541E+05,  5.034473963517143E+00,  2.766974414675761E+01,  2.829331038624139E+02,  2.460158382784924E+06,  1.534193512592334E-04,  4.132003231720461E+01,  4.694188100651857E+01,  3.832163242006440E+05,  4.098791281649340E+05,  2.346509726740445E+06,
2460162.500000000, A.D. 2023-Aug-06 00:00:00.0000,  6.771479272345840E-02,  3.560319643831986E+05,  5.043614138526157E+00,  2.762519150265715E+01,  2.806633899532325E+02,  2.460158229386336E+06,  1.542182772497700E-04,  5.690361733634386E+01,  6.370248607985509E+01,  3.818916803617047E+05,  4.077513963402107E+05,  2.334353660409191E+06,
2460163.500000000, A.D. 2023-Aug-07 00:00:00.0000,  6.625425330791064E-02,  3.556004033547897E+05,  5.050458943166362E+00,  2.761268189373863E+01,  2.787078308606339E+02,  2.460158097611625E+06,  1.548623091365481E-04,  7.228451565776196E+01,  7.968276040122535E+01,  3.808321533078448E+05,  4.060639032608998E+05,  2.324645693372517E+06,
2460164.500000000, A.D. 2023-Aug-08 00:00:00.0000,  6.507275768816487E-02,  3.554955131298805E+05,  5.053938392861703E+00,  2.761547227317707E+01,  2.775232172597620E+02,  2.460158014454506E+06,  1.552250039753550E-04,  8.698050648988226E+01,  9.443786013757804E+01,  3.802386934953690E+05,  4.049818738608575E+05,  2.319213984733781E+06,
$$EOE
**************************************************************************************************************************************************************************************************************************************************************************************************************************************************

Here's a URL for the same request using the GET-based API:
https://ssd.jpl.nasa.gov/api/horizons.api?format=text&MAKE_EPHEM=YES&OBJ_DATA=NO&COMMAND=301&EPHEM_TYPE=ELEMENTS&CAL_TYPE=GREGORIAN&CSV_FORMAT=YES&CENTER=%40399&REF_PLANE=Ecliptic&START_TIME=2023-Aug-1&STOP_TIME=2023-Aug-8&STEP_SIZE=1d
Here's a slightly longer script that extracts the longitude of the node and converts it to a float.

> **Comments:**
> **username_0**: Thank you for introducing me to several new technologies, which in turn have improved my understanding as well as providing an answer to my question.  
> **username_2**: @username_0 My pleasure! I should mention that when you specify the equator as the reference plane you get the longitude of where the Moon's orbit passes northward through the equatorial plane. This is generally different to the RA of the point where the orbit passes through the ecliptic.  
> **username_0**: While the subject of longitude has been well addressed by the generous answers already given here, I am still wondering how to get latitude. As the Swiss Ephemeris has no trouble providing geocentric right ascension and declination for the lunar north node, maybe someone could clarify if that information can be converted somehow to geocentric latitude. I hope that someone can also comment about how to get heliocentric latitude, and or heliocentric declination.  
> **username_2**: @username_0 https://en.wikipedia.org/wiki/Astronomical_coordinate_systems has info on converting between ecliptic & equatorial coordinates. Converting between geocentric and heliocentric is harder, because you need to know the position of the Earth on its orbit.  
> **username_2**: @username_0 The usual geocentric north node is relative to the ecliptic, so it has (by definition) ecliptic latitude = 0°. Similarly, the geocentric north node relative to the equatorial plane has declination = 0°.  

---

