Sponsored Content
Top Forums Shell Programming and Scripting Geographical distance between long and lat in bash Post 302914058 by Perderabo on Thursday 21st of August 2014 02:50:22 PM
Old 08-21-2014
The formula to compute the distance between a pair of latitude-longitude coordinates is actually rather complex. A simplified version is on this page.

**edit**
Actually, that doesn't look right. Earth's radius is more like 4000 miles. Your milage may vary. Smilie

** another edit **
I see what's happening.
Earth radius is:
3443 statute miles
3963 nautical miles
Make sure you don't confuse the two. Nautical miles would be the unit most likely used in a calculation like this.

Last edited by Perderabo; 08-21-2014 at 04:10 PM..
 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Lat/Long Distance Calculation

I amtrying to write a script that would compute the distance between an "x" number of points. This is what I have come up with so far and it is not working. Can anyone modify it to make it work? A=34.16597 B=-84.33244 C=34.2344 D=-84.29189 test "$A" -eq "$C" -o "$B" -eq "$D" then echo... (3 Replies)
Discussion started by: Ernst
3 Replies

2. UNIX for Dummies Questions & Answers

Long Distance UNIX (Solaris) Cloning ?

Need some advice and guidance for this UNIX beginner. Due to downsizing I have inherited the SysAdmin duties..(sigh). Please excuse and forgive me if I use the wrong terms below.... Situation: We have UNIX ( Solaris 7/8/9( it varies) on Sun Ultra 10's) servers located at several global... (1 Reply)
Discussion started by: HikerLT
1 Replies

3. Shell Programming and Scripting

Find the geographical location within a shell script

Hi, I need a shell script that when run should be able to find the geographical location of the system. can anyone help me with this? Thanks, Sundeep (1 Reply)
Discussion started by: eamani_sun
1 Replies

4. Programming

Converting distance list to distance matrix in R

Hi power user, I have this type of data (distance list): file1 A B 10 B C 20 C D 50I want output like this # A B C D A 0 10 30 80 B 10 0 20 70 C 30 20 0 50 D 80 70 50 0 Which is a distance matrix I have tried... (0 Replies)
Discussion started by: anjas
0 Replies

5. Shell Programming and Scripting

Calculate distance and azimuth

Hi all, I have a data file like this lat lon lat lon 12.000 25.125 14.235 25.012 14.200 81.000 25.584 25.014 45.023 25.365 25.152 35.222 I want to calculate distance and azimuth between this points eg:- 12.000,25.125 and 14.235,25.012 I want to use awk programming... (3 Replies)
Discussion started by: chamara
3 Replies

6. Shell Programming and Scripting

Calculating distance between two LAT long coordinates

hi, i have a pair of latitude and longitude and i want to calculate the distance between these two points. In vbscript i achieved in the following way...Now i want to implement this in unix shell scripting.... <% Dim lat1, lon1, lat2, lon2 const pi = 3.14159265358979323846 ... (8 Replies)
Discussion started by: aemunathan
8 Replies

7. Shell Programming and Scripting

finding distance between numbers

Hi, I have a file as ABC 1634230,1634284,1634349,1634468 1634272,1634301,1634356,1634534 What I want is to find distance between the numbers.. column 1 is the gene name and column 2 are starts and column 3 are their respective stops for the starts. So what I want is column 3 which has +1... (2 Replies)
Discussion started by: Diya123
2 Replies

8. Shell Programming and Scripting

Geographical location details of a server

Is there a way to find geographical location details of a server in shell scripting ? Say, which region server is located at etc. (5 Replies)
Discussion started by: blp_18
5 Replies

9. UNIX for Dummies Questions & Answers

Bash does not wrap long lines correctly

Ksh is my default shell, but I want use the bash shell since its convenient to me. When I type a long command line in a terminal, it does not wrap to the next line when I reach the end of the line and it wraps onto the same line, overwriting my prompt and the rest of what I typed. $... (5 Replies)
Discussion started by: senthil.ak
5 Replies
GPS(1)								GPSD Documentation							    GPS(1)

NAME
gps, xgps, xgpsspeed, cgps, lcdgps - test clients for gpsd SYNOPSIS
xgps [-D debug-level] [-h] [-V] [-l [[d] | [m] | [s]]] [-u [[i] | [n] | [m]]] [server [:port [:device]]] xgpsspeed [-D debug-level] [-h] [-V] [--speedunits {[mph] | [kph] | [knots]}] [server [:port [:device]]] cgps [-D debug-level] [-h] [-V] [-l [[d] | [m] | [s]]] [-m] [-s] [-u [[i] | [n] | [m]]] [server [:port [:device]]] lcdgps [-h] [-V] [-l [[d] | [m] | [s]]] [-u [[i] | [n] | [m]]] [server [:port [:device]]] gpxlogger [-D debug-level] [-d] [-e export-method] [-f filename] [-l] [-m minmove] [-h] [-V] [-i track timeout] [server [:port [:device]]] gegps [-d directory] [-i] DESCRIPTION
These are the demonstration clients shipped with gpsd. They have some common options: The -h option causes each client to emit a summary of its options and then exit. The -V option causes each client to dump the package version and exit. The -l option, when present, sets the format of latitude and longitude reports. The value 'd' produces decimal degrees and is the default. The value 'm' produces degrees and decimal minutes. The value 's' produces degrees, minutes, and decimal seconds. xgps, cgps, and lcdgps look at variables in the environment to figure out what units they should default to using for display -- imperial, nautical, or metric. Here are the variables and values they check: GPSD_UNITS one of: imperial = miles/feet nautical = knots/feet metric = km/meters LC_MEASUREMENT en_US = miles/feet C = miles/feet POSIX = miles/feet [other] = km/meters LANG en_US = miles/feet C = miles/feet POSIX = miles/feet [other] = km/meters These preferences may be overridden by the -u option. Where present, the -u option can be used to set the system units for display; follow the keyword with 'i' for 'imperial' for American units (feet in altitude and error estimates, miles per hour in speeds), 'n' for 'nautical' (feet in altitude and error estimates, knots in speed) or 'm' for 'metric' (meters in altitude and error estimates, kilometers per hour in speeds). The -D option, when present, sets a debug level; it is primarily for use by GPSD developers. It enables various progress messages to standard error. By default, clients collect data from all compatible devices on localhost, using the default GPSD port 2947. An optional argument to any client may specify a server to get data from. A colon-separated suffix is taken as a port number. If there is a second colon-separated suffix, that is taken as a specific device name to be watched. However, if the server specification contains square brackets, the part inside them is taken as an IPv6 address and port/device suffixes are only parsed after the trailing bracket. Possible cases look like this: localhost:/dev/ttyS1 Look at the default port of localhost, trying both IPv4 and IPv6 and watching output from serial device 1. example.com:2317 Look at port 2317 on example.com, trying both IPv4 and IPv6. 71.162.241.5:2317:/dev/ttyS3 Look at port 2317 at the specified IPv4 address, collecting data from attached serial device 3. [FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:2317:/dev/ttyS5 Look at port 2317 at the specified IPv6 address, collecting data from attached serial device 5. Not all clients shipped with GPSD are documented here. See also the separate manual pages for gpspipe(1) and gpsmon(1). xgps xgps is a simple test client for gpsd with an X interface. It displays current GPS position/time/velocity information and (for GPSes that support the feature) the locations of accessible satellites. In the sky view, satellites are color-coded to indicate quality of signal; consult the data display to the left for exact figures in dB. Square icons indicate WAAS/EGNOS satellites, circles indicate ordinary GPS satellites. Filled icons were used in the last fix, outline icons were not. xgpsspeed xgpsspeed is a speedometer that uses position information from the GPS. It accepts an -h option and optional argument as for gps, or a -V option to dump the package version and exit. The -speedunits option can be used to set the speed units for display; follow the keyword with knots for nautical miles per hour, kph for kilometres per hour, or mph for miles per hour. The default is miles per hour. cgps cgps is a client resembling xgps, but without the pictorial satellite display and able to run on a serial terminal or terminal emulator. The -s option prevents cgps from displaying the data coming from the daemon. This display can also be toggled with the s command. The -m option will display your magnetic heading (as opposed to your true heading). This is a calculated value, not a measured value, and is subject to a potential error of up to two degrees in the areas for which the calculation is valid (currently Western Europe, Alaska, and Lower 48 in the USA). The formulas used are those found in the Aviation Formulary v1.43. cgps terminates when you send it a SIGHUP or SIGINT; given default terminal settings this will happen when you type Ctrl-C at it. It will also terminate on 'q' lcdgps A client that passes gpsd data to lcdproc, turning your car computer into a very expensive and nearly feature-free GPS receiver. Currently assumes a 4x40 LCD and writes data formatted to fit that size screen. Also displays 4- or 6-character Maidenhead grid square output. gpxlogger This program collects fixes from gpsd and logs them to standard output in GPX, an XML profile for track logging. The output may be composed of multiple tracks. A new track is created if there's no fix for an interval specified by the -i and defaulting to 5 seconds. The -d option tells gpxlogger to run as a daemon in background. It requires the -f option, which directs output to a specified logfile. The -m option sets a minimum move distance in meters (it may include a fractional decimal part). Motions shorter than this will not be logged. gpxlogger can use any of the export methods that gpsd supports. For a list of these methods, use the -l. To force the method, give the -e one of the colon-terminated method names from the -l table. If D-Bus support is available on the host, GPSD is configured to use it, and -e dbus is specified, this program listens to DBUS broadcasts from gpsd via org.gpsd.fix. With -e sockets, or if sockets is the method defaulted to, you may give a server-port-device specification as arguments. gegps This program collects fixes from gpsd and feeds them to a running instance of Google Earth for live location tracking. The -d argument is the location of the Google Earth installation directory. If not specified, it defaults to the current directory. If you have the free (non-subscription) version, start by running with the -i option to drop a clue in the Google Earth installation directory, as 'Open_in_Google_Earth_RT_GPS.kml', then open that file in Places (File > Open...). Run gpsd in the normal way after that. SEE ALSO
gpsd(8), libgps(3), libgpsd(3), gpsfake(1), gpsctl(1), gpscat(1), gpsprof(1). gpspipe(1). gpsmon(1). AUTHORS
Remco Treffcorn, Derrick Brashear, Russ Nelson & Eric S. Raymond, Jeff Francis (cgps). Amaury Jacquot sxpert@sxpert.org & Petter Reinholdtsen pere@hungry.com (gpxlogger). Chris Kuethe chris.kuethe@gmail.com (gpxlogger), Chen Wei weichen302@aol.com (gegps). This manual page by Eric S. Raymond esr@thyrsus.com The GPSD Project 9 Aug 2004 GPS(1)
All times are GMT -4. The time now is 07:16 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy