]> git.openstreetmap.org Git - rails.git/blob - app/controllers/export_controller.rb
Covering the case of an entry not being found. More diary entry tests.
[rails.git] / app / controllers / export_controller.rb
1 class ExportController < ApplicationController
2   def start
3   end
4
5   def finish
6     bbox = BoundingBox.new(params[:minlon], params[:minlat], params[:maxlon], params[:maxlat])
7     format = params[:format]
8
9     if format == "osm"
10       redirect_to "http://api.openstreetmap.org/api/#{API_VERSION}/map?bbox=#{bbox}"
11     elsif format == "mapnik"
12       format = params[:mapnik_format]
13       scale = params[:mapnik_scale]
14
15       redirect_to "http://tile.openstreetmap.org/cgi-bin/export?bbox=#{bbox}&scale=#{scale}&format=#{format}"
16     elsif format == "osmarender"
17       format = params[:osmarender_format]
18       zoom = params[:osmarender_zoom].to_i
19       width = bbox.slippy_width(zoom).to_i
20       height = bbox.slippy_height(zoom).to_i
21
22       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}"
23     end
24   end
25 end