hypertidy / geodist

Ultra lightweight, ultra fast calculation of geo distances
https://hypertidy.github.io/geodist/
Other
93 stars 7 forks source link

Updated version of package fails when y coordinate is called ymax #33

Closed Robinlovelace closed 3 years ago

Robinlovelace commented 3 years ago

Discovered in the slopes package and documented here: https://github.com/ITSLeeds/slopes/issues/25

After some investigation it seems the names of the coordinates are the cause:

geodist::geodist(c(xmin = -9.2, ymin = 39), c(xmax = -9.1, ymin = 38))
#> Maximum distance is > 100km. The 'cheap' measure is inaccurate over such
#> large distances, you'd likely be better using a different 'measure'.
#>          [,1]
#> [1,] 111472.8
geodist::geodist(c(xmin = -9.2, ymin = 39), c(xmax = -9.1, ymax = 38))
#> Error in find_xy_cols(obj): Unable to determine longitude and latitude columns; perhaps try re-naming columns.

Created on 2021-02-02 by the reprex package (v1.0.0)

mpadge commented 3 years ago

Ah, dammit. Yeah, the last update did some fiddling with the guessing of column names, and obviously mucked that up. Shall fix on the morrow. Good catch!

mpadge commented 3 years ago

Sorry, took a few days, but that commit should fix. Thanks again for uncovering

Robinlovelace commented 3 years ago

Great fix, thanks @mpadge

mpadge commented 3 years ago

Yeah, i remain really committed to the general workflow of "smartly" parsing columns names in most packages, but it is sometimes more prone to bugs than simply insisting on a single hard-coded system. Still worth it I maintain!