Use GeoAdresse to geolocate enterprise on leaflet map

This commit is contained in:
Xavier J 2016-01-06 15:48:06 +01:00
parent cf248f198f
commit 34dc07a06d
2 changed files with 5 additions and 1 deletions

View file

@ -45,7 +45,7 @@ class Users::CarteController < UsersController
end
def get_position
tmp_position = Carto::Geocodeur.convert_adresse_to_point(current_user_dossier.etablissement.adresse.gsub("\r\n", ' '))
tmp_position = Carto::Geocodeur.convert_adresse_to_point(current_user_dossier.etablissement.geo_adresse)
if !tmp_position.point.nil?
render json: {lon: tmp_position.point.x.to_s, lat: tmp_position.point.y.to_s, dossier_id: params[:dossier_id]}

View file

@ -3,4 +3,8 @@ class Etablissement < ActiveRecord::Base
belongs_to :entreprise
has_many :exercices
def geo_adresse
numero_voie.to_s << ' ' << type_voie.to_s << ' ' << nom_voie.to_s << ' ' << complement_adresse.to_s << ' ' << code_postal.to_s << ' ' << localite.to_s
end
end