{"components":{"parameters":{"Day":{"description":"Day in DD format","in":"query","name":"day","required":true,"schema":{"example":23,"type":"integer"}},"Hour":{"description":"UTC Hour of the day in 24 hour format","in":"query","name":"hour","required":true,"schema":{"example":15,"type":"integer"}},"Latitude":{"description":"Geographic latitude (deg).","in":"query","name":"latitude","required":true,"schema":{"example":-45,"maximum":90,"minimum":-90,"type":"number"}},"Longitude":{"description":"Geographic longitude (deg).","in":"query","name":"longitude","required":true,"schema":{"example":45,"maximum":180,"minimum":-180,"type":"number"}},"Minute":{"description":"Minute of the given hour","in":"query","name":"minute","required":true,"schema":{"example":10,"type":"integer"}},"Month":{"description":"Month in MM format","in":"query","name":"month","required":true,"schema":{"example":5,"type":"integer"}},"TidalAmplitude":{"description":"Tidal amplitude (m).","in":"query","name":"tidal_amplitude","required":false,"schema":{"default":1.175,"example":45,"type":"number"}},"UTCOffset":{"description":"UTC offset (hrs).","in":"query","name":"utc_offset","required":false,"schema":{"default":0,"example":10,"maximum":14,"minimum":-12,"type":"number"}},"Year":{"description":"Year in YYYY format","in":"query","name":"year","required":true,"schema":{"example":2020,"type":"integer"}}},"schemas":{"Anomaly":{"properties":{"eta":{"description":"Eta (arcsec) - easterly component of deflection of vertical.","properties":{"units":{"type":"string"},"value":{"type":"number"}},"type":"object"},"gravity_anomaly":{"description":"Gravity anomaly (mGal)\n","properties":{"units":{"type":"string"},"value":{"type":"number"}},"type":"object"},"xi":{"description":"Xi (arcsec) - northerly component of deflection of vertical.\n","properties":{"units":{"type":"string"},"value":{"type":"number"}},"type":"object"}},"type":"object"},"Height":{"properties":{"height":{"description":"Geoid height (m)\n","properties":{"units":{"type":"string"},"value":{"type":"number"}},"type":"object"}},"type":"object"},"TidalEffect":{"properties":{"tidal_effect":{"description":"Tidal Effect (mGal)\n","properties":{"units":{"type":"string"},"value":{"type":"number"}},"type":"object"}},"type":"object"}}},"info":{"description":"The gravitational field of the earth is non-uniform. We provide web API access to  various gravitational models used widely in:  <ul> <li>Geodesy and Surveying: Accurate determination of geoid heights, crucial for precise GPS positioning.</li> <li>Satellite Orbits and Navigation: Enhanced accuracy in orbit prediction and positioning of satellites.</li> <li>Climate and Oceanography: Improved understanding of ocean circulation patterns and sea level variations.</li> <li>Resource Exploration: Support for mineral and hydrocarbon exploration through accurate gravity field information.</li> <li>Global Positioning and Mapping: Improved accuracy of global positioning systems (GPS) for navigation and mapping applications.</li> <li>Academic and Research Applications: Support for academic research in fields like geophysics, geodesy, and atmospheric sciences.</li> </ul><br><br>\nExplore available endpoints via links on the left hand side. \nAPI requests must contain a key \"API-Key\" in the header (see code samples). <br><br> \nVisit our <Button to='#' transparent><a href='https://developer.amentum.io'>Developer Portal</a></Button> to obtain a key with a 14 day free trial.<br><br> \nAmentum Pty Ltd is not responsible nor liable for any loss or damage of any sort incurred as a result of using the API. <br><br>\nCopyright <a href='https://amentum.space'>Amentum Pty Ltd</a> 2024.<br><br>\n","title":"Gravity API","version":"1.2.0","x-logo":{"altText":"Amentum Aerospace","backgroundColor":"#FFFFFF","url":"https://amentum.io/static/img/AMENTUMSPACE_GREY_SMALL.jpg"}},"openapi":"3.0.0","paths":{"/egm2008/geoid_height":{"get":{"description":"for a given latitude / longitude.  The <a href='https://en.wikipedia.org/wiki/Geoid'>geoid</a> is the shape the ocean surface would take if only gravity and the rotation of the Earth were  considered. The geoid is the surface that defines zero elevation. The geoid height is the difference between an ideal reference ellipsoid and the geoid.<br><br> \n","operationId":"app.api_egm2008.endpoints.EGM2008.calculate_height","parameters":[{"$ref":"#/components/parameters/Latitude"},{"$ref":"#/components/parameters/Longitude"}],"responses":{"200":{"content":{"application/json":{"example":{"height":{"units":"m","value":45.88107058892659}},"schema":{"$ref":"#/components/schemas/Height"}}},"description":"Successful geoid height calculation"}},"summary":"Calculate the geoid height\n","tags":["egm2008"],"x-codeSamples":[{"lang":"Shell","source":"curl -X GET \"https://gravity.amentum.io/egm2008/geoid_height?latitude=-45&longitude=45\" -H \"API-Key: <your_key>\" -H  \"accept: application/json\"\n"},{"lang":"Python","source":"import requests\n\nheaders = {\"API-Key\" : \"<add_your_key>\"}\n\nparams = {\n  \"latitude\" : \"-45\",\n  \"longitude\" : \"45\"\n}\n\n# Make the API call\ntry:\n  response = requests.get(\n    \"https://gravity.amentum.io/egm2008/geoid_height\",\n    params=params, headers=headers)\n  response_json = response.json()\n  response.raise_for_status()\nexcept requests.exceptions.HTTPError as e:\n  print(response_json['error'])\nelse:\n  # Extract the height\n  height = response_json['height']['value']\n  h_unit = response_json['height']['units']\n  print(\"Height: \", height, h_unit)\n"},{"lang":"R","source":"library(httr)\n\nurl <- \"https://gravity.amentum.io/egm2008/geoid_height\"\nresponse <- GET(url, add_headers(`API-Key` = \"<your_key>\", accept = \"application/json\"), \n                query = list(latitude = \"-45\", longitude = \"45\"))\n\ncontent <- content(response)\ncat(sprintf(\"Height: %s %s\\n\", content$height$value, content$height$units))\n"},{"lang":"Julia","source":"using HTTP\nusing JSON3\n\nurl = \"https://gravity.amentum.io/egm2008/geoid_height\"\nheaders = [\"API-Key\" => \"<your_key>\", \"Accept\" => \"application/json\"]\nparams = Dict(\"latitude\" => \"-45\", \"longitude\" => \"45\")\n\nresponse = HTTP.get(url, headers=headers, query=params)\njson = JSON3.read(String(response.body))\nprintln(\"Height: \", json.height.value, \" \", json.height.units)\n"},{"lang":"Go","source":"package main\n\nimport (\n  \"fmt\"\n  \"net/http\"\n  \"io/ioutil\"\n  \"net/url\"\n)\n\nfunc main() {\n  baseUrl := \"https://gravity.amentum.io/egm2008/geoid_height\"\n  params := url.Values{}\n  params.Add(\"latitude\", \"-45\")\n  params.Add(\"longitude\", \"45\")\n  requestUrl := fmt.Sprintf(\"%s?%s\", baseUrl, params.Encode())\n\n  req, _ := http.NewRequest(\"GET\", requestUrl, nil)\n  req.Header.Add(\"API-Key\", \"<your_key>\")\n  req.Header.Add(\"accept\", \"application/json\")\n\n  client := &http.Client{}\n  resp, _ := client.Do(req)\n  defer resp.Body.Close()\n  body, _ := ioutil.ReadAll(resp.Body)\n\n  fmt.Println(string(body))\n}\n"},{"lang":"JavaScript","source":"fetch(\"https://gravity.amentum.io/egm2008/geoid_height?latitude=-45&longitude=45\", {\n  method: \"GET\",\n  headers: {\n    \"API-Key\": \"<your_key>\",\n    \"Accept\": \"application/json\"\n  }\n})\n.then(response => response.json())\n.then(data => console.log(\"Height:\", data.height.value, data.height.units))\n.catch(error => console.error(\"Error:\", error));\n"},{"lang":"Java","source":"import java.io.*;\nimport java.net.*;\n\npublic class Main {\n  public static void main(String[] args) throws IOException {\n    URL url = new URL(\"https://gravity.amentum.io/egm2008/geoid_height?latitude=-45&longitude=45\");\n    HttpURLConnection con = (HttpURLConnection) url.openConnection();\n    con.setRequestMethod(\"GET\");\n    con.setRequestProperty(\"API-Key\", \"<your_key>\");\n    con.setRequestProperty(\"Accept\", \"application/json\");\n\n    BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()));\n    String inputLine;\n    StringBuffer content = new StringBuffer();\n    while ((inputLine = in.readLine()) != null) {\n      content.append(inputLine);\n    }\n    in.close();\n    System.out.println(content.toString());\n  }\n}\n"},{"lang":"C++","source":"#include <iostream>\n#include <curl/curl.h>\n\nstatic size_t WriteCallback(void *contents, size_t size, size_t nmemb, void *userp) {\n    ((std::string*)userp)->append((char*)contents, size * nmemb);\n    return size * nmemb;\n}\n\nint main() {\n    CURL *curl;\n    CURLcode res;\n    std::string readBuffer;\n\n    curl = curl_easy_init();\n    if(curl) {\n        curl_easy_setopt(curl, CURLOPT_URL, \"https://gravity.amentum.io/egm2008/geoid_height?latitude=-45&longitude=45\");\n        curl_easy_setopt(curl, CURLOPT_HTTPHEADER, \"<your_key>\");\n        curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, WriteCallback);\n        curl_easy_setopt(curl, CURLOPT_WRITEDATA, &readBuffer);\n        res = curl_easy_perform(curl);\n        curl_easy_cleanup(curl);\n\n        std::cout << readBuffer << std::endl;\n    }\n    return 0;\n}\n"},{"lang":"Swift","source":"import Foundation\n\nif let url = URL(string: \"https://gravity.amentum.io/egm2008/geoid_height?latitude=-45&longitude=45\") {\n    var request = URLRequest(url: url)\n    request.addValue(\"<your_key>\", forHTTPHeaderField: \"API-Key\")\n    request.addValue(\"application/json\", forHTTPHeaderField: \"accept\")\n\n    URLSession.shared.dataTask(with: request) { data, response, error in\n        guard let data = data, error == nil else { return }\n        if let heightResponse = try? JSONDecoder().decode(HeightResponse.self, from: data) {\n            print(\"Height:\", heightResponse.height.value, heightResponse.height.units)\n        }\n    }.resume()\n}\n\nstruct HeightResponse: Codable {\n    struct Height: Codable {\n        let value: Double\n        let units: String\n    }\n    let height: Height\n}\n"}]}},"/egm2008/gravity_anomaly":{"get":{"description":"for a given latitude / longitude. The gravity anomaly is the difference between the acceleration due to gravity on the Earth's surface and the value calculated assuming the reference ellipsoid.<br><br>\n","operationId":"app.api_egm2008.endpoints.EGM2008.calculate_anomaly","parameters":[{"$ref":"#/components/parameters/Latitude"},{"$ref":"#/components/parameters/Longitude"}],"responses":{"200":{"content":{"application/json":{"example":{"eta":{"units":"arcsec","value":-0.9413662219916251},"gravity_anomaly":{"units":"mGal","value":27.954737031742376},"xi":{"units":"arcsec","value":1.371151956763653}},"schema":{"$ref":"#/components/schemas/Anomaly"}}},"description":"Successful anomaly calculation"}},"summary":"Calculate gravity anomaly values\n","tags":["egm2008"],"x-codeSamples":[{"lang":"Shell","source":"curl -X GET \"https://gravity.amentum.io/egm2008/gravity_anomaly?latitude=-45&longitude=45\"  -H \"accept: application/json\" -H \"API-Key: <your_key>\"\n"},{"lang":"Python","source":"import requests\n\nheaders = {\"API-Key\": \"<add_your_key>\"}\n\nparams = {\n  \"latitude\": \"-45\",\n  \"longitude\": \"45\"\n}\n\ntry:\n  response = requests.get(\"https://gravity.amentum.io/egm2008/gravity_anomaly\", params=params, headers=headers)\n  response.raise_for_status()\n  response_json = response.json()\n  print(\"Eta:\", response_json['eta']['value'], response_json['eta']['units'])\n  print(\"Gravity Anomaly:\", response_json['gravity_anomaly']['value'], response_json['gravity_anomaly']['units'])\n  print(\"Xi:\", response_json['xi']['value'], response_json['xi']['units'])\nexcept requests.RequestException as e:\n  print(e)\n"},{"lang":"R","source":"library(httr)\n\nurl <- \"https://gravity.amentum.io/egm2008/gravity_anomaly\"\nresponse <- GET(url, add_headers(`API-Key` = \"<your_key>\"), query = list(latitude = \"-45\", longitude = \"45\"))\ncontent <- content(response, \"parsed\")\nprint(content$gravity_anomaly$value)\n"},{"lang":"Julia","source":"using HTTP\nusing JSON\n\nurl = \"https://gravity.amentum.io/egm2008/gravity_anomaly\"\nheaders = Dict(\"API-Key\" => \"<your_key>\")\nparams = Dict(\"latitude\" => \"-45\", \"longitude\" => \"45\")\n\nresponse = HTTP.get(url, query=params, headers=headers)\nprintln(String(response.body))\n"},{"lang":"Go","source":"package main\n\nimport (\n  \"fmt\"\n  \"net/http\"\n  \"io/ioutil\"\n)\n\nfunc main() {\n  client := &http.Client{}\n  req, _ := http.NewRequest(\"GET\", \"https://gravity.amentum.io/egm2008/gravity_anomaly?latitude=-45&longitude=45\", nil)\n  req.Header.Add(\"API-Key\", \"<your_key>\")\n  resp, _ := client.Do(req)\n  defer resp.Body.Close()\n  body, _ := ioutil.ReadAll(resp.Body)\n  fmt.Println(string(body))\n}\n"},{"lang":"JavaScript","source":"const axios = require('axios');\n\naxios.get('https://gravity.amentum.io/egm2008/gravity_anomaly', {\n  params: {\n    latitude: '-45',\n    longitude: '45'\n  },\n  headers: {\n    'API-Key': '<your_key>',\n    'accept': 'application/json'\n  }\n})\n.then((response) => {\n  console.log(response.data);\n})\n.catch((error) => {\n  console.log(error);\n});\n"},{"lang":"Java","source":"import java.io.*;\nimport java.net.*;\n\npublic class Main {\n  public static void main(String[] args) throws IOException {\n    URL url = new URL(\"https://gravity.amentum.io/egm2008/gravity_anomaly?latitude=-45&longitude=45\");\n    HttpURLConnection con = (HttpURLConnection) url.openConnection();\n    con.setRequestMethod(\"GET\");\n    con.setRequestProperty(\"API-Key\", \"<your_key>\");\n    BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()));\n    String inputLine;\n    StringBuffer content = new StringBuffer();\n    while ((inputLine = in.readLine()) != null) {\n      content.append(inputLine);\n    }\n    in.close();\n    System.out.println(content.toString());\n  }\n}\n"},{"lang":"C++","source":"#include <iostream>\n#include <curl/curl.h>\n\nstatic size_t WriteCallback(void *contents, size_t size, size_t nmemb, void *userp) {\n  ((std::string*)userp)->append((char*)contents, size * nmemb);\n  return size * nmemb;\n}\n\nint main() {\n  CURL *curl;\n  CURLcode res;\n  std::string readBuffer;\n  curl = curl_easy_init();\n  if(curl) {\n    curl_easy_setopt(curl, CURLOPT_URL, \"https://gravity.amentum.io/egm2008/gravity_anomaly?latitude=-45&longitude=45\");\n    curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, WriteCallback);\n    curl_easy_setopt(curl, CURLOPT_WRITEDATA, &readBuffer);\n    curl_easy_setopt(curl, CURLOPT_HTTPHEADER, \"<your_key>\");\n    res = curl_easy_perform(curl);\n    curl_easy_cleanup(curl);\n\n    std::cout << readBuffer << std::endl;\n  }\n}\n"},{"lang":"Swift","source":"import Foundation\n\nif let url = URL(string: \"https://gravity.amentum.io/egm2008/gravity_anomaly?latitude=-45&longitude=45\") {\n  var request = URLRequest(url: url)\n  request.addValue(\"<your_key>\", forHTTPHeaderField: \"API-Key\")\n  request.addValue(\"application/json\", forHTTPHeaderField: \"accept\")\n\n  let task = URLSession.shared.dataTask(with: request) {(data, response, error) in\n    guard let data = data else { return }\n    print(String(data: data, encoding: .utf8)!)\n  }\n\n  task.resume()\n}\n"}]}},"/longman/tidal_effect":{"get":{"description":"for a given latitude, longitude, and date. The tidal gravity effect  refers to the influence of gravitational forces,  specifically from the Moon and the Sun. This endpoint implements a  tidal effect formula  from Longman IM (1959) \"Formulas for computing the tidal accelerations due to the Moon and the Sun.\" J Geophys Res 64(12):2351\u20132355. https://doi.org/10.1029/JZ064i012p02351 <br><br>\nThe backend code was originally developed for  <a href='https://gravimeterra.com/'>Gravimeterra</a>  (contact gravimeterra@gmail.com).  The default value of amplitude (1.175) was chosen to agree with GravSur,  Amarante, Rog\u00e9rio Rodrigues.  \"Sistematiza\u00e7\u00e3o do processamento de dados gravim\u00e9tricos aplicados \u00e0  determina\u00e7\u00e3o do modelo geoidal\". Technical report, 2012. PhD thesis. \n","operationId":"app.api_longman.endpoints.LongMan.calculate_tidal_effect","parameters":[{"$ref":"#/components/parameters/Latitude"},{"$ref":"#/components/parameters/Longitude"},{"$ref":"#/components/parameters/Year"},{"$ref":"#/components/parameters/Month"},{"$ref":"#/components/parameters/Day"},{"$ref":"#/components/parameters/Hour"},{"$ref":"#/components/parameters/Minute"},{"$ref":"#/components/parameters/TidalAmplitude"},{"$ref":"#/components/parameters/UTCOffset"}],"responses":{"200":{"content":{"application/json":{"example":{"tidal_effect":{"units":"mGal","value":-0.058955900020091906}},"schema":{"$ref":"#/components/schemas/TidalEffect"}}},"description":"Successful tidal effect calculation"}},"summary":"Calculate tidal effect using the Longman tide formula \n","tags":["longman"],"x-codeSamples":[{"lang":"Shell","source":"curl -X GET \"https://gravity.amentum.io/longman/tidal_effect?latitude=-45&longitude=45&year=2024&month=4&day=29&hour=7&minute=30\"  -H \"accept: application/json\" -H \"API-Key: <your_key>\"\n"},{"lang":"Python","source":"import requests\nresponse = requests.get(\n    \"https://gravity.amentum.io/longman/tidal_effect\",\n    params={\n        \"latitude\": -45,\n        \"longitude\": 45,\n        \"year\": 2024,\n        \"month\": 4,\n        \"day\": 29,\n        \"hour\": 7,\n        \"minute\": 30\n    },\n    headers={\"accept\": \"application/json\", \"API-Key\": \"<your_key>\"}\n)\nprint(response.json())\n"},{"lang":"R","source":"library(httr)\nresponse <- GET(\"https://gravity.amentum.io/longman/tidal_effect\", \n                query=list(latitude=-45, longitude=45, year=2024, month=4, day=29, hour=7, minute=30),\n                add_headers(\"accept\" = \"application/json\", \"API-Key\" = \"<your_key>\"))\nprint(content(response, \"parsed\"))\n"},{"lang":"Julia","source":"using HTTP\nresponse = HTTP.get(\"https://gravity.amentum.io/longman/tidal_effect\",\n                    query=Dict(\"latitude\" => -45, \"longitude\" => 45, \"year\" => 2024, \"month\" => 4, \"day\" => 29, \"hour\" => 7, \"minute\" => 30),\n                    headers=Dict(\"accept\" => \"application/json\", \"API-Key\" => \"<your_key>\"))\nprintln(String(response.body))\n"},{"lang":"Go","source":"package main\nimport (\n    \"fmt\"\n    \"net/http\"\n    \"io/ioutil\"\n)\nfunc main() {\n    client := &http.Client{}\n    req, _ := http.NewRequest(\"GET\", \"https://gravity.amentum.io/longman/tidal_effect?latitude=-45&longitude=45&year=2024&month=4&day=29&hour=7&minute=30\", nil)\n    req.Header.Add(\"accept\", \"application/json\")\n    req.Header.Add(\"API-Key\", \"<your_key>\")\n    resp, _ := client.Do(req)\n    defer resp.Body.Close()\n    body, _ := ioutil.ReadAll(resp.Body)\n    fmt.Println(string(body))\n}\n"},{"lang":"JavaScript","source":"fetch(\"https://gravity.amentum.io/longman/tidal_effect?latitude=-45&longitude=45&year=2024&month=4&day=29&hour=7&minute=30\", {\n    headers: {\n        \"accept\": \"application/json\",\n        \"API-Key\": \"<your_key>\"\n    }\n})\n.then(response => response.json())\n.then(data => console.log(data))\n"},{"lang":"Java","source":"HttpClient client = HttpClient.newHttpClient();\nHttpRequest request = HttpRequest.newBuilder()\n    .uri(URI.create(\"https://gravity.amentum.io/longman/tidal_effect?latitude=-45&longitude=45&year=2024&month=4&day=29&hour=7&minute=30\"))\n    .header(\"accept\", \"application/json\")\n    .header(\"API-Key\", \"<your_key>\")\n    .build();\nHttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());\nSystem.out.println(response.body());\n"},{"lang":"C++","source":"#include <iostream>\n#include <curl/curl.h>\nint main() {\n    CURL* curl = curl_easy_init();\n    if(curl) {\n        curl_easy_setopt(curl, CURLOPT_URL, \"https://gravity.amentum.io/longman/tidal_effect?latitude=-45&longitude=45&year=2024&month=4&day=29&hour=7&minute=30\");\n        curl_easy_setopt(curl, CURLOPT_HTTPHEADER, \"accept: application/json\", \"API-Key: <your_key>\");\n        CURLcode res = curl_easy_perform(curl);\n        if(res == CURLE_OK) {\n            char *response;\n            curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &response);\n            std::cout << response << std::endl;\n        }\n        curl_easy_cleanup(curl);\n    }\n    return 0;\n}\n"},{"lang":"Swift","source":"import Foundation\nvar urlComponents = URLComponents(string: \"https://gravity.amentum.io/longman/tidal_effect\")!\nurlComponents.queryItems = [\n    URLQueryItem(name: \"latitude\", value: \"-45\"),\n    URLQueryItem(name: \"longitude\", value: \"45\"),\n    URLQueryItem(name: \"year\", value: \"2024\"),\n    URLQueryItem(name: \"month\", value: \"4\"),\n    URLQueryItem(name: \"day\", value: \"29\"),\n    URLQueryItem(name: \"hour\", value: \"7\"),\n    URLQueryItem(name: \"minute\", value: \"30\")\n]\nvar request = URLRequest(url: urlComponents.url!)\nrequest.addValue(\"application/json\", forHTTPHeaderField: \"accept\")\nrequest.addValue(\"<your_key>\", forHTTPHeaderField: \"API-Key\")\nlet task = URLSession.shared.dataTask(with: request) { data, response, error in\n    if let data = data {\n        print(String(decoding: data, as: UTF8.self))\n    }\n}\ntask.resume()\n"}]}}},"servers":[{"url":""}],"tags":[{"description":"Calculate geoid height and gravity anomaly values using the EGM2008 model.  The official Earth Gravitational Model <a href='https://en.wikipedia.org/wiki/Earth_Gravitational_Model#EGM2008/'>EGM2008</a> was developed and  released to the public by the National Geospatial-Intelligence Agency (NGA).<br><br>\n","name":"egm2008","x-displayName":"EGM2008 API"},{"description":"The Longman formula calculates the gravitational effects of tidal forces from the Moon and Sun. This is a crucial factor for compensating gravity measurements for temporal variations as well as\n understanding small deformations or movements in the Earth's solid surface due to gravitational forces.\n<br><br>\n","name":"longman","x-displayName":"Longman API"}]}
