Adding a restriction to prevent more than 2000 nodes to be added to any way. Tests still need to be written. Capabilities api request also updated.

This commit is contained in:
Shaun McDonald 2008-11-03 00:12:18 +00:00
parent 7418fc7e86
commit 635daf1773
4 changed files with 24 additions and 1 deletions

View file

@ -281,6 +281,9 @@ class ApiController < ApplicationController
tracepoints = XML::Node.new 'tracepoints'
tracepoints['per_page'] = APP_CONFIG['tracepoints_per_page'].to_s
api << tracepoints
waynodes = XML::Node.new 'waynodes'
waynodes['maximum'] = APP_CONFIG['max_number_of_way_nodes'].to_s
api << waynodes
doc.root << api

View file

@ -238,6 +238,9 @@ class Way < ActiveRecord::Base
def preconditions_ok?
return false if self.nds.empty?
if self.nds.length > APP_CONFIG['max_number_of_way_nodes']
raise OSM::APITooManyWayNodesError.new(self.nds.count, APP_CONFIG['max_number_of_way_nodes'])
end
self.nds.each do |n|
node = Node.find(:first, :conditions => ["id = ?", n])
unless node and node.visible