7
8
9
10
11
12
13
14
15
16
17
|
# File 'app/controllers/decidim/geolocation_controller.rb', line 7
def locate
enforce_permission_to :locate, :geolocation
unless Decidim::Map.configured?
return render(json: { message: I18n.t("not_configured", scope: "decidim.application.geocoding"), found: false }, status: :unprocessable_content)
end
geocoder = Decidim::Map.utility(:geocoding, organization: current_organization)
address = geocoder.address([params[:latitude], params[:longitude]])
render json: { address:, found: address.present? }
end
|