GeoKit: A Tiny Update
Its been a while since I tinkered with GeoKit, but when I read this post, I thought I’d take a look at a couple of things that were mentioned.
James wrote that it would be nice to be able to reset the default_units value to enable localization. Well, actually you can. :default_units is modifiable through a class accessor. Also, you can pass an optional parameter in your finders called :units which enables you to override whatever default value you’ve set.
While we’re talking about defaults, I applied a patch submitted by Hoan Ton-That which enables you to specify your preferences for units and for the formula from within the environment files. So these preferences would appear right along side your API keys for GeoKit. Its a small feature, but you may appreciate it. Thanks Hoan!
Otherwise, James mentioned that :include support is lacking with GeoKit. That’s not entirely true. I added a passing test case which successfully pulls columns from a belongs_to relationship. I suspect that the has_many relationships are the problem. But if your case is covered by the belongs_to relationship, then you are covered.
There is a less-used method called distance_sql which enables you to just get the distance calculation in SQL form. You would use this if you ever found that GeoKit could not support your exact query requirements. Its less elegant for sure, but saves you the trouble of having to code the distance calculation.
UK geocoding is still in the roadmap, but both Andre and I have a few other projects and side endeavors going on.