New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Pass query options through geocoded_by? #1118
Comments
Hi @toppa There are a few things that you could pass to geocoder/lib/geocoder/models/active_record.rb Lines 11 to 22 in 6589b9b
But currently no way to handle passing params. We are open to accepting a pull request for this feature as this question has been asked before by others: #765 Currently this can be achieved only by writing custom geocode method. See the linked issue for example. Thanks! |
Thanks for the quick reply. It looks like we would need to open this up to allow for user supplied params. This is my first time looking at the Geocoder internals, so I'm not sure offhand how |
@toppa That is correct. Instead of geocoded_by :address, :params => {region: 'US'}
reverse_geocoded_by :lat, :lon, :params => {region: 'US'} Here is where the
I didn't 100% get how it gets from there to the geocoder/lib/geocoder/models/base.rb Line 9 in 6589b9b
And do_lookup is called from the store classes: geocoder/lib/geocoder/stores/active_record.rb Line 287 in 6589b9b
So there's a step I'm missing here. Maybe @alexreisner could explain more? Thanks so much for wanting to add this feature! Please ensure to add some unit tests! |
I think I will try to implement this 😶 |
Added by #1188. |
I'm trying to figure out if it's possible to pass query options with
geocoded_by
- I don't see this mentioned in the docs. Specifically, I want to pass arguments to the Googe API'scomponents
parameter. I can do it withGeocoder.search
, but I don't see how to do it with my method that's invoked bygeocoded_by
- it seems to want only a single string returned, and if I correctly understand its option for passing a block, it's for handling results. Is it possible to do this?The text was updated successfully, but these errors were encountered: