orn = renumberednodes.dup
result = putway(renumberednodes, *args)
result[4] = renumberednodes.reject { |k, _v| orn.key?(k) }
renumberedways[result[2]] = result[3] if result[0].zero? && result[2] != result[3]
orn = renumberednodes.dup
result = putway(renumberednodes, *args)
result[4] = renumberednodes.reject { |k, _v| orn.key?(k) }
renumberedways[result[2]] = result[3] if result[0].zero? && result[2] != result[3]
- def amf_handle_error_with_timeout(call, rootobj, rootid)
+ def amf_handle_error_with_timeout(call, rootobj, rootid, &block)
deletednodes.each do |id, v|
node = Node.find(id.to_i)
new_node = Node.new
deletednodes.each do |id, v|
node = Node.find(id.to_i)
new_node = Node.new
deletednodes.each do |id, v|
node = Node.find(id.to_i)
new_node = Node.new
deletednodes.each do |id, v|
node = Node.find(id.to_i)
new_node = Node.new
User.authenticate(:username => Regexp.last_match(1), :password => Regexp.last_match(2))
else
User.authenticate(:token => token)
User.authenticate(:username => Regexp.last_match(1), :password => Regexp.last_match(2))
else
User.authenticate(:token => token)
- @getlocales ||= Locale.list(Dir.glob(Rails.root.join("config", "potlatch", "locales", "*")).collect { |f| File.basename(f, ".yml") })
+ @getlocales ||= Locale.list(Dir.glob(Rails.root.join("config/potlatch/locales/*")).collect { |f| File.basename(f, ".yml") })
- 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
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 = []
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
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
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
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
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
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
- 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(',')})
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}
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}