X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/57f5b7840e540fd8b2240fe7786e989fb2f829af..bf9dd8f350ca1b54afb79dda79506d980ccb5738:/app/controllers/api/amf_controller.rb?ds=sidebyside diff --git a/app/controllers/api/amf_controller.rb b/app/controllers/api/amf_controller.rb index 4dbc16fd2..db8982d43 100644 --- a/app/controllers/api/amf_controller.rb +++ b/app/controllers/api/amf_controller.rb @@ -906,21 +906,21 @@ module Api # Alternative SQL queries for getway/whichways def sql_find_ways_in_area(bbox) - sql = <<-SQL - SELECT DISTINCT current_ways.id AS wayid,current_ways.version AS version - FROM current_way_nodes - INNER JOIN current_nodes ON current_nodes.id=current_way_nodes.node_id - INNER JOIN current_ways ON current_ways.id =current_way_nodes.id - WHERE current_nodes.visible=TRUE - AND current_ways.visible=TRUE - AND #{OSM.sql_for_area(bbox, 'current_nodes.')} + sql = <<~SQL + SELECT DISTINCT current_ways.id AS wayid,current_ways.version AS version + FROM current_way_nodes + INNER JOIN current_nodes ON current_nodes.id=current_way_nodes.node_id + INNER JOIN current_ways ON current_ways.id =current_way_nodes.id + WHERE current_nodes.visible=TRUE + AND current_ways.visible=TRUE + AND #{OSM.sql_for_area(bbox, 'current_nodes.')} SQL ActiveRecord::Base.connection.select_all(sql).collect { |a| [a["wayid"].to_i, a["version"].to_i] } end def sql_find_pois_in_area(bbox) pois = [] - sql = <<-SQL + sql = <<~SQL SELECT current_nodes.id,current_nodes.latitude*0.0000001 AS lat,current_nodes.longitude*0.0000001 AS lon,current_nodes.version FROM current_nodes LEFT OUTER JOIN current_way_nodes cwn ON cwn.node_id=current_nodes.id @@ -941,7 +941,7 @@ module Api def sql_find_relations_in_area_and_ways(bbox, way_ids) # ** It would be more Potlatchy to get relations for nodes within ways # during 'getway', not here - sql = <<-SQL + sql = <<~SQL SELECT DISTINCT cr.id AS relid,cr.version AS version FROM current_relations cr INNER JOIN current_relation_members crm ON crm.id=cr.id @@ -949,13 +949,13 @@ module Api WHERE #{OSM.sql_for_area(bbox, 'cn.')} SQL unless way_ids.empty? - sql += <<-SQL - UNION - SELECT DISTINCT cr.id AS relid,cr.version AS version - FROM current_relations cr - INNER JOIN current_relation_members crm ON crm.id=cr.id - WHERE crm.member_type='Way' - AND crm.member_id IN (#{way_ids.join(',')}) + sql += <<~SQL + UNION + SELECT DISTINCT cr.id AS relid,cr.version AS version + FROM current_relations cr + INNER JOIN current_relation_members crm ON crm.id=cr.id + WHERE crm.member_type='Way' + AND crm.member_id IN (#{way_ids.join(',')}) SQL end ActiveRecord::Base.connection.select_all(sql).collect { |a| [a["relid"].to_i, a["version"].to_i] } @@ -963,7 +963,7 @@ module Api def sql_get_nodes_in_way(wayid) points = [] - sql = <<-SQL + sql = <<~SQL SELECT latitude*0.0000001 AS lat,longitude*0.0000001 AS lon,current_nodes.id,current_nodes.version FROM current_way_nodes,current_nodes WHERE current_way_nodes.id=#{wayid.to_i}