Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

incorrect measurement due to swap of lat/long #105

Open
our30K opened this issue Jun 3, 2022 · 0 comments
Open

incorrect measurement due to swap of lat/long #105

our30K opened this issue Jun 3, 2022 · 0 comments

Comments

@our30K
Copy link

our30K commented Jun 3, 2022

Hi, thanks for all the work, I've been using this for a while, and recently I discover an issue about the points measurement

in the measure function, the comments shows that points should be defined as (lat, long)
but in the calculation below, it is expecting (long, lat). which leads distance calculation error.
this is an easy fix, but I am not sure, if this also leads to calculation error in point to line, point to polygon etc.

dlat = radians((coordinates2[1] - coordinates1[1]))
dlon = radians((coordinates2[0] - coordinates1[0]))

"
:param point1: first point; tuple of (latitude, longitude) in decimal degrees.
:param point2: second point; tuple of (latitude, longitude) 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])"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant