It is currently September 21st, 2020, 12:49 pm

Planetarium with Near Earth Objects

General topics related to Rainmeter.
Fulmar
Posts: 16
Joined: July 24th, 2012, 4:50 pm
Location: Belgium

Planetarium with Near Earth Objects

Post by Fulmar »

Hello everybody. In order to design a skin concerning a planetarium with the coordinates of 10 Near Earth Objects, coming close to the Earth in the coming weeks, I want to use the names of the Asteroids on https://cneos.jpl.nasa.gov/ca/ (under "Object"). These names themselves are linked to another website, for instance https://ssd.jpl.nasa.gov/sbdb.cgi?sstr=2016%20AH164 where the necessary elements e, a, i, node, peri, M, n and Epoch are shown. These elements are needed to calculate the coordinates.
It's not a problem to calculate the coordinates in Rainmeter.
But to get the elements in Rainmeter is a big problem for me.
For instance I noticed I cannot obtain the links on https://cneos.jpl.nasa.gov/ca/. They are not shown on view-source:https://cneos.jpl.nasa.gov/ca/.
Somebody can show me the way to proceed with this matter?
Thank you very much for your help.
User avatar
Mordasius
Posts: 1077
Joined: January 22nd, 2011, 4:23 pm
Location: GMT +8

Re: Planetarium with Near Earth Objects

Post by Mordasius »

User avatar
Yincognito
Posts: 2565
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Planetarium with Near Earth Objects

Post by Yincognito »

Fulmar wrote: August 25th, 2020, 9:39 am Hello everybody. In order to design a skin concerning a planetarium with the coordinates of 10 Near Earth Objects, coming close to the Earth in the coming weeks, I want to use the names of the Asteroids on https://cneos.jpl.nasa.gov/ca/ (under "Object"). These names themselves are linked to another website, for instance https://ssd.jpl.nasa.gov/sbdb.cgi?sstr=2016%20AH164 where the necessary elements e, a, i, node, peri, M, n and Epoch are shown. These elements are needed to calculate the coordinates.
It's not a problem to calculate the coordinates in Rainmeter.
But to get the elements in Rainmeter is a big problem for me.
For instance I noticed I cannot obtain the links on https://cneos.jpl.nasa.gov/ca/. They are not shown on view-source:https://cneos.jpl.nasa.gov/ca/.
Somebody can show me the way to proceed with this matter?
Thank you very much for your help.
Yep, it appears that https://cneos.jpl.nasa.gov/ca/ uses Javascript extensively to display things. This can't normally be accessed using Rainmeter's WebParser (or any other "regular" parser, for that matter) since populating the fields, displaying them and all happen in the Javascript code itself (i.e. not transparently, in the "background", so to speak) which in turn presents the results in the page and to the user navigating there.

Use Chrome's Developer Tools, navigate to the Sources tab, select the ca.js file and lo and behold, there you have it, waiting for you, the API address used by NASA to get the data in that table, i.e. https://ssd-api.jpl.nasa.gov/cad.api. Open it in the browser and you'll get a nice JSON like this:

Code: Select all

{"signature":{"source":"NASA/JPL SBDB Close Approach Data API","version":"1.1"},"count":"19","fields":["des","orbit_id","jd","cd","dist","dist_min","dist_max","v_rel","v_inf","t_sigma_f","h"],"data":[["2016 AH164","6","2459087.924780897","2020-Aug-26 10:12","0.0401181345888019","0.0337432767637558","0.0467732383535641","5.63017077885639","5.61836197948865","1_05:19","29.7"],["2020 PF3","5","2459088.129651518","2020-Aug-26 15:07","0.0165005024324973","0.0164446733638673","0.0165563301678282","9.57635107803248","9.55947397148452","< 00:01","25.692"],["2020 QQ2","1","2459088.635398814","2020-Aug-27 03:15","0.0219604707490722","0.0214272741269191","0.02249347740378","6.19291115290116","6.17328819538135","00:09","26.794"],["2020 QG5","1","2459093.729401506","2020-Sep-01 05:30","0.019965297980249","0.0195675849250274","0.0203629909680525","14.2315392945841","14.22215875463","00:07","25.737"],["2011 ES4","8","2459094.174754194","2020-Sep-01 16:12","0.00081083276352288","0.000477632840390022","0.105985053543994","8.16328743981237","7.75029402031393","8_00:08","25.4"],["2020 PG6","5","2459094.863020401","2020-Sep-02 08:43","0.0151490941932191","0.0151133853513917","0.0151848017251037","6.560251162466","6.53338563346118","00:02","27.023"],["465824","43","2459098.859674257","2020-Sep-06 08:38","0.0495512170477909","0.0495507132668962","0.0495517208287081","14.0418146643039","14.0379847061744","< 00:01","21.7"],["2020 PT4","3","2459101.165883435","2020-Sep-08 15:59","0.0126670858267319","0.0125187211593638","0.012815444887554","12.5606163695074","12.543858666276","00:54","24.772"],["2012 RM15","7","2459104.539140314","2020-Sep-12 00:56","0.0381386126786671","0.0187222632595231","0.0585071854525541","9.78131040967756","9.77416529709563","1_00:37","24.5"],["2017 US","12","2459106.431626408","2020-Sep-13 22:22","0.0441698636572007","0.0418274472763094","0.0465164390406176","5.94138171108134","5.93121991681671","04:16","26.1"],["2020 QL2","4","2459107.160003414","2020-Sep-14 15:50","0.0458784334362693","0.0453357787715595","0.0464210780336018","10.582962887698","10.5774736865098","00:28","23.476"],["2014 QJ33","11","2459111.396966215","2020-Sep-18 21:32","0.0293579565116144","0.00717660431380777","0.0604663812302601","8.28450232621289","8.27353987826202","2_06:16","23.7"],["2017 SL16","11","2459112.788885704","2020-Sep-20 06:56","0.0227184588865761","0.0227182587866844","0.0227186589868217","6.39728253000733","6.37892299848107","< 00:01","25.8"],["2001 GP2","16","2459124.124581813","2020-Oct-01 14:59","0.0156459035754592","0.000909498572984523","0.0367119299148074","2.21414127161807","2.13584266201369","6_17:18","26.9"],["2010 UC","10","2459126.848329403","2020-Oct-04 08:22","0.0372611055270925","0.0311238017016864","0.0437269116807565","3.21236292632068","3.19002490826751","1_04:00","27.4"],["2019 SB6","2","2459130.474376995","2020-Oct-07 23:23","0.0304426271757058","0.0227471207759548","0.038143587726216","7.57778003426213","7.56622105215934","03:41","26.8"],["2018 GD2","1","2459136.073021506","2020-Oct-13 13:45","0.0418695882785897","0.0370963199607446","0.0466556919039509","6.70010747896787","6.69060274315132","03:59","29.4"],["2017 UH5","2","2459142.636167668","2020-Oct-20 03:16","0.0228340554196692","0.0222591527415551","0.0414088955279864","5.92821261429195","5.90849618170005","6_12:30","26.5"],["2018 VG","3","2459144.153455600","2020-Oct-21 15:41","0.0387040891193301","0.0374898264219415","0.0399273001093406","6.72609608291864","6.7158531754433","19:40","27.4"]]}
As you can see, here you have all those objects in the table, along with their data. All you need to do is extract the desired object(s) by parsing this URL using a WebParser measure (I assume you know how to do that already) and then just add the name of the object to the query that you posted above like https://ssd.jpl.nasa.gov/sbdb.cgi?sstr=2018 VG, for example, and that's it.

EDIT: Or, you can use Mordasius' suggestion and get more than just the data in the initial table, by adding the desired parameters to the https://ssd-api.jpl.nasa.gov/cad.api query.
Fulmar
Posts: 16
Joined: July 24th, 2012, 4:50 pm
Location: Belgium

Re: Planetarium with Near Earth Objects

Post by Fulmar »

Thank you very much for your kind reply. I got the identities of the 10 objects now.
Now I was trying to find out how I can put these identities in the URL of JPL, but I don't get it.
So, how can I use, for instance a name as "2016 AH164" and make "https://ssd.jpl.nasa.gov/sbdb.cgi?sstr=2016%20AH164" of it.
I kept searching under "substitutions" but I didn't find the correct solution.
This what I have for now:

Code: Select all

[NEO]
Measure=WebParser
URL=https://ssd-api.jpl.nasa.gov/cad.api
RegExp=(?siU)"data":.*"(.*)",.*,.*,.*,.*,.*,.*,.*,.*,.*,.*,.*"(.*)",.*,.*,.*,.*,.*,.*,.*,.*,.*,.*,.*"(.*)",.*,.*,.*,.*,.*,.*,.*,.*,.*,.*,.*"(.*)",.*,.*,.*,.*,.*,.*,.*,.*,.*,.*,.*"(.*)",.*,.*,.*,.*,.*,.*,.*,.*,.*,.*,.*"(.*)",.*,.*,.*,.*,.*,.*,.*,.*,.*,.*,.*"(.*)",.*,.*,.*,.*,.*,.*,.*,.*,.*,.*,.*"(.*)",.*,.*,.*,.*,.*,.*,.*,.*,.*,.*,.*"(.*)",.*,.*,.*,.*,.*,.*,.*,.*,.*,.*,.*"(.*)"
UpdateRate=720

[NEO1]
Measure=WebParser
URL=[NEO]
StringIndex=1

[NEO2]
Measure=WebParser
URL=[NEO]
StringIndex=2

[NEO3]
Measure=WebParser
URL=[NEO]
StringIndex=3

[NEO4]
Measure=WebParser
URL=[NEO]
StringIndex=4

[NEO5]
Measure=WebParser
URL=[NEO]
StringIndex=5

[NEO6]
Measure=WebParser
URL=[NEO]
StringIndex=6

[NEO7]
Measure=WebParser
URL=[NEO]
StringIndex=7

[NEO8]
Measure=WebParser
URL=[NEO]
StringIndex=8

[NEO9]
Measure=WebParser
URL=[NEO]
StringIndex=9

[NEO10]
Measure=WebParser
URL=[NEO]
StringIndex=10
User avatar
Yincognito
Posts: 2565
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Planetarium with Near Earth Objects

Post by Yincognito »

Fulmar wrote: August 26th, 2020, 2:02 pm Thank you very much for your kind reply. I got the identities of the 10 objects now.
Now I was trying to find out how I can put these identities in the URL of JPL, but I don't get it.
So, how can I use, for instance a name as "2016 AH164" and make "https://ssd.jpl.nasa.gov/sbdb.cgi?sstr=2016%20AH164" of it.
I kept searching under "substitutions" but I didn't find the correct solution.
This what I have for now:
Try this (it will get the entire HTML, but feel free to adjust the RegExp options and make child measures for the 2nd WebParser, like you did for the 1st):

Code: Select all

[Variables]

[Rainmeter]
Update=1000
DynamicWindowSize=1
AccurateText=1
BackgroundMode=2
SolidColor=47,47,47,255

---Measures---

[NEO]
Measure=WebParser
URL=https://ssd-api.jpl.nasa.gov/cad.api
RegExp=(?siU)"data":.*"(.*)",.*,.*,.*,.*,.*,.*,.*,.*,.*,.*,.*"(.*)",.*,.*,.*,.*,.*,.*,.*,.*,.*,.*,.*"(.*)",.*,.*,.*,.*,.*,.*,.*,.*,.*,.*,.*"(.*)",.*,.*,.*,.*,.*,.*,.*,.*,.*,.*,.*"(.*)",.*,.*,.*,.*,.*,.*,.*,.*,.*,.*,.*"(.*)",.*,.*,.*,.*,.*,.*,.*,.*,.*,.*,.*"(.*)",.*,.*,.*,.*,.*,.*,.*,.*,.*,.*,.*"(.*)",.*,.*,.*,.*,.*,.*,.*,.*,.*,.*,.*"(.*)",.*,.*,.*,.*,.*,.*,.*,.*,.*,.*,.*"(.*)"
UpdateRate=720
FinishAction=[!CommandMeasure BAM "Update"]

[NEO1]
Measure=WebParser
URL=[NEO]
StringIndex=1

[NEO2]
Measure=WebParser
URL=[NEO]
StringIndex=2

[NEO3]
Measure=WebParser
URL=[NEO]
StringIndex=3

[NEO4]
Measure=WebParser
URL=[NEO]
StringIndex=4

[NEO5]
Measure=WebParser
URL=[NEO]
StringIndex=5

[NEO6]
Measure=WebParser
URL=[NEO]
StringIndex=6

[NEO7]
Measure=WebParser
URL=[NEO]
StringIndex=7

[NEO8]
Measure=WebParser
URL=[NEO]
StringIndex=8

[NEO9]
Measure=WebParser
URL=[NEO]
StringIndex=9

[NEO10]
Measure=WebParser
URL=[NEO]
StringIndex=10

[BAM]
Measure=WebParser
URL="https://ssd.jpl.nasa.gov/sbdb.cgi?sstr=[&NEO1]"
RegExp=(?siU)^(.*)$
UpdateRate=720
DynamicVariables=1

---Meters---

[MeterTest]
Meter=STRING
X=0
Y=0
W=300
H=24
FontFace=Consolas
FontColor=255,255,255,255
SolidColor=47,47,47,255
Padding=5,5,5,5
FontSize=16
AntiAlias=1
ClipString=1
MeasureName=BAM
Text="Test = %1"
DynamicVariables=1
Assuming that you created a new WebParser measure (let's just call it BAM), the long and short of it is that you have to add a FinishAction=[!CommandMeasure BAM "Update"] to [NEO] in order to trigger the update of [BAM] after you got the data from parsing the 1st site, and use URL="https://ssd.jpl.nasa.gov/sbdb.cgi?sstr=[&NEO1]" in [BAM] in order to "insert" the value of [NEO1] in the 2nd URL.

More information here, here and here.
Fulmar
Posts: 16
Joined: July 24th, 2012, 4:50 pm
Location: Belgium

Re: Planetarium with Near Earth Objects

Post by Fulmar »

Still confused, because I need to extract for each child measure NEO1 till NEO10 (which I got from https://cneos.jpl.nasa.gov/ca/) other new child measures (to get from https://ssd.jpl.nasa.gov/sbdb.cgi?sstr=).
The first I got already (NEO1 till NEO10).
But for each of them I need another 9 measures (so in total 90 measures).
The FinishAction=[!CommandMeasure BAM "Update"] that you used under [NEO] only triggers parsing data for the first child measure [NEO1], right?
I guess my understanding of this matter is very little.
User avatar
Yincognito
Posts: 2565
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Planetarium with Near Earth Objects

Post by Yincognito »

Fulmar wrote: August 26th, 2020, 9:50 pm Still confused, because I need to extract for each child measure NEO1 till NEO10 (which I got from https://cneos.jpl.nasa.gov/ca/) other new child measures (to get from https://ssd.jpl.nasa.gov/sbdb.cgi?sstr=).
The first I got already (NEO1 till NEO10).
But for each of them I need another 9 measures (so in total 90 measures).
The FinishAction=[!CommandMeasure BAM "Update"] that you used under [NEO] only triggers parsing data for the first child measure [NEO1], right?
I guess my understanding of this matter is very little.
Yes, you're right, you'd need to command update one [BAMX] parent measure for each [NEOX] child one, where X ranges from 1 to 10 in your case. And of course, add the appropriate child measures for each [BAMX] parent measure too. I know it's a bit overkill (hopefully you won't be blocked or banned from NASA because of too many requests and polling the site, so be careful with that), but that's the big drawback of not being able to find a single URL address where you could get all the data you were interested in for those 10 objects.

In other words, you'd need a single address to get you the data from the 'JPL Small-Body Database Browser', similar to how you get the data from 'NEO Earth Close Approaches' through queries like the ones mentioned here (i.e. link posted by mordasius). I might have found something useful though, but it's up to you to refine the parameters and see if you can get the table you like and then the single URL address for that table (which you can then use with WebParser). For example, try navigating at https://ssd.jpl.nasa.gov/sbdb_query.cgi and set whatever parameters you need (you know better than me in that regard, so it's your job), press Generate Table at the bottom of the page, and then find the URL address for the generated table either by clicking First/Previous/Next/Last page and see the URL in the browser's address bar, or by viewing the page source of that page. It would look something like:

Code: Select all

https://ssd.jpl.nasa.gov/sbdb_query.cgi?obj_group=all;obj_kind=all;obj_numbered=all;OBJ_field=0;ORB_field=0;c1_group=OBJ;c1_item=Ap;c1_op=%3C;c1_value=5;table_format=HTML;max_rows=10;format_option=comp;query=Generate%20Table;c_fields=AgAcBhBgBjBkBlBiBnBsCkCqCnCoCpAi;c_sort=;.cgifields=format_option;.cgifields=obj_kind;.cgifields=obj_group;.cgifields=obj_numbered;.cgifields=ast_orbit_class;.cgifields=table_format;.cgifields=com_orbit_class&page=2
By the way, %20 means space, so you can replace those parts with spaces if you like it better.

P.S. You might want to add the Near-Earth Object (NEO) flag (Y/N) before generating the table, so that you get a table as similar as possible with the one from https://cneos.jpl.nasa.gov/ca/ ...

P.S.S. Obviously, if you manage to generate the desired table, you'd only need the URL address for that table (that you can get as explained above) and you won't need to have any other WebParser parent measure, only the appropriate children.
Fulmar
Posts: 16
Joined: July 24th, 2012, 4:50 pm
Location: Belgium

Re: Planetarium with Near Earth Objects

Post by Fulmar »

Yes, the risk to be blocked or banned is most probably. Because I am sending out different queries at the same time NASA won't accept it.
From the moment Rainmeter is sending out more than 1 query at the same time, there is no response anymore :( .
And that's exactly what happens when you start or refresh Rainmeter.
Thank you for all the suggestions you made already :) .
User avatar
Yincognito
Posts: 2565
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Planetarium with Near Earth Objects

Post by Yincognito »

Fulmar wrote: August 28th, 2020, 3:28 pm Yes, the risk to be blocked or banned is most probably. Because I am sending out different queries at the same time NASA won't accept it.
From the moment Rainmeter is sending out more than 1 query at the same time, there is no response anymore :( .
And that's exactly what happens when you start or refresh Rainmeter.
Thank you for all the suggestions you made already :) .
Did you try using the query I talked about? If you managed to get what you wanted using that query, that would solve the issue as you'd only make a single request to NASA. Setting the UpdateRate of the WebParser to greater values (like 3600 for an hour, 86400 for a day) would also help.
User avatar
brax64
Posts: 148
Joined: July 8th, 2018, 8:05 pm

Re: Planetarium with Near Earth Objects

Post by brax64 »

Not sure if it can be of any help, it maybe useful spend some time investigating the european space agency website to retrieve those data?
did find this that might be useful
http://neo.ssa.esa.int/automated-data-access

this is the page that shows the data
http://neo.ssa.esa.int/close-approaches

If I'm wrong, please disregard...