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

@ -108,6 +108,21 @@ module OSM
:status => :bad_request }
end
end
# Raised when a way has more than the configured number of way nodes.
# This prevents ways from being to long and difficult to work with
class APITooManyWayNodesError < APIError
def initialize(provided, max)
@provided, @max = provided, max
end
attr_reader :provided, :max
def render_opts
{ :text => "You tried to add #{provided} nodes to the way, however only #{max} are allowed",
:status => :bad_request }
end
end
# Helper methods for going to/from mercator and lat/lng.
class Mercator