-
Notifications
You must be signed in to change notification settings - Fork 942
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
@turf/helpers: Breaking change in 6.2.0 versus 6.1.4: coordinates must contain numbers #2009
Comments
This was actually done intentionally because these checks existed in 5.x but not 6.x. They were removed as a side-effect of converting the package to typescript. Although typescript can prevent the invalid points from being passed in, we still have javascript-only consumers that can benefit from the check. The check removal itself could have been a documented break from 5 to 6 but as far as I could tell it was not. One of my goals for 6.2.0 is to get users on the latest version from the 5.x series with as few breaking changes as possible, so I opted to restore this check. Can you pre-check your points before calling If there is an example point that shouldn't cause an error but does I'd love to add that as a test case and fix the logic. As an aside, your calls to |
@mfedderly: Thanks for your reply. The issue is that the error message is wrong and it thinks that no numbers are passed in for all cases (see |
@mfedderly: I checked, the flipped lat/lon doesn't impact distance calculations or the bug report. Thanks for pointing that out though. I'm not aware of any points that pass the current check. Here are the coordinates from the tests that fail:
If it helps, this is using Node 14/15. Not sure if recent changes to numeric types broke the check. |
I checked out your repository and set a breakpoint for the exception you are seeing. It appears that you have a bug on line 17 of test.js. You are expecting city to have You might also want to check your use of geokdbush, since that also appears to take longitude, latitude. Conceptually it is ordered that way because it is customary to have the x coordinate before the y coordinate. Most geospatial software uses that ordering even though it is different than the ordering that humans tend to use when speaking. I'm going to go ahead and close this as the issue is in your code. |
@mfedderly: I don't know what tests you're referring to? These are the tests, which pass with
It would appear that it's okay to invert |
|
Oops, good call. The line numbers are for https://github.com/jmealo/find-nearest-us-cities/blob/master/index.js not test.js. |
@mfedderly: 🤦 Thank you so much, I'd love to buy you a beer/pizza. |
6.2.0
reintroduces proper null-checking for points. Invalid usage ofpoint
throws errors where it had not in the past. If you found this issue by googling the error; double check that you're passing in your coordinates aslongitude
,latitude
-- notlatitude
,longitude
and check your usage carefully.The text was updated successfully, but these errors were encountered: