[openstreetmap-website] Announce Overpass API as download mirror (#635)

Roland Olbricht notifications at github.com
Fri Dec 6 16:43:03 UTC 2013


When trying to use the export tab on a typical European city, the user is left with a blank screen in its browser, e.g.

Bonn, Germany
http://www.openstreetmap.org/export#map=14/50.7345/7.0999

Birmingham, UK
http://www.openstreetmap.org/export#map=14/52.4950/-1.8813

Grenoble, France
http://www.openstreetmap.org/export#map=15/45.1841/5.7154

To ameliorate this situation, the following patch shows for in particular zoom level 12 to 15 (and for clarity of code also all other zoom levels) a bbox adapted link to Overpass API:

```
>From 664c73b7c6a460b3690385b53a588609ff2142ee Mon Sep 17 00:00:00 2001
From: Roland Olbricht <roland.olbricht at gmx.de>
Date: Fri, 6 Dec 2013 16:11:37 +0100
Subject: [PATCH 1/2] Show a download link to Overpass API that follows the
 coordinates.

---
 app/assets/javascripts/index/export.js |    3 +++
 app/views/site/export.html.erb         |    5 +++++
 config/locales/en.yml                  |    3 +++
 3 files changed, 11 insertions(+)

diff --git a/app/assets/javascripts/index/export.js b/app/assets/javascripts/index/export.js
index 053f516..0e39229 100644
--- a/app/assets/javascripts/index/export.js
+++ b/app/assets/javascripts/index/export.js
@@ -41,6 +41,9 @@ OSM.Export = function(map) {
     $("#minlat").val(bounds.getSouth().toFixed(precision));
     $("#maxlon").val(bounds.getEast().toFixed(precision));
     $("#maxlat").val(bounds.getNorth().toFixed(precision));
+
+    document.getElementById("overpass-export").href = "http://overpass-api.de/api/map?bbox="
+        + $("#minlon").val() + "," + $("#minlat").val() + "," + $("#maxlon").val() + "," + $("#maxlat").val();
   }
 
   function validateControls() {
diff --git a/app/views/site/export.html.erb b/app/views/site/export.html.erb
index 1765072..8266ef8 100644
--- a/app/views/site/export.html.erb
+++ b/app/views/site/export.html.erb
@@ -45,4 +45,9 @@
   <div class="export_button">
     <%= submit_tag t('export.start.export_button'), :id => "export_commit" %>
   </div>
+
+  <br/>
+  <dt><a id="overpass-export" href="http://overpass-api.de/api/map?bbox="><%= t'export.start.too_large.overpass.title' %></a></dt>
+  <dd><%= t'export.start.too_large.overpass.description' %></dd>
+
 <% end %>
diff --git a/config/locales/en.yml b/config/locales/en.yml
index a1c4e50..f220336 100644
--- a/config/locales/en.yml
+++ b/config/locales/en.yml
@@ -315,6 +315,9 @@ en:
         planet:
           title: "Planet OSM"
           description: "Regularly-updated copies of the complete OpenStreetMap database"
+        overpass:
+          title: "This bounding box from Overpass API mirror"
+          description: "Download this bounding box from an OSM data mirror server"
         geofabrik:
           title: "Geofabrik Downloads"
           description: "Regularly-updated extracts of continents, countries, and selected cities"
-- 
1.7.9.5
```

This second patch makes the text's placement a little bit more pretty:

```
>From ac856e55b0c076518ddb40eaf1219f5fc7054737 Mon Sep 17 00:00:00 2001
From: Roland Olbricht <roland.olbricht at gmx.de>
Date: Fri, 6 Dec 2013 17:33:31 +0100
Subject: [PATCH 2/2] Adjusted information text to another position.

---
 app/views/site/export.html.erb |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/app/views/site/export.html.erb b/app/views/site/export.html.erb
index 8266ef8..edf17ba 100644
--- a/app/views/site/export.html.erb
+++ b/app/views/site/export.html.erb
@@ -47,7 +47,9 @@
   </div>
 
   <br/>
-  <dt><a id="overpass-export" href="http://overpass-api.de/api/map?bbox="><%= t'export.start.too_large.overpass.title' %></a></dt>
-  <dd><%= t'export.start.too_large.overpass.description' %></dd>
+  <dl class="export_mirror">
+    <dt><a id="overpass-export" href="http://overpass-api.de/api/map?bbox="><%= t'export.start.too_large.overpass.title' %></a></dt>
+    <dd><%= t'export.start.too_large.overpass.description' %></dd>
+  </dl>
 
 <% end %>
-- 
1.7.9.5
```


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


More information about the rails-dev mailing list