OnWorks favicon

Gravity - Online in the Cloud

Run Gravity in OnWorks free hosting provider over Ubuntu Online, Fedora Online, Windows online emulator or MAC OS online emulator

This is the command Gravity that can be run in the OnWorks free hosting provider using one of our multiple free online workstations such as Ubuntu Online, Fedora Online, Windows online emulator or MAC OS online emulator



Gravity -- compute the earth's gravity field


Gravity [ -n name ] [ -d dir ] [ -G | -D | -A | -H ] [ -c lat h ] [ -w ] [ -p prec ] [ -v
] [ --comment-delimiter commentdelim ] [ --version | -h | --help ] [ --input-file infile |
--input-string instring ] [ --line-separator linesep ] [ --output-file outfile ]


Gravity reads in positions on standard input and prints out the gravitational field on
standard output.

The input line is of the form lat lon h. lat and lon are the latitude and longitude
expressed as decimal degrees or degrees, minutes, and seconds; for details on the allowed
formats for latitude and longitude, see the "GEOGRAPHIC COORDINATES" section of
GeoConvert(1). h is the height above the ellipsoid in meters; this quantity is optional
and defaults to 0. Alternatively, the gravity field can be computed at various points on
a circle of latitude (constant lat and h) via the -c option; in this case only the
longitude should be given on the input lines. The quantities printed out are governed by
the -G (default), -D, -A, or -H options.

All the supported gravity models, except for grs80, use WGS84 as the reference ellipsoid a
= 6378137 m, f = 1/298.257223563, omega = 7292115e-11 rad/s, and GM = 3986004.418e8


-n use gravity field model name instead of the default "egm96". See "MODELS".

-d read gravity models from dir instead of the default. See "MODELS".

-G compute the acceleration due to gravity (including the centrifugal acceleration due
the the earth's rotation) g. The output consists of gx gy gz (all in m/s^2), where
the x, y, and z components are in easterly, northerly, and up directions,
respectively. Usually gz is negative.

-D compute the gravity disturbance delta = g - gamma, where gamma is the "normal" gravity
due to the reference ellipsoid . The output consists of deltax deltay deltaz (all in
mGal, 1 mGal = 10^-5 m/s^2), where the x, y, and z components are in easterly,
northerly, and up directions, respectively. Note that deltax = gx, because gammax =

-A computes the gravitational anomaly. The output consists of 3 items Dg01 xi eta, where
Dg01 is in mGal (1 mGal = 10^-5 m/s^2) and xi and eta are in arcseconds. The
gravitational anomaly compares the gravitational field g at P with the normal gravity
gamma at Q where the P is vertically above Q and the gravitational potential at P
equals the normal potential at Q. Dg01 gives the difference in the magnitudes of
these two vectors and xi and eta give the difference in their directions (as northerly
and easterly components). The calculation uses a spherical approximation to match the
results of the NGA's synthesis programs.

-H compute the height of the geoid above the reference ellipsoid (in meters). In this
case, h should be zero. The results accurately match the results of the NGA's
synthesis programs. GeoidEval(1) can compute geoid heights much more quickly by
interpolating on a grid of precomputed results; however the results from GeoidEval(1)
are only accurate to a few millimeters.

-c evaluate the field on a circle of latitude given by lat and h instead of reading these
quantities from the input lines. In this case, Gravity can calculate the field
considerably more quickly. If geoid heights are being computed (the -H option), then
h must be zero.

-w on input and output, longitude precedes latitude (except that on input this can be
overridden by a hemisphere designator, N, S, E, W).

-p set the output precision to prec. By default prec is 5 for acceleration due to
gravity, 3 for the gravity disturbance and anomaly, and 4 for the geoid height.

-v print information about the gravity model on standard error before processing the

set the comment delimiter to commentdelim (e.g., "#" or "//"). If set, the input
lines will be scanned for this delimiter and, if found, the delimiter and the rest of
the line will be removed prior to processing and subsequently appended to the output
line (separated by a space).

print version and exit.

-h print usage, the default gravity path and name, and exit.

print full documentation and exit.

read input from the file infile instead of from standard input; a file name of "-"
stands for standard input.

read input from the string instring instead of from standard input. All occurrences
of the line separator character (default is a semicolon) in instring are converted to
newlines before the reading begins.

set the line separator character to linesep. By default this is a semicolon.

write output to the file outfile instead of to standard output; a file name of "-"
stands for standard output.


Gravity computes the gravity field using one of the following models

egm84, earth gravity model 1984. See
egm96, earth gravity model 1996. See
egm2008, earth gravity model 2008. See
wgs84, world geodetic system 1984. This returns the normal
gravity for the WGS84 ellipsoid.
grs80, geodetic reference system 1980. This returns the normal
gravity for the GRS80 ellipsoid.

These models approximate the gravitation field above the surface of the earth. By
default, the "egm96" gravity model is used. This may changed by setting the environment
variable "GEOGRAPHICLIB_GRAVITY_NAME" or with the -n option.

The gravity models will be loaded from a directory specified at compile time. This may
changed by setting the environment variables "GEOGRAPHICLIB_GRAVITY_PATH" or
"GEOGRAPHICLIB_DATA", or with the -d option. The -h option prints the default gravity
path and name. Use the -v option to ascertain the full path name of the data file.

Instructions for downloading and installing gravity models are available at


Override the compile-time default gravity name of "egm96". The -h option reports the
value of GEOGRAPHICLIB_GRAVITY_NAME, if defined, otherwise it reports the compile-time
value. If the -n name option is used, then name takes precedence.

Override the compile-time default gravity path. This is typically
"/usr/local/share/GeographicLib/gravity" on Unix-like systems and
"C:/ProgramData/GeographicLib/gravity" on Windows systems. The -h option reports the
value of GEOGRAPHICLIB_GRAVITY_PATH, if defined, otherwise it reports the compile-time
value. If the -d dir option is used, then dir takes precedence.

Another way of overriding the compile-time default gravity path. If it is set (and if


An illegal line of input will print an error message to standard output beginning with
"ERROR:" and causes Gravity to return an exit code of 1. However, an error does not cause
Gravity to terminate; following lines will be converted.


The gravity field from EGM2008 at the top of Mount Everest

echo 27:59:17N 86:55:32E 8820 | Gravity -n egm2008
=> -0.00001 0.00103 -9.76782

Use Gravity online using onworks.net services

Free Servers & Workstations

Download Windows & Linux apps

  • 1
    A set of Python extension modules that
    wrap the cross-platform GUI classes from
    wxWidgets.. Audience: Developers. User
    interface: X Window System (X11), Win32 ...
    Download wxPython
  • 2
    This is the Total War pack file manager
    project, starting from version 1.7. A
    short introduction into Warscape
    modding: ...
    Download packfilemanager
  • 3
    A network traffic tool for measuring
    TCP and UDP performance with metrics
    around both throughput and latency. The
    goals include maintaining an active
    iperf cod...
    Download IPerf2
  • 4
    fre:ac - free audio converter
    fre:ac - free audio converter
    fre:ac is a free audio converter and CD
    ripper for various formats and encoders.
    It features MP3, MP4/M4A, WMA, Ogg
    Vorbis, FLAC, AAC, and Bonk format
    support, ...
    Download fre:ac - free audio converter
  • 5
    Write your chatbot logic once and
    connect it to one of the available
    messaging services, including Amazon
    Alexa, Facebook Messenger, Slack,
    Telegram or even yo...
    Download BotMan
  • 6
    gerbv  a Gerber (RS-274X) viewer
    gerbv a Gerber (RS-274X) viewer
    Gerbv is an open source Gerber file
    (RS-274X only) viewer. Gerbv lets you
    load several files on top of each other,
    do measurements on the displayed image,
    etc. ...
    Download gerbv a Gerber (RS-274X) viewer
  • 7
    I/O performance Analysis Tool.
    Audience: Developers, Information
    Technology, Science/Research, System
    Administrators. User interface: Win32
    (MS Windows). Progr...
    Download Iometer
  • More »

Linux commands