Skip to content
This repository has been archived by the owner on Nov 3, 2022. It is now read-only.

Math Module

Zander edited this page Mar 2, 2021 · 2 revisions

How to Import

from zcscommonlib import zcsmath

Haversine (Great Circle Distance) - zcsmath.great_circle()


Purpose

Calculates the great circle distance between two points on the earth (specified in decimal degrees), returns the distance in meters.

Args (In order)

lon1 (float): The longitude of the first point.
lat1: (float): The latitude of the first point.
lon2: (float): The longitude of the second point.
lat2: (float): The latitude of the second point.

Returns

The distance in meters between the two sets of coordinates.

Example

# Imports
from zcscommonlib import zcsmath

# Main program logic
distance = zcsmath.great_circle(52.370216, 4.895168, 52.520008, 13.404954)

print(distance)

# Output: 947546.2822650459