From: Richard Fairhurst Date: Sat, 5 May 2007 18:46:10 +0000 (+0000) Subject: Potlatch whichways and getway. These aren't really Rails, they're just SQL grafted... X-Git-Tag: live~8521 X-Git-Url: https://git.openstreetmap.org/rails.git/commitdiff_plain/e5a5f957ef46d76ec78e2c0450b50a086dff82b6?ds=sidebyside Potlatch whichways and getway. These aren't really Rails, they're just SQL grafted on... --- diff --git a/app/controllers/amf_controller.rb b/app/controllers/amf_controller.rb index f4f762a39..38c567734 100644 --- a/app/controllers/amf_controller.rb +++ b/app/controllers/amf_controller.rb @@ -6,6 +6,10 @@ class AmfController < ApplicationController # - user authentication # - (also pass lat/lon through from view tab to edit tab) +# to log: +# RAILS_DEFAULT_LOGGER.error("Args: #{args[0]}, #{args[1]}, #{args[2]}, #{args[3]}") + + # ==================================================================== # Main AMF handler @@ -89,11 +93,56 @@ class AmfController < ApplicationController end def whichways(args) - # to do + waylist=WaySegment.find_by_sql("SELECT DISTINCT current_way_segments.id AS wayid"+ + " FROM current_way_segments,current_segments,current_nodes "+ + " WHERE segment_id=current_segments.id "+ + " AND node_a=current_nodes.id "+ + " AND (latitude BETWEEN "+(args[1].to_f-0.01).to_s+" AND "+(args[3].to_f+0.01).to_s+") "+ + " AND (longitude BETWEEN "+(args[0].to_f-0.01).to_s+" AND "+(args[2].to_f+0.01).to_s+")") + ways=[] + waylist.each {|a| + ways<