


SEbE ) # Southeast by east, prints 123.750 print ( compass. northwest_by_north ) # prints 326.250 print ( compass. To use CompassSimple: import great_circle_calculator.CompassSimple as compass print ( compass. Alternatively you may use the "Abbreviation" with the appropriate case to call the same value. Simply use the terms in "Compass point", use lower case and underscores where there are spaces or dashes. CompassComplex is still in the todo list but it contains more information about each compass point. It has two classes called CompassSimple and CompassComplex.
CIRCLE EQUATION CALCULATOR CODE
I thought it helped with code readabilityĪt first, kept it because it might be useful. This libaray was created to let me call, say Compass.east so I can get 90deg. unit is a unit of measurement that can be accessed by great_circle_units, default is 'meters'. Function point_given_start_and_bearing()įunction point_given_start_and_bearing(p1, course, distance, unit='meters') is given a start point p1, initial bearing course, and distance distance, this will calculate the destination point bearing travelling along a (shortest distance) great circle arc. fraction is the fraction of the distance between p1 and p2, where 0 is p1, 0.5 is equivalent to midpoint(), and 1 is p2. For example, say p3 = midpoint(p1, p2), distance_between_points(p1, p3) = distance_between_points(p2, p3) Function intermediate_point()įunction intermediate_point(p1, p2, fraction=0.5) an intermediate point along the course laid out by p1 to p2 given the fractional distance. tuples, lists of length 2) in the form of (lon, lat) in decimal degrees. Function midpoint()įunction midpoint(p1, p2) is the half-way point along a great circle path between the two points. Use bearing_at_p1() to find the bearing at the starting point, p1. Use in conjunction with midpoint() and intermediate_point() to find the course along the route. intermediate_point ( p1, p2, frac_along_route ), p2 ) Function bearing_at_p2įunction bearing_at_p2(p1, p2) computes the bearing (i.e. tuples, lists of length 2) in the form of (lon, lat) in decimal degrees.Įxample to find a course enroute: import great_circle_eat_circle_calculator as gcc """ This code snippit will find the the course at a point p3 which is 20% the way between points p1 and p2 """ p1, p2 = ( lon1, lat1 ), ( lon2, lat2 ) frac_along_route = 0.2 course_enroute = gcc. Use bearing_at_p2() to find the bearing at the endpoint, p2. Function bearing_at_p1()įunction bearing_at_p1(p1, p2) computes the bearing (i.e. Changing it to haversine=False yeilds the law of cosines which, typically, will have a quicker computational time. haversine=True uses the haversine formula, which is consideered superior for short distances (which is my often use case).

It will calculate the distance using the law of cosines unless the user specifies haversine to be true. The functions are distance_between_points, bearing_at_p1, bearing_at_p2, midpoint, intermediate_point, point_given_start_and_bearing Function distance_between_points()įunction distance_between_points(p1, p2, unit='meters', haversine=True) computes the distance between two points in the unit given in the unit parameter. Where * can be a specific function (or left as * for all the functions) Or from great_circle_eat_circle_calculator import * Library great_circle_calculatorĭepending on my needs, I will either import this library as import great_circle_eat_circle_calculator as gcc Here is an outline of the functions available to you.
CIRCLE EQUATION CALCULATOR HOW TO
How to installĬlone/download the package to your project or use pip install great-circle-calculator ( PyPI) How to use
CIRCLE EQUATION CALCULATOR FREE
One example is geodesy.īut I figured I could use the python practice.Īny questions, feel free to get in touch. Feel free to clone, fork, or modify the code as needed. The formulas here were adapted into python fromīecause I've been using these equations across several projects, I decided to upload this to PyPI for ease of This is a collection of equations and formulas that I've been using across my many projects to compute variousĭistances using great circle calculations.
