demarches-normaliennes/lib/carto/sgmap/cadastre/adapter.rb
Xavier J d48c600476 Add lib API SGMAP Cartography Cadastre
Adapt lib API SGMAP Cartography Quartier Prioritaire at the new API architecture
2016-01-12 17:24:42 +01:00

22 lines
471 B
Ruby

class CARTO::SGMAP::Cadastre::Adapter
def initialize(coordinates)
@coordinates = GeojsonService.to_json_polygon(coordinates)
end
def data_source
@data_source ||= JSON.parse(CARTO::SGMAP::API.search_cadastre(@coordinates), symbolize_names: true)
end
def to_params
params = []
data_source[:features].each do |feature|
tmp = feature[:properties]
tmp[:geometry] = feature[:geometry]
params << tmp
end
params
end
end