I have a graphql query that returns a list of pullup bar
objects.
Query:
query PullUpBarsByDate($userID: String) {
PullUpBarsByDate(
type: "PullUpBar"
sortDirection: DESC
) {
items {
id
lat
lng
userID
}
}
}
Returns something like this:
[
{
id: "rf6zrd1prm",
lat: 63.50235889533083,
lng: 28.426290788320724,
},
{
id: "y80ymnlgzi7",
lat: 62.5654380797649,
lng: 17.338090077030582,
},
{
id: "ufpgut6wwh",
lat: 56.85363369278235,
lng: 30.675813028973685,
},
{
id: "p80r9j2li8a",
lat: 55.274815489484716,
lng: 24.094777714658456,
},
{
id: "ydnlsd1vn8c",
lat: 50.61633534684824,
lng: 26.500618762197323,
}
]
I’m wondering if it’s possible to order the returned list of items based on how far this would be from my location, given that my location is known on the application side. Something like this formula would be perfect: d=√((x2 – x1)² + (y2 – y1)²)