You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As others have pointed out measurements.py::distance says in the doc string to pass two "tuples of (latitude, longitude)" when in all reality the actual code flips this order thus resulting inaccurate measurements. Without knowing what else the code does I would advocate for at least changing the documentation to reflect that in reality you must pass two "tuples of (longitude, latitude)"
Proposed change:
def distance(point1: Feature, point2: Feature, units: str = "km"):
"""
Calculates distance between two Points. A point is containing latitude and
logitude in decimal degrees and ``unit`` is optional.
It calculates distance in units such as kilometers, meters, miles, feet and inches.
:param point1: first point; tuple of (longitude, latitude) in decimal degrees.
:param point2: second point; tuple of (longitude, latitude) in decimal degrees.
:param units: A string containing unit, E.g. kilometers = 'km', miles = 'mi',
meters = 'm', feet = 'ft', inches = 'in'.
:return: The distance between the two points in the requested unit, as a float.
Example:
>>> from turfpy import measurement
>>> from geojson import Point, Feature
>>> start = Feature(geometry=Point((-75.343, 39.984)))
>>> end = Feature(geometry=Point((-75.534, 39.123)))
>>> measurement.distance(start,end)
"""
coordinates1 = get_coord(point1)
coordinates2 = get_coord(point2)
dlat = radians((coordinates2[1] - coordinates1[1]))
dlon = radians((coordinates2[0] - coordinates1[0]))
lat1 = radians(coordinates1[1])
lat2 = radians(coordinates2[1])
The text was updated successfully, but these errors were encountered:
As others have pointed out
measurements.py::distance
says in the doc string to pass two "tuples of (latitude, longitude)" when in all reality the actual code flips this order thus resulting inaccurate measurements. Without knowing what else the code does I would advocate for at least changing the documentation to reflect that in reality you must pass two "tuples of (longitude, latitude)"Proposed change:
The text was updated successfully, but these errors were encountered: