GeoKit: Some Minor Feature Tweaks
In the last couple of days, I added a couple of minor feature tweaks.
First, the finders will now all accept optional :units and :formula keys to enable you to override the units and formula used by the model by default. This makes it possible to serve distance queries in miles or kms and even to modify the formula used in the query. Overriding the formula might be important if you know the proximity is close and you don’t care about precise accuracy. It might also be helpful in the event that your dataset grows beyond that which would perform using the more taxing Haversine (:sphere) formula.
The second feature is a bit more subtle and edge case-like. If you steer away from our defaults and customize the lat / lng attributes, then the :origin was previously unable to handle taking an instance of those rows that you seek. I made a change to enable it to detect that situation. So now, you can do this. I did find one issue and that’s with the distance_from method which counts on lat / lng. Hopefully, I can add the same introspection and tidy that up as well. This will enable full customization for lat / lng attributes. Of course, you can write your own accessors to get around this, but still…
If you have any additional feedback, feel free to send Andre or I an email.
UPDATE: The update is complete, you can now compare the distance of Mappable instances which customize their lat / lng attributes when running as acts_as_mappable. If you don’t understand what this means, you probably don’t need the feature, so don’t sweat it.