Giter Site home page Giter Site logo

Comments (9)

speakingcode avatar speakingcode commented on June 6, 2024 3

Is there no way to get the actual distance? I don't want to sort by distance i want to display the distance to my user, I need the actual field... how to get the distance field?

from geokit-rails.

xnzac avatar xnzac commented on June 6, 2024

Not sure how to add this to a github message, but I resolved the issue by reversing the regressive commit: xnzac@15dd4b6

And then 'distance' is back!

from geokit-rails.

dougc84 avatar dougc84 commented on June 6, 2024

+1 on this. @zaczheng 's fix works - can you do a PR on this?

from geokit-rails.

xnzac avatar xnzac commented on June 6, 2024

The repo owner wanted to extract the distance calculation out. See the following commit:

f79bbdf
"I've pushed a new commit with a helper method and some tests and removes the Array sort_by_distance_from method alltogether."

from geokit-rails.

mnoack avatar mnoack commented on June 6, 2024

I'm open to PRs but overriding core classes is best avoided for specific uses.

from geokit-rails.

mnoack avatar mnoack commented on June 6, 2024

Yes, so the new way of doing it (see test in commit referenced above) is:
unsorted_collection = DistanceCollection.new(unsorted)
unsorted_collection.set_distance_from(locations(:a))
unsorted_collection.sort_by(&:distance)

I would happy accept something like:

class DistanceCollection
  def sort_by_distance_from(origin, opts = {})
    set_distance_from(origin)
    sort_by(&:distance)
  end
end

This would enable a shorter usage like:

DistanceCollection.new(unsorted).sort_by_distance_from(origin)

from geokit-rails.

hcyildirim avatar hcyildirim commented on June 6, 2024

@speakingcode did you figured it out? i need help 😞 @mnoack

from geokit-rails.

BilalAamirr avatar BilalAamirr commented on June 6, 2024

Did anyone figured it out? @ccoeder ?

from geokit-rails.

hcyildirim avatar hcyildirim commented on June 6, 2024

You can look at this issue, there is patch on that #56

from geokit-rails.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.