]> git.openstreetmap.org Git - rails.git/blob - app/controllers/export_controller.rb
More test work
[rails.git] / app / controllers / export_controller.rb
1 class ExportController < ApplicationController
2   before_action :authorize_web
3   before_action :set_locale
4
5   caches_page :embed
6
7   # When the user clicks 'Export' we redirect to a URL which generates the export download
8   def finish
9     bbox = BoundingBox.from_lon_lat_params(params)
10     format = params[:format]
11
12     if format == "osm"
13       # redirect to API map get
14       redirect_to "http://api.openstreetmap.org/api/#{API_VERSION}/map?bbox=#{bbox}"
15
16     elsif format == "mapnik"
17       # redirect to a special 'export' cgi script
18       format = params[:mapnik_format]
19       scale = params[:mapnik_scale]
20
21       redirect_to "http://render.openstreetmap.org/cgi-bin/export?bbox=#{bbox}&scale=#{scale}&format=#{format}"
22     end
23   end
24
25   def embed
26   end
27 end