Add get_cadastre on TPS carte page and display on leaflet map
This commit is contained in:
parent
6d4b29cf36
commit
2ce8e4734b
14 changed files with 283 additions and 91 deletions
|
@ -60,6 +60,12 @@ class Users::CarteController < UsersController
|
|||
render json: {quartier_prioritaires: qp}
|
||||
end
|
||||
|
||||
def get_cadastre
|
||||
cadastres = generate_cadastre JSON.parse(params[:coordinates])
|
||||
|
||||
render json: {cadastres: cadastres}
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def generate_qp coordinates
|
||||
|
@ -72,4 +78,15 @@ class Users::CarteController < UsersController
|
|||
|
||||
qp
|
||||
end
|
||||
|
||||
def generate_cadastre coordinates
|
||||
cadastre = []
|
||||
|
||||
coordinates.each_with_index do |coordinate, index |
|
||||
coordinate = coordinates[index].map { |latlng| [latlng['lng'], latlng['lat']] }
|
||||
cadastre << CARTO::SGMAP::Cadastre::Adapter.new(coordinate).to_params
|
||||
end
|
||||
|
||||
cadastre.flatten
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue