GetStream / stream-js

JS / Browser Client - Build Activity Feeds & Streams with GetStream.io
https://getstream.io
BSD 3-Clause "New" or "Revised" License
329 stars 110 forks source link

Feature Request: Add support for arccos, arcsin, and arctan in Custom Rankings #577

Closed asnaseer closed 10 months ago

asnaseer commented 1 year ago

Would it be possible for you to add support for arccos, arcsin, and arctan functions for Custom Ranking.

We have a use case where we want to rank bird sighting activities based on how far away the sighting was from the users home location. We know the longitude and latitude of the users home location as well as that of where the bird sighting took place. There is a well known formula for calculating the distance between to such points on the Earth given by:

d = 3963.0 * arccos[(sin(lat1) * sin(lat2)) + cos(lat1) * cos(lat2) * cos(long2 – long1)]

As you can see, it makes use of the arccos function that you do not currently seem to support.

I think this would be something that many other customers of yours will also find useful.

xernobyl commented 10 months ago

Feature was added to the backend. Should be deployed in the coming days.