]> git.openstreetmap.org Git - rails.git/blob - app/controllers/export_controller.rb
Merged I18N branch to head.
[rails.git] / app / controllers / export_controller.rb
1 class ExportController < ApplicationController
2
3   before_filter :authorize_web
4   before_filter :set_locale
5
6   def start
7   end
8
9   #When the user clicks 'Export' we redirect to a URL which generates the export download
10   def finish
11     bbox = BoundingBox.new(params[:minlon], params[:minlat], params[:maxlon], params[:maxlat])
12     format = params[:format]
13
14     if format == "osm"
15       #redirect to API map get
16       redirect_to "http://api.openstreetmap.org/api/#{API_VERSION}/map?bbox=#{bbox}"
17
18     elsif format == "mapnik"
19       #redirect to a special 'export' cgi script
20       format = params[:mapnik_format]
21       scale = params[:mapnik_scale]
22
23       redirect_to "http://tile.openstreetmap.org/cgi-bin/export?bbox=#{bbox}&scale=#{scale}&format=#{format}"
24
25     elsif format == "osmarender"
26       #redirect to the t@h 'MapOf' service
27       format = params[:osmarender_format]
28       zoom = params[:osmarender_zoom].to_i
29       width = bbox.slippy_width(zoom).to_i
30       height = bbox.slippy_height(zoom).to_i
31
32       redirect_to "http://tah.openstreetmap.org/MapOf/index.php?long=#{bbox.centre_lon}&lat=#{bbox.centre_lat}&z=#{zoom}&w=#{width}&h=#{height}&format=#{format}"
33     end
34   end
35 end