X-Git-Url: https://git.openstreetmap.org/rails.git/blobdiff_plain/bf29550db840c97cafffbe1e836750bef6c7942d..a7ea614dd05af2a53b30e1dce6bfe29044e1f5a5:/app/controllers/api_controller.rb diff --git a/app/controllers/api_controller.rb b/app/controllers/api_controller.rb index 0724a3712..1af148455 100644 --- a/app/controllers/api_controller.rb +++ b/app/controllers/api_controller.rb @@ -1,15 +1,12 @@ class ApiController < ApplicationController session :off - before_filter :check_read_availability, :except => [:capabilities] + before_filter :check_api_readable, :except => [:capabilities] after_filter :compress_output # Help methods for checking boundary sanity and area size include MapBoundary - #COUNT is the number of map requests to allow before exiting and starting a new process - @@count = COUNT - # The maximum area you're allowed to request, in square degrees MAX_REQUEST_AREA = APP_CONFIG['max_request_area'] @@ -19,7 +16,6 @@ class ApiController < ApplicationController # Get an XML response containing a list of tracepoints that have been uploaded # within the specified bounding box, and in the specified page. def trackpoints - @@count+=1 #retrieve the page number page = params['page'].to_i unless page @@ -55,7 +51,7 @@ class ApiController < ApplicationController points = Tracepoint.find_by_area(min_lat, min_lon, max_lat, max_lon, :offset => offset, :limit => TRACEPOINTS_PER_PAGE, :order => "timestamp DESC" ) doc = XML::Document.new - doc.encoding = 'UTF-8' + doc.encoding = XML::Encoding::UTF_8 root = XML::Node.new 'gpx' root['version'] = '1.0' root['creator'] = 'OpenStreetMap.org' @@ -73,13 +69,6 @@ class ApiController < ApplicationController trkseg << point.to_xml_node() end - #exit when we have too many requests - if @@count > MAX_COUNT - render :text => doc.to_s, :content_type => "text/xml" - @@count = COUNT - exit! - end - response.headers["Content-Disposition"] = "attachment; filename=\"map.osm\"" render :text => doc.to_s, :content_type => "text/xml" @@ -95,8 +84,6 @@ class ApiController < ApplicationController # fetched. All the nodes and ways that are referenced by those ways are then # fetched. Finally all the xml is returned. def map - GC.start - @@count+=1 # Figure out the bbox bbox = params['bbox'] @@ -206,13 +193,6 @@ class ApiController < ApplicationController response.headers["Content-Disposition"] = "attachment; filename=\"map.osm\"" render :text => doc.to_s, :content_type => "text/xml" - - #exit when we have too many requests - if @@count > MAX_COUNT - @@count = COUNT - - exit! - end end # Get a list of the tiles that have changed within a specified time @@ -225,7 +205,7 @@ class ApiController < ApplicationController endtime = Time.parse(params[:end]) else hours = (params[:hours] || '1').to_i.hours - endtime = Time.now + endtime = Time.now.getutc starttime = endtime - hours end @@ -284,6 +264,9 @@ class ApiController < ApplicationController waynodes = XML::Node.new 'waynodes' waynodes['maximum'] = APP_CONFIG['max_number_of_way_nodes'].to_s api << waynodes + changesets = XML::Node.new 'changesets' + changesets['maximum_elements'] = Changeset::MAX_ELEMENTS.to_s + api << changesets doc.root << api