From: Frederik Ramm Date: Mon, 14 Dec 2009 21:29:00 +0000 (+0000) Subject: this is kind of a "suggested change" for the API controller to X-Git-Tag: live~6427 X-Git-Url: https://git.openstreetmap.org/rails.git/commitdiff_plain/fb912fba71bfe34d2196ee52894ea453ef20e128 this is kind of a "suggested change" for the API controller to support an additional "restriction" parameter for the "map" call (only value currently supported: nodes_only to return only nodes). i would have liked to implement "tagged_nodes_only" as well but was unsure how to do that best. feel free to make up some other way instead to improve node access for POI editors, or drop this altogether if you have some other grand plan. --- diff --git a/app/controllers/api_controller.rb b/app/controllers/api_controller.rb index 3e9e627db..f84ae1076 100644 --- a/app/controllers/api_controller.rb +++ b/app/controllers/api_controller.rb @@ -144,6 +144,11 @@ class ApiController < ApplicationController return end + if param[:restriction] and param[:restriction] != "nodes_only" + report_error("The parameter restriction may only take one of the following values: nodes_only") + 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 => true}, :include => :node_tags, :limit => APP_CONFIG['max_number_of_nodes']+1) # get all the nodes, by tag not yet working, waiting for change from NickB @@ -170,6 +175,14 @@ class ApiController < ApplicationController bounds['maxlon'] = max_lon.to_s doc.root << bounds + # bail out at this stage if user has indicated that he is + # not interested in ways or relations. + if params[:restriction] == "nodes_only" + response.headers["Content-Disposition"] = "attachment; filename=\"map.osm\"" + render :text => doc.to_s, :content_type => "text/xml" + return + end + # get ways # find which ways are needed ways = Array.new