demarches-normaliennes/app/services/api_carto_service.rb

32 lines
855 B
Ruby
Raw Normal View History

class ApiCartoService
def self.generate_qp(coordinates)
coordinates.flat_map do |coordinate|
ApiCarto::QuartiersPrioritairesAdapter.new(
coordinate.map { |element| [element['lng'], element['lat']] }
2018-10-15 16:25:16 +02:00
).results
end
end
def self.generate_cadastre(coordinates)
2018-01-15 21:33:29 +01:00
coordinates.flat_map do |coordinate|
ApiCarto::CadastreAdapter.new(
coordinate.map { |element| [element['lng'], element['lat']] }
2018-10-15 16:25:16 +02:00
).results
2018-01-15 21:33:29 +01:00
end
end
2018-10-23 15:37:13 +02:00
def self.generate_rpg(coordinates)
coordinates.flat_map do |coordinate|
ApiGeo::RPGAdapter.new(
coordinate.map { |element| [element['lng'], element['lat']] }
).results
end
end
2018-12-19 11:09:13 +01:00
def self.generate_selection_utilisateur(coordinates)
{
geometry: JSON.parse(GeojsonService.to_json_polygon_for_selection_utilisateur(coordinates))
}
end
end