lib/geocoder/lookups/pelias.rb in geocoder-1.3.4 vs lib/geocoder/lookups/pelias.rb in geocoder-1.3.5
- old
+ new
@@ -21,14 +21,22 @@
end
private
def query_url_params(query)
- {
+ params = {
api_key: configuration.api_key,
- text: query.text,
size: 1
- }.merge(super(query))
+ }.merge(super)
+
+ if query.reverse_geocode?
+ lat,lon = query.coordinates
+ params[:'point.lat'] = lat
+ params[:'point.lon'] = lon
+ else
+ params[:text] = query.text
+ end
+ params
end
def results(query)
return [] unless doc = fetch_data(query)