X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/d6e047d7d45ea76d56dccb53cc1fe1f5b54734d5..3e9ceb0c3816a1e13c82914d16abf2997b482751:/app/controllers/api_controller.rb
diff --git a/app/controllers/api_controller.rb b/app/controllers/api_controller.rb
index 6b36b41ae..f7c9f591f 100644
--- a/app/controllers/api_controller.rb
+++ b/app/controllers/api_controller.rb
@@ -11,10 +11,10 @@ class ApiController < ApplicationController
@@count = COUNT
# The maximum area you're allowed to request, in square degrees
- MAX_REQUEST_AREA = 0.25
+ MAX_REQUEST_AREA = APP_CONFIG['max_request_area']
# Number of GPS trace/trackpoints returned per-page
- TRACEPOINTS_PER_PAGE = 5000
+ TRACEPOINTS_PER_PAGE = APP_CONFIG['tracepoints_per_page']
def trackpoints
@@ -109,6 +109,7 @@ class ApiController < ApplicationController
return
end
+ # FIXME um why is this area using a different order for the lat/lon from above???
@nodes = Node.find_by_area(min_lat, min_lon, max_lat, max_lon, :conditions => "visible = 1", :limit => APP_CONFIG['max_number_of_nodes']+1)
# get all the nodes, by tag not yet working, waiting for change from NickB
# need to be @nodes (instance var) so tests in /spec can be performed
@@ -116,11 +117,11 @@ class ApiController < ApplicationController
node_ids = @nodes.collect(&:id)
if node_ids.length > APP_CONFIG['max_number_of_nodes']
- report_error("You requested too many nodes (limit is 50,000). Either request a smaller area, or use planet.osm")
+ report_error("You requested too many nodes (limit is #{APP_CONFIG['max_number_of_nodes']}). Either request a smaller area, or use planet.osm")
return
end
if node_ids.length == 0
- render :text => "", :content_type => "text/xml"
+ render :text => "", :content_type => "text/xml"
return
end
@@ -245,7 +246,7 @@ class ApiController < ApplicationController
render :text => doc.to_s, :content_type => "text/xml"
else
- render :nothing => true, :status => :bad_request
+ render :text => "Requested zoom is invalid", :status => :bad_request
end
end
@@ -254,12 +255,15 @@ class ApiController < ApplicationController
api = XML::Node.new 'api'
version = XML::Node.new 'version'
- version['minimum'] = '0.5';
- version['maximum'] = '0.5';
+ version['minimum'] = "#{API_VERSION}";
+ version['maximum'] = "#{API_VERSION}";
api << version
area = XML::Node.new 'area'
area['maximum'] = MAX_REQUEST_AREA.to_s;
api << area
+ tracepoints = XML::Node.new 'tracepoints'
+ tracepoints['per_page'] = APP_CONFIG['tracepoints_per_page'].to_s
+ api << tracepoints
doc.root << api