[openstreetmap-website] Redirect too large map calls (#632)

Roland Olbricht notifications at github.com
Fri Dec 6 07:19:12 UTC 2013


Instead of responding to ovesized map calls with an error message, we could do a redirect to Overpass. Please see the patch below:


>From fb1631fef0decf1122f486df8c14721fa3866162 Mon Sep 17 00:00:00 2001
From: Roland Olbricht <roland.olbricht at gmx.de>
Date: Fri, 6 Dec 2013 08:13:43 +0100
Subject: [PATCH] Redirect oversized map calls.

---
 app/controllers/api_controller.rb |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/app/controllers/api_controller.rb b/app/controllers/api_controller.rb
index 2c442c1..a826dff 100644
--- a/app/controllers/api_controller.rb
+++ b/app/controllers/api_controller.rb
@@ -131,7 +131,7 @@ class ApiController < ApplicationController
 
     node_ids = @nodes.collect(&:id)
     if node_ids.length > MAX_NUMBER_OF_NODES
-      report_error("You requested too many nodes (limit is #{MAX_NUMBER_OF_NODES}). Either request a smaller area, or use planet.osm")
+      redirect_to "http://overpass-api.de/api/map?bbox=#{bbox.min_lon},#{bbox.min_lat},#{bbox.max_lon},#{bbox.max_lat}"
       return
     end
     if node_ids.length == 0
-- 
1.7.9.5


---
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/issues/632
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20131205/91c20341/attachment.html>


More information about the rails-dev mailing list