henrythasler / Leaflet.Geodesic

Add-on to draw geodesic lines with leaflet
GNU General Public License v3.0
156 stars 27 forks source link

Bearing #69

Closed briandoylegit closed 3 years ago

briandoylegit commented 3 years ago

Hi Henry,

I don't suppose you might create an example with Initial Bearing output combined with Final Bearing. i.e. An info box with Initial Bearing xxx.xxx Final Bearing xxx.xxx It would be most helpful for me.

Many thanks

Brian

henrythasler commented 3 years ago

You can calculate this info with some internal methods like this:

const Berlin = {lat: 52.5, lng: 13.35};
const LosAngeles = {lat: 33.82, lng: -118.38};
const line = new L.Geodesic();

extendedStats = line.geom.geodesic.inverse(Berlin, LosAngeles)
console.log(`initialBearing=${extendedStats.initialBearing} finalBearing=${extendedStats.finalBearing}`)

Here is a live example: https://jsitor.com/tkp4TOqNU7

briandoylegit commented 3 years ago

Hi Henry,

Many thanks for Leaflet.Geodesic and this example. Exactly what I need.

Happy Christmas

Brian

On Tue, Dec 29, 2020 at 8:25 AM henrythasler notifications@github.com wrote:

You can calculate this info with some internal methods like this:

const Berlin = {lat: 52.5, lng: 13.35}; const LosAngeles = {lat: 33.82, lng: -118.38}; const line = new L.Geodesic();

extendedStats = line.geom.geodesic.inverse(Berlin, LosAngeles) console.log(initialBearing=${extendedStats.initialBearing} finalBearing=${extendedStats.finalBearing})

Here is a live example: https://jsitor.com/tkp4TOqNU7

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/henrythasler/Leaflet.Geodesic/issues/69#issuecomment-751993216, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABNC2MZQ22FNHJJYKZWUJMDSXGG75ANCNFSM4UPVLCSA .