]> git.openstreetmap.org Git - rails.git/blobdiff - app/controllers/amf_controller.rb
Merge data browser branch to trunk.
[rails.git] / app / controllers / amf_controller.rb
index 4eda7b00aa27456b246ee1b4d16ce39f4abba712..11ddc3f7c7ba8fe9148fc4e9f65ae3ec47948d86 100644 (file)
@@ -123,7 +123,9 @@ class AmfController < ApplicationController
     points = nodes_not_used_in_area.collect { |n| [n.id, n.lon_potlatch(baselong,masterscale), n.lat_potlatch(basey,masterscale), n.tags_as_hash] }
 
     # find the relations used by those nodes and ways
-    relation_ids = (Relation.find_for_nodes_and_ways(nodes_in_area.collect {|n| n.id}, way_ids)).collect {|n| n.id}.uniq
+    relations = nodes_in_area.collect { |node| node.containing_relations.visible }.flatten +
+                way_ids.collect { |id| Way.find(id).containing_relations.visible }.flatten
+    relation_ids = relations.collect { |relation| relation.id }.uniq
 
     [way_ids,points,relation_ids]
   end
@@ -376,10 +378,11 @@ class AmfController < ApplicationController
 
     RAILS_DEFAULT_LOGGER.info("  Message: putway, id=#{originalway}")
 
-    # -- Check for null IDs or short ways
+    # -- Check for null IDs, short ways or lats=90
 
     points.each do |a|
       if a[2]==0 or a[2].nil? then return -2,"Server error - node with id 0 found in way #{originalway}." end
+      if coord2lat(a[1],masterscale,basey)==90 then return -2,"Server error - node with lat -90 found in way #{originalway}." end
     end
     
     if points.length<2 then return -2,"Server error - way is only #{points.length} points long." end