Get EclipticCoord Data

Asked by Thomas Beane

I could successfully obtain data about a planet in 0.14 using core.getObjectInfo("planet").

However, I cannot fathom how in 0.15 to use "getInfoString" to obtain the "EclipticCoord" data for a planet, say "Jupiter".

Every combination tried returns such as: "TypeError: Result of expression 'core.getInfoString' [undefined] is not a function."

Thanks for the help.

Question information

Language:
English Edit question
Status:
Solved
For:
Stellarium Edit question
Assignee:
No assignee Edit question
Solved by:
Alexander Wolf
Solved:
Last query:
Last reply:
Revision history for this message
Alexander Wolf (alexwolf) said :
#1

Please read the documentation

Revision history for this message
Thomas Beane (crosswiseranger) said :
#2

Well alexwolf, that was a major contribution to solving my problem.

I have been through all of the examples -- though found nothing similar there.

I have been through the documentation. Tried many variations of what I thought it was saying. No joy!

Could you provide a line or two of code showing how to?

Revision history for this message
gzotti (georg-zotti) said :
#3

What is getInfoString?

What does your 0.14 script do when you call it with 0.15?

http://stellarium.org/doc/head/classStelMainScriptAPI.html#ad831d70086a1ad8f64d8377672fd143c

Revision history for this message
Thomas Beane (crosswiseranger) said :
#4

My comment about 0.14 was to show that I have read the documentation and could successfully run scripts to do what I wanted.

Not being C++ trained and hampered by the limited documentation for the function I need to use -- I cannot get to work.

Here is the function needing to use: http://stellarium.org/doc/head/classStelObject.html

virtual QString StelObject::getInfoString(const StelCore * core, const InfoStringGroup & flags = StelObject::AllInfo) const

enum  InfoStringGroupFlags {EclipticCoord = 0x00002000} EclipticCoord  The ecliptic position.

What confuses me, how do I code:

1. var StringReturn = StelObject.getInfoString(core, StelObject.AllInfo);

2. var EclipticString = StringReturn["EclipticCoord"];

Also, this works:

var TargetData = core.getObjectInfo("Saturn");
var baseGeoAzimuth = TargetData["azimuth"]

3. For #1 above on "getInfoString", how do I set or select what object / planet to get the info for?

Thanks for the help.

Revision history for this message
Best Alexander Wolf (alexwolf) said :
#5

> My comment about 0.14 was to show that I have read the documentation and could successfully run scripts to do what I wanted.

Sorry, I see that you didn't read the documentation.

Because:
1) On this page - http://stellarium.org/doc/head/scripting.html - you can read "The public slots for each of the following classes are available in the scripting engine via an object with the same name as the corresponding class" and "The public slots in the class StelMainScriptAPI are available via an object named core."

2) You give code 'core.getObjectInfo("planet")' and give example:
var TargetData = core.getObjectInfo("Saturn");
var baseGeoAzimuth = TargetData["azimuth"]

But in the documentation for getObjectInfo() function (http://stellarium.org/doc/head/classStelMainScriptAPI.html#ad831d70086a1ad8f64d8377672fd143c - Georg gave this link upper) you can read:
"Returns
a map of object data. Keys:
...
* elong : ecliptic longitude in decimal degrees (on Earth only!)
* elat : ecliptic latitude in decimal degrees (on Earth only!)
* elongJ2000 : ecliptic longitude (J2000 frame) in decimal degrees (on Earth only!)
* elatJ2000 : ecliptic latitude (J2000 frame) in decimal degrees (on Earth only!)
...
"
And your example should be write as:
var TargetData = core.getObjectInfo("Jupiter");
var eclLongitude = TargetData["elong"];
var eclLatitude = TargetData["elat"];

In the last link the word "azimuth" you can see on second line of key list, and word "ecliptic" on line 11 in the same list.

Revision history for this message
Thomas Beane (crosswiseranger) said :
#6

Thanks georg-zotti and alexwolf. Exactly what I was trying to find.

Revision history for this message
Thomas Beane (crosswiseranger) said :
#7

Thanks Alexander Wolf, that solved my question.