]> git.openstreetmap.org Git - rails.git/blob - app/controllers/export_controller.rb
tweak lat lon decision logic for the edit tab. made it more similar to logic in index...
[rails.git] / app / controllers / export_controller.rb
1 class ExportController < ApplicationController
2   def start
3   end
4
5   #When the user clicks 'Export' we redirect to a URL which generates the export download
6   def finish
7     bbox = BoundingBox.new(params[:minlon], params[:minlat], params[:maxlon], params[:maxlat])
8     format = params[:format]
9
10     if format == "osm"
11       #redirect to API map get
12       redirect_to "http://api.openstreetmap.org/api/#{API_VERSION}/map?bbox=#{bbox}"
13       
14     elsif format == "mapnik"
15       #redirect to a special 'export' cgi script
16       format = params[:mapnik_format]
17       scale = params[:mapnik_scale]
18
19       redirect_to "http://tile.openstreetmap.org/cgi-bin/export?bbox=#{bbox}&scale=#{scale}&format=#{format}"
20       
21     elsif format == "osmarender"
22       #redirect to the t@h 'MapOf' service
23       format = params[:osmarender_format]
24       zoom = params[:osmarender_zoom].to_i
25       width = bbox.slippy_width(zoom).to_i
26       height = bbox.slippy_height(zoom).to_i
27
28       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}"
29     end
30   end
31 end