Closed kursata closed 5 years ago
Seeing the exact same issue.
Can you provide some code examples maybe?
I'm debugging the issue at the moment - I'll update shortly.
@manuelbieh It occurs when coordinates with additional precision are provided.
e.g. { latitude: 40.7536853999999, longitude: -73.9991637 }
@manuelbieh might it be related to this #113 ?
I am also having this issue right now but only on IOS. . it works fine on android . . in my case I added onPress event on the map to get coordinates. Here is my code:
https://github.com/airbnb/react-native-maps/issues/1499
It appears that on IOS the callback is missing some data or it did not return properly. Please advise. Thank you.
any update on this?
I don't know if this is the same issues others are seeing, but I also ran into it like this:
This (and #130) can both be caused by using the navigator.geolocation
APIs with geolib. The Coordinates
object returned by a call to getCurrentPosition()
or watchPosition()
doesn't hasOwnProperty()
for either 'latitude'
or 'longitude'
, although the implementing object can retrieve values for these properties.
This means that coords()
, delegating to getKeys()
's, fails to find latitude and longitude properties, and returns undefined
. Other functions that depend on coords()
(most of them, I believe), throw this error because they assume that coords()
will return a valid object, but it does not, resulting in this error.
@ianawilson did you figure out how to fix this?
@kirakik My workaround was to map the Coordinates
object to a POJO, eg,
navigator.geolocation.getCurrentPosition(function(position) {
// or whatever geolib function
geolib.longitude({
latitude: position.coords.latitude,
longitude: position.coords.longitude,
});
});
or map when I had a collection of positions,
geolib.getPathLength(positions.map((p) => ({
latitude: p.coords.latitude,
longitude: p.coords.longitude,
})));
But I would love to see geolib work nicer with the geolocation API!
I was pretty sure that already worked 🤔 Should be fixed again in v3.0.0 which I will release shortly.
Hi
We're experiencing following error while calling findNearest() function. The error occurs in some of the calls. The inputs parameters of successful and unsuccessful calls are identical. Any idea on the cause of the error or a fix on handling the type error will be appreciated.
TypeError: Cannot read property 'latitude' of undefined at Geolib.geolib.extend.coords (/var/app/current/node_modules/geolib/dist/geolib.js:179:121) at Geolib.geolib.extend.getDistance (/var/app/current/node_modules/geolib/dist/geolib.js:248:26) at Geolib.geolib.extend.orderByDistance (/var/app/current/node_modules/geolib/dist/geolib.js:924:37) at Geolib.geolib.extend.findNearest (/var/app/current/node_modules/geolib/dist/geolib.js:1013:32) at /var/app/current/BAL/Content/Watchlist/Watchlist.js:633:56 at fn (/var/app/current/node_modules/async/lib/async.js:746:34) at /var/app/current/node_modules/async/lib/async.js:1213:16 at /var/app/current/node_modules/async/lib/async.js:166:37 at /var/app/current/node_modules/async/lib/async.js:706:43 at /var/app/current/node_modules/async/lib/async.js:167:37 at Immediate._onImmediate (/var/app/current/node_modules/async/lib/async.js:1206:34) at processImmediate as _immediateCallback