Platform
Resources
Pricing
Sign in
Get started
Valtýr Örn Kjartansson
🤠
Workspace
Fork
Public
By
Valtýr Örn Kjartansson
Edited
Mar 15, 2023
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
distanceKM
=
data
.
reduce
(
(
sum
,
current
,
i
)
=>
{
if
(
i
===
0
)
return
0
;
return
sum
+
haversine
(
{
lat
:
data
[
i
-
1
]
[
0
]
,
lon
:
data
[
i
-
1
]
[
1
]
}
,
{
lat
:
current
[
0
]
,
lon
:
current
[
1
]
}
)
;
}
,
0
)
Insert cell
Purpose-built for displays of data
Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Try it for free
Learn more
Fork
View
Export
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
data
Edit
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
deg2rad
Edit
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
haversine
Edit
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
distanceKM
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML