[openstreetmap-website] allow to export notes through osm.org (#427)
Markus Heidelberg
notifications at github.com
Tue Jul 28 22:10:59 UTC 2015
Here is a rudimentary patch, which adds a drop-down list into the 'Export' site. Now you can select between different formats, OSM XML being the default as before, additionally Notes in the four supported formats.
This also has the beneficial side effect that now one knows that OSM XML data will be exported. This wasn't clear to me before pressing the Export button to start the download.
I don't have the time and surely am lacking some web development skills to bring it forward in the near future, but maybe it is a starting point for someone else.
```patch
diff --git a/app/controllers/export_controller.rb b/app/controllers/export_controller.rb
index bd020f2..ee9f8d3 100644
--- a/app/controllers/export_controller.rb
+++ b/app/controllers/export_controller.rb
@@ -13,6 +13,22 @@ class ExportController < ApplicationController
# redirect to API map get
redirect_to "http://api.openstreetmap.org/api/#{API_VERSION}/map?bbox=#{bbox}"
+ elsif format == "notes_rss"
+ # redirect to API notes get
+ redirect_to "http://api.openstreetmap.org/api/#{API_VERSION}/notes.rss?bbox=#{bbox}&limit=10000"
+
+ elsif format == "notes_xml"
+ # redirect to API notes get
+ redirect_to "http://api.openstreetmap.org/api/#{API_VERSION}/notes.xml?bbox=#{bbox}&limit=10000"
+
+ elsif format == "notes_json"
+ # redirect to API notes get
+ redirect_to "http://api.openstreetmap.org/api/#{API_VERSION}/notes.json?bbox=#{bbox}&limit=10000"
+
+ elsif format == "notes_gpx"
+ # redirect to API notes get
+ redirect_to "http://api.openstreetmap.org/api/#{API_VERSION}/notes.gpx?bbox=#{bbox}&limit=10000"
+
elsif format == "mapnik"
# redirect to a special 'export' cgi script
format = params[:mapnik_format]
diff --git a/app/views/site/export.html.erb b/app/views/site/export.html.erb
index 6bf3365..68ef08e 100644
--- a/app/views/site/export.html.erb
+++ b/app/views/site/export.html.erb
@@ -6,7 +6,6 @@
</h2>
<%= form_tag({:controller => "export", :action => "finish"}, :class => "export_form") do %>
- <%= hidden_field_tag 'format', 'osm' %>
<div class='export_area_inputs'>
<div class='export_boxy' style="border: 1px solid #ccc;">
@@ -29,6 +28,17 @@
</p>
</div>
+ <div>
+ <label for="format">Data type:</label>
+ <select id="format" name="format">
+ <option value="osm">Map data (OSM XML)</option>
+ <option value="notes_rss">Notes (RSS)</option>
+ <option value="notes_xml">Notes (XML)</option>
+ <option value="notes_json">Notes (JSON)</option>
+ <option value="notes_gpx">Notes (GPX)</option>
+ </select>
+ </div>
+
<div id="export_commit">
<div class="export_button">
<%= submit_tag t('export.start.export_button') %>
```
Before (original):

After (with selection):

---
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/issues/427#issuecomment-125767779
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20150728/6dd3c83c/attachment.html>
More information about the rails-dev
mailing list