Skip to content

AmeyHengle/nautical_calculations

Repository files navigation

nautical_calculations

nautical-calculations is a Python library to be used for performing Geospatial calculations on the geographic coordinate system.

It is developed to act as an interface for performing calculations like the nautical distance (Great Circle distance), Rhumb line distance and bearing angle. It explores the possiblitity of using these basic terms in performing operations like:

  • Finding all the coordinates which lie on the great circle line joining any two points on the map
  • Finding the coordinates of a point at a particular angle and distance from the given point.
  • Finding the coordinates of midpoint on the great circle line joining any two points on the map.

The main idea is to save the time of defining your own functions to derive these terms, thus making the project development process easier.

Installation

Use the package manager pip to install nautical_calculations.

pip install nautical-calculations

Usage

from nautical_calculations import *

or

from nautical_calculations.basic import get_distance

from nautical_calculations.basic import get_bearing

from nautical_calculations.basic import rhumb_line

from nautical_calculations.operations import get_point

from nautical_calculations.operations import get_midpoint

from nautical_calculations.operations import divide_by_interval

from nautical_calculations.operations import divide_by_number

Usage examples:

I) Nautical distance (km)

get_distance(lat1,long1,lat2,long2) # returns the nautical distance (in km) between two coordinates (lat1,long1) and (lat2,long2)

II) Bearing (degrees)

get_bearing(lat1,long1,lat2,long2) # returns the bearing between two coordinates (lat1,long1) and (lat2,long2)

III) Rhumb Line (km)

rhumb_line(lat1, long1, lat2, long2)   # returns rhumb line distance (in km) between two given coordinates

IV) Point (lat,long)

get_point(lat,long,azimuth,distance) # returns the coordinate (lat1,long1) at a particular distance and angle (azimuth) from the given point (lat,long)

V) Intermediate points (by number)

divide_by_number(lat1, long1, lat2, long2, number) # returns a list containing all points in between the two specified coordinate pairs (lat-long) given the number value

VI) Intermediate points (by interval)

divide_by_interval(lat1, long1, lat2, long2, interval) # returns a list containing all points in between the two specified coordinate pairs (lat-long) given the interval value

VII) Midpoint

get_midpoint(lat1, long1, lat2, long2) #Returns the coordinates of midpoint on the rhumb line joining the given endpoint coordinates (lat1,long1,lat2,long2)

VIII) Conversions

from nautical_calculations.operations import convert_to_radians,convert_to_miles,convert_to_kilometres,convert_to_degress
convert_to_miles(distance)             #converts distance in kms to miles
convert_to_kilometres(distance)        #converts distance in miles to kms
convert_to_radians(angle)              #converts angle in degrees to radians
convert_to_degress(angle)              #converts angle in radians to degrees

Sample code link

https://github.com/AmeyHengle/nautical_calculations/blob/master/samples/sample_code.py

PyPI package link

https://pypi.org/project/nautical-calculations/

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

References

  1. http://mathforum.org/library/drmath/view/51879.html
  2. http://www.edwilliams.org/avform.htm#Intermediate
  3. http://mathforum.org/library/drmath/view/55417.html
  4. http://mathforum.org/library/drmath/view/51822.html

License

MIT

About

nautical-calculations is a Python library used for dealing with some basic Geospatial calculations on the geographic coordinate system.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages