<p>You have found a limitation in the Horizons file API. I've tried various tricks but I can't get it to accept more than one TLE body at a time. You <em>can</em> supply multiple TLE items, but each new item overrides the previous one, so only the last one is used.</p>
<p>Horizons author Jon D. Giorgini confirms this in a <a href="https://astronomy.stackexchange.com/questions/57688/inconsistent-tle-object-name-line-ignored-error-while-using-jpl-horizons-api/57691?noredirect=1#comment132197_57688">comment</a>:</p>
<blockquote>
<p>Horizons currently supports only one user-defined TLE object (Earth-orbiter) and one user-defined heliocentric object (asteroid, etc.). If another is input, the prior one of that type is over-written. This is by design</p>
<p>... observing one user-input TLE object from another user-input TLE object wasn't expected to be a significant use case, so there's no internal plumbing to keep track of multiple user-input objects. However, objects already defined in the program can look at each other (JWST observe Hubble, etc.)</p>
</blockquote>
<p>However, for your application, that doesn't matter. Although the Telnet and email interfaces accept requests for multiple COMMAND targets, the HTTP APIs can only create one ephemeris at a time. So with the File API that you're using, the only situation where you'd <em>need</em> to input two TLE bodies is to create an ephemeris where you're observing one TLE body from another TLE body.</p>
<hr />
<p>Here's a batch file for your SC1 body:</p>
<pre><code>!<span class="math-container">$$SOF
TLE='sc1
1 40045U 14033AM  24138.43332122  .00010340  00000-0  12461-2 0  9996
2 40045  97.6690 313.1412 0050995  24.2209 336.1387 14.83088260533231
'
COMMAND='TLE'
CENTER='coord@399'
OBJ_DATA='YES'
MAKE_EPHEM='YES'
CSV_FORMAT='YES'
TABLE_TYPE='OBSERVER'
COORD_TYPE='GEODETIC'
SITE_COORD='-156.94105,21.072415,0.1'
START_TIME='2024-05-18 5:00'
STOP_TIME='2024-05-18 16:00'
STEP_SIZE='1h'
QUANTITIES='1,4,12'
SKIP_DAYLT='YES'
!$$</span>EOF
</code></pre>
<p>And here's the ephemeris data it generates:</p>
<pre><code>$$SOE

&gt;..... Daylight Cut-off Requested .....&lt;

 2024-May-18 06:00,A,m, 21 57 02.55, +10 21 18.5,   33.718447,   -52.881108, 133242.5,    *,
 2024-May-18 07:00, ,m, 01 15 40.85, -56 27 50.8,  193.499446,   -53.104202, 133275.7,    *,
 2024-May-18 08:00, ,m, 04 00 51.16, +35 55 24.9,  325.317515,   -20.985471, 248071.4,    *,
 2024-May-18 09:00, ,m, 23 28 51.06, -22 51 02.2,  100.463290,   -51.060178, 140267.9,    *,
 2024-May-18 10:00, ,m, 06 03 31.63, -30 28 42.8,  247.093033,   -51.717685, 137997.6,    *,
 2024-May-18 11:00, ,m, 02 41 17.81, +41 43 29.2,   19.250050,   -23.300691, 239679.8,    *,
 2024-May-18 12:00, ,m, 03 32 12.06, -56 34 56.5,  157.679887,   -49.518166, 146163.4,    *,
 2024-May-18 13:00, , , 07 46 53.13, +03 25 48.7,  315.646322,   -57.232331, 117632.8,    *,
 2024-May-18 14:00, , , 00 56 58.53, -07 13 36.2,   98.515892,     2.317214, 332410.3,    *,
 2024-May-18 15:00,N, , 08 13 58.37, -40 17 03.6,  177.370084,   -70.686728, 69990.79,    *,

&gt;..... Daylight Cut-off Requested .....&lt;

$$EOE
</code></pre>
<p>Here's a minimal <a href="https://sagecell.sagemath.org/?z=eJxlUk2P2jAQvftXuKuVDFIw448EghSpAbxtuoTQxLsSvUQRsCUVkDQJVdVq%5F3snLXuqD5bnvZl5M54pz3XVdLQ5fL8e2q4lZHfe04Ayxsi7%2D%5FsseSB2ZQLW7gQRVANo94kKDUqFMaVSCzXlWiklhZSUcgAQoDRQCv0Z4UNI7YmRpPj0fd8j8l8WtCbc83ygSigutEAPcMH33T4tlxJ8qpTHUWCCgnyqYDqVHriopQRhZJHEcbheBgzrQ8usrUkDtquqZv9e%2DT4jyfxTvgxtGLCtyRiJw0eTm81HE9%2DARfacPyRpHNobYMP5yuR2u8F%2Dk3lm0meT9jpJuryhH0yyNDZaMJJF1uR%5FqYCNhOtxXwtwHSk4TPBXXAe4QC8bpja3UYyxEqQegTsSU%2DrOAHoy2fzPCe9Gmk2eRV%2DQFEdGPj%2DFaxvZyGRoO9oREl0eow02uF291Y%5FzMjivfnTk2pxwinfHrqvb2Xjctnv%2DrT7xS9EW%5FGv1Y1zU5fhYNeWv6tLmL%2DXpwBG5I7gGGPa2DLyu2m6AqRy6L7oi%2DM1equZcdGxGWXf42bFXh%5FaxLTLlpb72xIDhAjGH4j18HZK6KS%5FdABPyPmBI%5FgDTuaDP&amp;lang=python" rel="nofollow noreferrer">Python script</a> that executes the request.</p>
<p>According to the Horizons manual, you can use the SPK id <code>-840045</code> for that body when specifying the body as the CENTER, but it raises an error if you try to use that id for the COMMAND target.</p>
<p>BTW, I have a couple of basic Sage / Python scripts that execute Horizons batch files on <a href="https://gist.github.com/PM2Ring/b1fec75e78cc08f6fc28c6f6c43529c3" rel="nofollow noreferrer">Github</a>.</p>

CC BY-SA 4.0
2024-05-25T19:38:29.520Z
Use of SPK IDs for user-input TLEs applies only to the command-line interface.  Say you enter a TLE for an object ... you can then go off and do other things and then come back to it by entering "TLE" OR the SPK ID.  

This doesn't work in the e-mail or API interfaces, since it needs "COMMAND" to tell it what to do (accept input of a TLE) ... the SPK ID  is only an after-the fact method to access something already stored using the TLE command. But there is no after-the-fact for e-mail or API interfaces.
Jon Giorgini
CC BY-SA 4.0
2024-05-25T20:14:31.390Z
Ah, ok. That makes sense. Thanks, @JonGiorgini
PM 2Ring
CC BY-SA 4.0
2024-05-18T13:34:19.023Z
2024-05-26T07:26:07.260Z
2024-05-26T07:26:07.260Z
PM 2Ring
<p>I have troubles with usage of JPL Horizons API to generate ephemeris of more than one satellites. I'm not using and don't want to use any external libraries to do this.</p>
<p>Currently I have this piece of code:</p>
<pre><code>f = open(&quot;input.txt&quot;)
url = 'https://ssd.jpl.nasa.gov/api/horizons_file.api'
r = requests.post(url, data={'format':'json'}, files={'input': f})
result = r.json()[&quot;result&quot;].split(&quot;<span class="math-container">$$SOE")[-1].split("$$</span>EOE&quot;)[0].lstrip(&quot;\n&quot;).rstrip(&quot;\n&quot;).split(&quot;\n&quot;)
f.close()
    
print(result)
</code></pre>
<p>and my <em>input.txt</em> looks like this:</p>
<pre><code>!$$SOF
COMMAND='TLE'
TLE='
sc1
1 40045U 14033AM  24138.43332122  .00010340  00000-0  12461-2 0  9996
2 40045  97.6690 313.1412 0050995  24.2209 336.1387 14.83088260533231
sc2
1 40046U 14033AN  24138.75674949  .00010420  00000-0  12311-2 0  9991
2 40046  97.6653 312.1300 0049460  18.7462 341.5560 14.83957905533335'
OBJ_DATA='NO'
MAKE_EPHEM='YES'
CSV_FORMAT='YES'
TABLE_TYPE='OBSERVER'
CENTER='coord'
COORD_TYPE=GEODETIC
SITE_COORD='-156.94105,21.072415,0.1'
START_TIME='2024-05-18 5:00'
STOP_TIME='2024-05-18 16:00'
STEP_SIZE='1h'
QUANTITIES='1,4,12'
SKIP_DAYLT = 'YES'
</code></pre>
<p>Unfortunately when I run this code I get this message printed as a result:</p>
<pre><code>['*** Error: inconsistent TLE object name (LINE IGNORED):', ' #1: &quot;SC1&quot;', ' #2: &quot;SC2&quot;', 'WLDINI: error loading execution-control file.']
</code></pre>
<p>Does anyone know how to properly query multiple satellites objects? According to <a href="https://ssd.jpl.nasa.gov/horizons/manual.html#tles" rel="nofollow noreferrer">Horizons API Manual</a> :</p>
<blockquote>
<p>The first line can be the objects’ name (“SC-1”), as can every 3rd line. Names are a maximum of 24 characters in length.</p>
</blockquote>
<p>and</p>
<blockquote>
<p>Multiple TLE sets can be input, up to some system limit which may change but is nominally 600 sets (1200 data lines … name lines are not counted)</p>
</blockquote>
<p>So I don't see a reason why this doesn't work.</p>

CC BY-SA 4.0
2024-05-25T19:30:29.130Z
Horizons currently supports only one user-defined TLE object (Earth-orbiter) and one user-defined heliocentric object (asteroid, etc.).  If another is input, the prior one of that type is over-written. This is by design ... observing one user-input TLE object from another user-input TLE object wasn't expected to be a significant use case, so there's no internal plumbing to keep track of multiple user-input objects. However, objects already defined in the program can look at each other (JWST observe Hubble, etc.)
Jon Giorgini
CC BY-SA 4.0
2024-05-26T15:11:36.493Z
Horizons can only generate ephemeris for one object per call.  If you want ephemeris for multiple satellites, you'll have to make multiple calls.
Greg Miller
<python><artificial-satellite><jpl-horizons>
"inconsistent TLE object name (LINE IGNORED)" error while using JPL Horizons API in python
jlipinski
# "inconsistent TLE object name (LINE IGNORED)" error while using JPL Horizons API in python

(Asked by: username_0 on 2024-05-18)

I have troubles with usage of JPL Horizons API to generate ephemeris of more than one satellites. I'm not using and don't want to use any external libraries to do this.
Currently I have this piece of code:
f = open("input.txt")
url = 'https://ssd.jpl.nasa.gov/api/horizons_file.api'
r = requests.post(url, data={'format':'json'}, files={'input': f})
result = r.json()["result"].split("$$SOE")[-1].split("$$EOE")[0].lstrip("\n").rstrip("\n").split("\n")
f.close()
    
print(result)

and my input.txt looks like this:
!$$SOF
COMMAND='TLE'
TLE='
sc1
1 40045U 14033AM  24138.43332122  .00010340  00000-0  12461-2 0  9996
2 40045  97.6690 313.1412 0050995  24.2209 336.1387 14.83088260533231
sc2
1 40046U 14033AN  24138.75674949  .00010420  00000-0  12311-2 0  9991
2 40046  97.6653 312.1300 0049460  18.7462 341.5560 14.83957905533335'
OBJ_DATA='NO'
MAKE_EPHEM='YES'
CSV_FORMAT='YES'
TABLE_TYPE='OBSERVER'
CENTER='coord'
COORD_TYPE=GEODETIC
SITE_COORD='-156.94105,21.072415,0.1'
START_TIME='2024-05-18 5:00'
STOP_TIME='2024-05-18 16:00'
STEP_SIZE='1h'
QUANTITIES='1,4,12'
SKIP_DAYLT = 'YES'

Unfortunately when I run this code I get this message printed as a result:
['*** Error: inconsistent TLE object name (LINE IGNORED):', ' #1: "SC1"', ' #2: "SC2"', 'WLDINI: error loading execution-control file.']

Does anyone know how to properly query multiple satellites objects? According to Horizons API Manual :

The first line can be the objects’ name (“SC-1”), as can every 3rd line. Names are a maximum of 24 characters in length.

and

Multiple TLE sets can be input, up to some system limit which may change but is nominally 600 sets (1200 data lines … name lines are not counted)

So I don't see a reason why this doesn't work.

**Tags:** python, artificial-satellite, jpl-horizons
> **Comments:**
> **username_1**: Horizons currently supports only one user-defined TLE object (Earth-orbiter) and one user-defined heliocentric object (asteroid, etc.).  If another is input, the prior one of that type is over-written. This is by design ... observing one user-input TLE object from another user-input TLE object wasn't expected to be a significant use case, so there's no internal plumbing to keep track of multiple user-input objects. However, objects already defined in the program can look at each other (JWST observe Hubble, etc.)  
> **username_2**: Horizons can only generate ephemeris for one object per call.  If you want ephemeris for multiple satellites, you'll have to make multiple calls.  

---

## 1 answers

### Answer by username_3 on 2024-05-18. Score: 2 | Accepted answer

You have found a limitation in the Horizons file API. I've tried various tricks but I can't get it to accept more than one TLE body at a time. You can supply multiple TLE items, but each new item overrides the previous one, so only the last one is used.
Horizons author Jon D. Giorgini confirms this in a comment:

Horizons currently supports only one user-defined TLE object (Earth-orbiter) and one user-defined heliocentric object (asteroid, etc.). If another is input, the prior one of that type is over-written. This is by design
... observing one user-input TLE object from another user-input TLE object wasn't expected to be a significant use case, so there's no internal plumbing to keep track of multiple user-input objects. However, objects already defined in the program can look at each other (JWST observe Hubble, etc.)

However, for your application, that doesn't matter. Although the Telnet and email interfaces accept requests for multiple COMMAND targets, the HTTP APIs can only create one ephemeris at a time. So with the File API that you're using, the only situation where you'd need to input two TLE bodies is to create an ephemeris where you're observing one TLE body from another TLE body.

Here's a batch file for your SC1 body:
!$$SOF
TLE='sc1
1 40045U 14033AM  24138.43332122  .00010340  00000-0  12461-2 0  9996
2 40045  97.6690 313.1412 0050995  24.2209 336.1387 14.83088260533231
'
COMMAND='TLE'
CENTER='coord@399'
OBJ_DATA='YES'
MAKE_EPHEM='YES'
CSV_FORMAT='YES'
TABLE_TYPE='OBSERVER'
COORD_TYPE='GEODETIC'
SITE_COORD='-156.94105,21.072415,0.1'
START_TIME='2024-05-18 5:00'
STOP_TIME='2024-05-18 16:00'
STEP_SIZE='1h'
QUANTITIES='1,4,12'
SKIP_DAYLT='YES'
!$$EOF

And here's the ephemeris data it generates:
$$SOE

>..... Daylight Cut-off Requested .....<

 2024-May-18 06:00,A,m, 21 57 02.55, +10 21 18.5,   33.718447,   -52.881108, 133242.5,    *,
 2024-May-18 07:00, ,m, 01 15 40.85, -56 27 50.8,  193.499446,   -53.104202, 133275.7,    *,
 2024-May-18 08:00, ,m, 04 00 51.16, +35 55 24.9,  325.317515,   -20.985471, 248071.4,    *,
 2024-May-18 09:00, ,m, 23 28 51.06, -22 51 02.2,  100.463290,   -51.060178, 140267.9,    *,
 2024-May-18 10:00, ,m, 06 03 31.63, -30 28 42.8,  247.093033,   -51.717685, 137997.6,    *,
 2024-May-18 11:00, ,m, 02 41 17.81, +41 43 29.2,   19.250050,   -23.300691, 239679.8,    *,
 2024-May-18 12:00, ,m, 03 32 12.06, -56 34 56.5,  157.679887,   -49.518166, 146163.4,    *,
 2024-May-18 13:00, , , 07 46 53.13, +03 25 48.7,  315.646322,   -57.232331, 117632.8,    *,
 2024-May-18 14:00, , , 00 56 58.53, -07 13 36.2,   98.515892,     2.317214, 332410.3,    *,
 2024-May-18 15:00,N, , 08 13 58.37, -40 17 03.6,  177.370084,   -70.686728, 69990.79,    *,

>..... Daylight Cut-off Requested .....<

$$EOE

Here's a minimal Python script that executes the request.
According to the Horizons manual, you can use the SPK id -840045 for that body when specifying the body as the CENTER, but it raises an error if you try to use that id for the COMMAND target.
BTW, I have a couple of basic Sage / Python scripts that execute Horizons batch files on Github.

> **Comments:**
> **username_1**: Use of SPK IDs for user-input TLEs applies only to the command-line interface.  Say you enter a TLE for an object ... you can then go off and do other things and then come back to it by entering "TLE" OR the SPK ID.    This doesn't work in the e-mail or API interfaces, since it needs "COMMAND" to tell it what to do (accept input of a TLE) ... the SPK ID  is only an after-the fact method to access something already stored using the TLE command. But there is no after-the-fact for e-mail or API interfaces.  
> **username_3**: Ah, ok. That makes sense. Thanks, @JonGiorgini  

---

