manuelbieh / geolib

Zero dependency library to provide some basic geo functions
MIT License
4.21k stars 341 forks source link

geolib.convertDistance is not a function #193

Closed bluenex closed 5 years ago

bluenex commented 5 years ago

I just upgraded geolib from ^2.0.24 to ^3.0.2. I notice that there is no convertUnit anymore so I'm changing this to convertDistance. However, I've got an error message as follows:

TypeError: geolib.convertDistance is not a function
    at Location.js:59
    at tryCallOne (core.js:37)
    at core.js:123
    at JSTimers.js:295
    at _callTimer (JSTimers.js:152)
    at _callImmediatesPass (JSTimers.js:200)
    at Object.callImmediates (JSTimers.js:464)
    at MessageQueue.__callImmediates (MessageQueue.js:320)
    at MessageQueue.js:135
    at MessageQueue.__guard (MessageQueue.js:297)

It seems convertDistance is not available so I try to log geolib module and got this:

geolib:
  Module {…}
    computeDestinationPoint: (...)
    convertSpeed: (...)
    decimalToSexagesimal: (...)
    findNearest: (...)
    getBounds: (...)
    getBoundsOfDistance: (...)
    getCenter: (...)
    getCenterOfBounds: (...)
    getCompassDirection: (...)
    getCoordinateKey: (...)
    getCoordinateKeys: (...)
    getDistance: (...)
    getDistanceFromLine: (...)
    getGreatCircleBearing: (...)
    getLatitude: (...)
    getLongitude: (...)
    getPathLength: (...)
    getPreciseDistance: (...)
    getRhumbLineBearing: (...)
    getRoughCompassDirection: (...)
    getSpeed: (...)
    isDecimal: (...)
    isPointInLine: (...)
    isPointInPolygon: (...)
    isPointNearLine: (...)
    isSexagesimal: (...)
    isValidCoordinate: (...)
    isValidLatitude: (...)
    isValidLongitude: (...)
    orderByDistance: (...)
    sexagesimalToDecimal: (...)
    toDecimal: (...)
    toDeg: (...)
    toRad: (...)
    Symbol(Symbol.toStringTag): "Module"
    __esModule: true

Only convertDistance is not here! I try to find around and found that it's exported properly and this should not happen. Do you guys have any idea? I'm kind of lost now.

My environment (just in case):

manuelbieh commented 5 years ago

Yes. This was a bug that was already fixed a few days ago but wasn't published properly by CI. I've now published a fix in v3.0.3!

Sorry for that!

bluenex commented 5 years ago

That was quick!

Cheers.

bluenex commented 5 years ago

Yes. This was a bug that was already fixed a few days ago but wasn't published properly by CI. I've now published a fix in v3.0.3!

Sorry for that!

I have upgraded to 3.0.3 but looks like the problem still persists. Exactly the same log as I reported earlier.

manuelbieh commented 5 years ago

Make sure you have the latest version installed. Try to install it explicitly via yarn add geolib^3.0.3 or npm install geolib@^3.0.3. Maybe your lockfile makes yarn/npm still install an older version.

I’ve checked 3.0.3 and convertDistance is definitely there:

A66C34F6-2397-4BC4-88C4-8C47F44B6562