Skip to content
This repository has been archived by the owner on Oct 30, 2021. It is now read-only.

Update scoredist implementation #133

Closed
miccolis opened this issue Oct 12, 2018 · 0 comments · Fixed by #139
Closed

Update scoredist implementation #133

miccolis opened this issue Oct 12, 2018 · 0 comments · Fixed by #139

Comments

@miccolis
Copy link
Contributor

The scoredist method claims to be equivalient of the method of the same name in carmen, but it really is not.

  • scoredist in carmen-cache
    double scoredist(unsigned zoom, double distance, double score, double radius) {
    if (zoom < 6) zoom = 6;
    if (distance == 0.0) distance = 0.01;
    double scoredist = 0;
    // Since distance is in tiles we calculate scoredist by converting the miles into
    // a tile unit value at the appropriate zoom first.
    //
    // 32 tiles is about 40 miles at z14, use this as our mile <=> tile conversion.
    scoredist = ((radius * (32.0 / 40.0)) / _pow(1.5, 14 - static_cast<int>(zoom))) / distance;
    return score > scoredist ? score : scoredist;
    }
  • scoredist in carmen https://github.com/mapbox/carmen/blob/f831f2dfc9eb965752939f5809b18315b38b7659/lib/util/proximity.js#L81-L90

We should most likely update the version here to actually be equivalent of what is over in carmen.

@miccolis miccolis mentioned this issue Dec 14, 2018
3 tasks
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant