File: vdist.py

package info (click to toggle)
pymap3d 2.5.0-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 436 kB
  • sloc: python: 2,729; ruby: 105; sh: 8; makefile: 7
file content (20 lines) | stat: -rwxr-xr-x 683 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#!/usr/bin/env python
from pymap3d.vincenty import vdist
from argparse import ArgumentParser


def main():
    p = ArgumentParser(description="vdist distance between WGS-84 coordinates")
    p.add_argument("lat1", help="latitude1 WGS-84 [degrees]", type=float)
    p.add_argument("lon1", help="longitude1 WGS-84 [degrees]", type=float)
    p.add_argument("lat2", help="latitude2 WGS-84 [degrees]", type=float)
    p.add_argument("lon2", help="longitude2 WGS-84 [degrees]", type=float)
    P = p.parse_args()

    dist_m = vdist(P.lat1, P.lon1, P.lat2, P.lon2)

    print("{:.3f} meters {:.3f} deg azimuth".format(*dist_m))


if __name__ == "__main__":  # pragma: no cover
    main()