這個腳本是由Craige發布的略有不同的腳本:
https://community.jmp.com/t5/Uncharted/Space-Station-Video/ba-p/21322
此腳本使用內置的HTTP Request JSL對象和Parse JSON方法,使用此處發布的RestAPI可視化國際空間站的當前位置:
http://open-notify.org/Open-Notify-API/ISS-Location-Now
Rest端點是: http://api.open-notify.org/iss-now.json
它的JSON結果如下:
{
"message": "success",
"timestamp": UNIX_TIME_STAMP,
"iss_position": {
"latitude": CURRENT_LATITUDE,
"longitude": CURRENT_LONGITUDE
}
}
我提取相關的JSON片段以使用Parse JSON填充JMP數據表:
json_jsl = ParseJSON(json);
date = json_jsl["timestamp"];
date = AsDate(Date MDY(1, 1, 1970) + date); //turn into a JMP Date
dt:timestamp[row] = date;
dt:longitude[row] = Num(json_jsl["iss_position"]["longitude"]);
dt:latitude[row] = Num(json_jsl["iss_position"]["latitude"]);
我還沒完成,因為我真的很想知道緯度和經度線之間的距離,所以我使用了這個算法(轉換為JSL) http://www.ridgesolutions.ie/index.php/2013/11/14/algorithm-to-calculate-speed-from-two-gps-latitude-and-longitude-points-and-time-difference
我以每小時英里的速度計算了速度(因為這就是我的想法)。
我設置JSL調度程序每隔5秒查詢一次Rest端點(這就是網站推薦的內容)並創建一個圖形來跟踪空間站的位置。
最後,我決定玩得開心,並在圖表上使用圖像作為標記。
這是一個有趣的實驗。
請享用
布萊恩