]> git.openstreetmap.org Git - rails.git/commitdiff
Merge remote-tracking branch 'upstream/pull/2223'
authorTom Hughes <tom@compton.nu>
Sun, 7 Jul 2019 15:14:32 +0000 (16:14 +0100)
committerTom Hughes <tom@compton.nu>
Sun, 7 Jul 2019 15:14:32 +0000 (16:14 +0100)
31 files changed:
app/controllers/api/map_controller.rb
app/controllers/api/nodes_controller.rb
app/controllers/api/old_controller.rb
app/controllers/api/relations_controller.rb
app/controllers/api/ways_controller.rb
app/views/api/map/_bounds.xml.builder [new file with mode: 0644]
app/views/api/map/index.xml.builder [new file with mode: 0644]
app/views/api/nodes/_node.xml.builder [new file with mode: 0644]
app/views/api/nodes/index.xml.builder [new file with mode: 0644]
app/views/api/nodes/show.xml.builder [new file with mode: 0644]
app/views/api/old_nodes/_old_node.xml.builder [new file with mode: 0644]
app/views/api/old_nodes/history.xml.builder [new file with mode: 0644]
app/views/api/old_nodes/version.xml.builder [new file with mode: 0644]
app/views/api/old_relations/_old_relation.xml.builder [new file with mode: 0644]
app/views/api/old_relations/history.xml.builder [new file with mode: 0644]
app/views/api/old_relations/version.xml.builder [new file with mode: 0644]
app/views/api/old_ways/_old_way.xml.builder [new file with mode: 0644]
app/views/api/old_ways/history.xml.builder [new file with mode: 0644]
app/views/api/old_ways/version.xml.builder [new file with mode: 0644]
app/views/api/relations/_relation.xml.builder [new file with mode: 0644]
app/views/api/relations/full.xml.builder [new file with mode: 0644]
app/views/api/relations/index.xml.builder [new file with mode: 0644]
app/views/api/relations/relations_for_node.xml.builder [new file with mode: 0644]
app/views/api/relations/relations_for_relation.xml.builder [new file with mode: 0644]
app/views/api/relations/relations_for_way.xml.builder [new file with mode: 0644]
app/views/api/relations/show.xml.builder [new file with mode: 0644]
app/views/api/ways/_way.xml.builder [new file with mode: 0644]
app/views/api/ways/full.xml.builder [new file with mode: 0644]
app/views/api/ways/index.xml.builder [new file with mode: 0644]
app/views/api/ways/show.xml.builder [new file with mode: 0644]
app/views/api/ways/ways_for_node.xml.builder [new file with mode: 0644]

index e1d1a3b37844878661c9458fd41dd282a3396b81..b0998f7ebaa9aa6ae49f8aa125f0583f5353049e 100644 (file)
@@ -19,15 +19,15 @@ module Api
       # check boundary is sane and area within defined
       # see /config/application.yml
       begin
-        bbox = BoundingBox.from_bbox_params(params)
-        bbox.check_boundaries
-        bbox.check_size
+        @bounds = BoundingBox.from_bbox_params(params)
+        @bounds.check_boundaries
+        @bounds.check_size
       rescue StandardError => e
         report_error(e.message)
         return
       end
 
-      nodes = Node.bbox(bbox).where(:visible => true).includes(:node_tags).limit(Settings.max_number_of_nodes + 1)
+      nodes = Node.bbox(@bounds).where(:visible => true).includes(:node_tags).limit(Settings.max_number_of_nodes + 1)
 
       node_ids = nodes.collect(&:id)
       if node_ids.length > Settings.max_number_of_nodes
@@ -35,11 +35,6 @@ module Api
         return
       end
 
-      doc = OSM::API.new.get_xml_doc
-
-      # add bounds
-      doc.root << bbox.add_bounds_to(XML::Node.new("bounds"))
-
       # get ways
       # find which ways are needed
       ways = []
@@ -62,43 +57,40 @@ module Api
       nodes += Node.includes(:node_tags).find(nodes_to_fetch) unless nodes_to_fetch.empty?
 
       visible_nodes = {}
-      changeset_cache = {}
-      user_display_name_cache = {}
-
+      @nodes = []
       nodes.each do |node|
         if node.visible?
-          doc.root << node.to_xml_node(changeset_cache, user_display_name_cache)
           visible_nodes[node.id] = node
+          @nodes << node
         end
       end
 
+      @ways = []
       way_ids = []
       ways.each do |way|
         if way.visible?
-          doc.root << way.to_xml_node(visible_nodes, changeset_cache, user_display_name_cache)
           way_ids << way.id
+          @ways << way
         end
       end
 
-      relations = Relation.nodes(visible_nodes.keys).visible +
-                  Relation.ways(way_ids).visible
+      @relations = Relation.nodes(visible_nodes.keys).visible +
+                   Relation.ways(way_ids).visible
 
       # we do not normally return the "other" partners referenced by an relation,
       # e.g. if we return a way A that is referenced by relation X, and there's
       # another way B also referenced, that is not returned. But we do make
       # an exception for cases where an relation references another *relation*;
       # in that case we return that as well (but we don't go recursive here)
-      relations += Relation.relations(relations.collect(&:id)).visible
+      @relations += Relation.relations(@relations.collect(&:id)).visible
 
       # this "uniq" may be slightly inefficient; it may be better to first collect and output
       # all node-related relations, then find the *not yet covered* way-related ones etc.
-      relations.uniq.each do |relation|
-        doc.root << relation.to_xml_node(changeset_cache, user_display_name_cache)
-      end
+      @relations.uniq!
 
       response.headers["Content-Disposition"] = "attachment; filename=\"map.osm\""
-
-      render :xml => doc.to_s
+      # Render the result
+      render :formats => [:xml]
     end
   end
 end
index 5218159c16097f61b921e07d63d0ea7cee1ff601..2962ce070ffe15ebf1cd98f43cb66adaa568c767 100644 (file)
@@ -26,12 +26,13 @@ module Api
 
     # Dump the details on a node given in params[:id]
     def show
-      node = Node.find(params[:id])
+      @node = Node.find(params[:id])
 
-      response.last_modified = node.timestamp
+      response.last_modified = @node.timestamp
 
-      if node.visible
-        render :xml => node.to_xml.to_s
+      if @node.visible
+        # Render the result
+        render :formats => [:xml]
       else
         head :gone
       end
@@ -69,13 +70,10 @@ module Api
 
       raise OSM::APIBadUserInput, "No nodes were given to search for" if ids.empty?
 
-      doc = OSM::API.new.get_xml_doc
-
-      Node.find(ids).each do |node|
-        doc.root << node.to_xml_node
-      end
+      @nodes = Node.find(ids)
 
-      render :xml => doc.to_s
+      # Render the result
+      render :formats => [:xml]
     end
   end
 end
index fa2b5814e49a400a5b22fd95d5d287812bb4fb29..862d14716f9b12e34c25e6629ada8d1b7e16b8e2 100644 (file)
@@ -22,19 +22,15 @@ module Api
       # to do that ourselves.
       raise OSM::APINotFoundError if @elements.empty?
 
-      doc = OSM::API.new.get_xml_doc
-
-      visible_elements = if show_redactions?
-                           @elements
-                         else
-                           @elements.unredacted
-                         end
-
-      visible_elements.each do |element|
-        doc.root << element.to_xml_node
-      end
-
-      render :xml => doc.to_s
+      # determine visible elements
+      @elems = if show_redactions?
+                 @elements
+               else
+                 @elements.unredacted
+               end
+
+      # Render the result
+      render :formats => [:xml]
     end
 
     def version
@@ -44,10 +40,8 @@ module Api
       else
         response.last_modified = @old_element.timestamp
 
-        doc = OSM::API.new.get_xml_doc
-        doc.root << @old_element.to_xml_node
-
-        render :xml => doc.to_s
+        # Render the result
+        render :formats => [:xml]
       end
     end
 
index b7d990c3d3570321d21614afc1ef94293d39055b..ba0dd0c6bb99ae870211f19568b3ad8445dc434c 100644 (file)
@@ -22,10 +22,11 @@ module Api
     end
 
     def show
-      relation = Relation.find(params[:id])
-      response.last_modified = relation.timestamp
-      if relation.visible
-        render :xml => relation.to_xml.to_s
+      @relation = Relation.find(params[:id])
+      response.last_modified = @relation.timestamp
+      if @relation.visible
+        # Render the result
+        render :formats => [:xml]
       else
         head :gone
       end
@@ -88,35 +89,35 @@ module Api
         node_ids += way_node_ids.flatten
         nodes = Node.where(:id => node_ids.uniq).includes(:node_tags)
 
-        # create XML.
-        doc = OSM::API.new.get_xml_doc
         visible_nodes = {}
-        changeset_cache = {}
-        user_display_name_cache = {}
 
+        @nodes = []
         nodes.each do |node|
           next unless node.visible? # should be unnecessary if data is consistent.
 
-          doc.root << node.to_xml_node(changeset_cache, user_display_name_cache)
+          @nodes << node
           visible_nodes[node.id] = node
         end
 
+        @ways = []
         ways.each do |way|
           next unless way.visible? # should be unnecessary if data is consistent.
 
-          doc.root << way.to_xml_node(visible_nodes, changeset_cache, user_display_name_cache)
+          @ways << way
         end
 
+        @relations = []
         relations.each do |rel|
           next unless rel.visible? # should be unnecessary if data is consistent.
 
-          doc.root << rel.to_xml_node(changeset_cache, user_display_name_cache)
+          @relations << rel
         end
 
-        # finally add self and output
-        doc.root << relation.to_xml_node(changeset_cache, user_display_name_cache)
-        render :xml => doc.to_s
+        # finally add self
+        @relations << relation
 
+        # Render the result
+        render :formats => [:xml]
       else
         head :gone
       end
@@ -129,13 +130,10 @@ module Api
 
       raise OSM::APIBadUserInput, "No relations were given to search for" if ids.empty?
 
-      doc = OSM::API.new.get_xml_doc
-
-      Relation.find(ids).each do |relation|
-        doc.root << relation.to_xml_node
-      end
+      @relations = Relation.find(ids)
 
-      render :xml => doc.to_s
+      # Render the result
+      render :formats => [:xml]
     end
 
     def relations_for_way
@@ -155,13 +153,14 @@ module Api
     def relations_for_object(objtype)
       relationids = RelationMember.where(:member_type => objtype, :member_id => params[:id]).collect(&:relation_id).uniq
 
-      doc = OSM::API.new.get_xml_doc
+      @relations = []
 
       Relation.find(relationids).each do |relation|
-        doc.root << relation.to_xml_node if relation.visible
+        @relations << relation if relation.visible
       end
 
-      render :xml => doc.to_s
+      # Render the result
+      render :formats => [:xml]
     end
   end
 end
index 5e3e5e11ab1d511dea0882b5c455fa59c520f25b..9af087d83a31fb06de92ce0a5718f9aa10225cd7 100644 (file)
@@ -22,12 +22,13 @@ module Api
     end
 
     def show
-      way = Way.find(params[:id])
+      @way = Way.find(params[:id])
 
-      response.last_modified = way.timestamp
+      response.last_modified = @way.timestamp
 
-      if way.visible
-        render :xml => way.to_xml.to_s
+      if @way.visible
+        # Render the result
+        render :formats => [:xml]
       else
         head :gone
       end
@@ -59,23 +60,22 @@ module Api
     end
 
     def full
-      way = Way.includes(:nodes => :node_tags).find(params[:id])
+      @way = Way.includes(:nodes => :node_tags).find(params[:id])
 
-      if way.visible
+      if @way.visible
         visible_nodes = {}
-        changeset_cache = {}
-        user_display_name_cache = {}
 
-        doc = OSM::API.new.get_xml_doc
-        way.nodes.uniq.each do |node|
+        @nodes = []
+
+        @way.nodes.uniq.each do |node|
           if node.visible
-            doc.root << node.to_xml_node(changeset_cache, user_display_name_cache)
+            @nodes << node
             visible_nodes[node.id] = node
           end
         end
-        doc.root << way.to_xml_node(visible_nodes, changeset_cache, user_display_name_cache)
 
-        render :xml => doc.to_s
+        # Render the result
+        render :formats => [:xml]
       else
         head :gone
       end
@@ -90,13 +90,10 @@ module Api
 
       raise OSM::APIBadUserInput, "No ways were given to search for" if ids.empty?
 
-      doc = OSM::API.new.get_xml_doc
-
-      Way.find(ids).each do |way|
-        doc.root << way.to_xml_node
-      end
+      @ways = Way.find(ids)
 
-      render :xml => doc.to_s
+      # Render the result
+      render :formats => [:xml]
     end
 
     ##
@@ -106,13 +103,10 @@ module Api
     def ways_for_node
       wayids = WayNode.where(:node_id => params[:id]).collect { |ws| ws.id[0] }.uniq
 
-      doc = OSM::API.new.get_xml_doc
-
-      Way.find(wayids).each do |way|
-        doc.root << way.to_xml_node if way.visible
-      end
+      @ways = Way.where(:id => wayids, :visible => true)
 
-      render :xml => doc.to_s
+      # Render the result
+      render :formats => [:xml]
     end
   end
 end
diff --git a/app/views/api/map/_bounds.xml.builder b/app/views/api/map/_bounds.xml.builder
new file mode 100644 (file)
index 0000000..8a38e21
--- /dev/null
@@ -0,0 +1,8 @@
+attrs = {
+  "minlat" => format("%.7f", bounds.min_lat),
+  "minlon" => format("%.7f", bounds.min_lon),
+  "maxlat" => format("%.7f", bounds.max_lat),
+  "maxlon" => format("%.7f", bounds.max_lon)
+}
+
+xml.bounds(attrs)
diff --git a/app/views/api/map/index.xml.builder b/app/views/api/map/index.xml.builder
new file mode 100644 (file)
index 0000000..d7fb7e7
--- /dev/null
@@ -0,0 +1,8 @@
+xml.instruct!
+
+xml.osm(OSM::API.new.xml_root_attributes) do |osm|
+  osm << (render(:partial => "bounds", :object => @bounds) || "")
+  osm << (render(@nodes) || "")
+  osm << (render(@ways) || "")
+  osm << (render(@relations) || "")
+end
diff --git a/app/views/api/nodes/_node.xml.builder b/app/views/api/nodes/_node.xml.builder
new file mode 100644 (file)
index 0000000..4ced227
--- /dev/null
@@ -0,0 +1,24 @@
+attrs = {
+  "id" => node.id,
+  "visible" => node.visible,
+  "version" => node.version,
+  "changeset" => node.changeset_id,
+  "timestamp" => node.timestamp.xmlschema,
+  "user" => node.changeset.user.display_name,
+  "uid" => node.changeset.user_id
+}
+
+if node.visible
+  attrs["lat"] = node.lat
+  attrs["lon"] = node.lon
+end
+
+if node.tags.empty?
+  xml.node(attrs)
+else
+  xml.node(attrs) do |nd|
+    node.tags.each do |k, v|
+      nd.tag(:k => k, :v => v)
+    end
+  end
+end
diff --git a/app/views/api/nodes/index.xml.builder b/app/views/api/nodes/index.xml.builder
new file mode 100644 (file)
index 0000000..1968de9
--- /dev/null
@@ -0,0 +1,5 @@
+xml.instruct!
+
+xml.osm(OSM::API.new.xml_root_attributes) do |osm|
+  osm << (render(@nodes) || "")
+end
diff --git a/app/views/api/nodes/show.xml.builder b/app/views/api/nodes/show.xml.builder
new file mode 100644 (file)
index 0000000..48f7e31
--- /dev/null
@@ -0,0 +1,5 @@
+xml.instruct!
+
+xml.osm(OSM::API.new.xml_root_attributes) do |osm|
+  osm << (render(@node) || "")
+end
diff --git a/app/views/api/old_nodes/_old_node.xml.builder b/app/views/api/old_nodes/_old_node.xml.builder
new file mode 100644 (file)
index 0000000..2a8412a
--- /dev/null
@@ -0,0 +1,24 @@
+attrs = {
+  "id" => old_node.node_id,
+  "visible" => old_node.visible,
+  "version" => old_node.version,
+  "changeset" => old_node.changeset_id,
+  "timestamp" => old_node.timestamp.xmlschema,
+  "user" => old_node.changeset.user.display_name,
+  "uid" => old_node.changeset.user_id
+}
+
+if old_node.visible
+  attrs["lat"] = old_node.lat
+  attrs["lon"] = old_node.lon
+end
+
+if old_node.tags.empty?
+  xml.node(attrs)
+else
+  xml.node(attrs) do |nd|
+    old_node.tags.each do |k, v|
+      nd.tag(:k => k, :v => v)
+    end
+  end
+end
diff --git a/app/views/api/old_nodes/history.xml.builder b/app/views/api/old_nodes/history.xml.builder
new file mode 100644 (file)
index 0000000..905381c
--- /dev/null
@@ -0,0 +1,5 @@
+xml.instruct!
+
+xml.osm(OSM::API.new.xml_root_attributes) do |osm|
+  osm << (render(@elems) || "")
+end
diff --git a/app/views/api/old_nodes/version.xml.builder b/app/views/api/old_nodes/version.xml.builder
new file mode 100644 (file)
index 0000000..c7b630d
--- /dev/null
@@ -0,0 +1,5 @@
+xml.instruct!
+
+xml.osm(OSM::API.new.xml_root_attributes) do |osm|
+  osm << (render(@old_element) || "")
+end
diff --git a/app/views/api/old_relations/_old_relation.xml.builder b/app/views/api/old_relations/_old_relation.xml.builder
new file mode 100644 (file)
index 0000000..4485698
--- /dev/null
@@ -0,0 +1,19 @@
+attrs = {
+  "id" => old_relation.relation_id,
+  "visible" => old_relation.visible,
+  "version" => old_relation.version,
+  "changeset" => old_relation.changeset_id,
+  "timestamp" => old_relation.timestamp.xmlschema,
+  "user" => old_relation.changeset.user.display_name,
+  "uid" => old_relation.changeset.user_id
+}
+
+xml.relation(attrs) do |r|
+  old_relation.relation_members.each do |m|
+    r.member(:type => m.member_type.downcase, :ref => m.member_id, :role => m.member_role)
+  end
+
+  old_relation.tags.each do |k, v|
+    r.tag(:k => k, :v => v)
+  end
+end
diff --git a/app/views/api/old_relations/history.xml.builder b/app/views/api/old_relations/history.xml.builder
new file mode 100644 (file)
index 0000000..905381c
--- /dev/null
@@ -0,0 +1,5 @@
+xml.instruct!
+
+xml.osm(OSM::API.new.xml_root_attributes) do |osm|
+  osm << (render(@elems) || "")
+end
diff --git a/app/views/api/old_relations/version.xml.builder b/app/views/api/old_relations/version.xml.builder
new file mode 100644 (file)
index 0000000..c7b630d
--- /dev/null
@@ -0,0 +1,5 @@
+xml.instruct!
+
+xml.osm(OSM::API.new.xml_root_attributes) do |osm|
+  osm << (render(@old_element) || "")
+end
diff --git a/app/views/api/old_ways/_old_way.xml.builder b/app/views/api/old_ways/_old_way.xml.builder
new file mode 100644 (file)
index 0000000..246aea6
--- /dev/null
@@ -0,0 +1,19 @@
+attrs = {
+  "id" => old_way.way_id,
+  "visible" => old_way.visible,
+  "version" => old_way.version,
+  "changeset" => old_way.changeset_id,
+  "timestamp" => old_way.timestamp.xmlschema,
+  "user" => old_way.changeset.user.display_name,
+  "uid" => old_way.changeset.user_id
+}
+
+xml.way(attrs) do |w|
+  old_way.nds.each do |n|
+    w.nd(:ref => n)
+  end
+
+  old_way.tags.each do |k, v|
+    w.tag(:k => k, :v => v)
+  end
+end
diff --git a/app/views/api/old_ways/history.xml.builder b/app/views/api/old_ways/history.xml.builder
new file mode 100644 (file)
index 0000000..905381c
--- /dev/null
@@ -0,0 +1,5 @@
+xml.instruct!
+
+xml.osm(OSM::API.new.xml_root_attributes) do |osm|
+  osm << (render(@elems) || "")
+end
diff --git a/app/views/api/old_ways/version.xml.builder b/app/views/api/old_ways/version.xml.builder
new file mode 100644 (file)
index 0000000..c7b630d
--- /dev/null
@@ -0,0 +1,5 @@
+xml.instruct!
+
+xml.osm(OSM::API.new.xml_root_attributes) do |osm|
+  osm << (render(@old_element) || "")
+end
diff --git a/app/views/api/relations/_relation.xml.builder b/app/views/api/relations/_relation.xml.builder
new file mode 100644 (file)
index 0000000..f6059c0
--- /dev/null
@@ -0,0 +1,19 @@
+attrs = {
+  "id" => relation.id,
+  "visible" => relation.visible,
+  "version" => relation.version,
+  "changeset" => relation.changeset_id,
+  "timestamp" => relation.timestamp.xmlschema,
+  "user" => relation.changeset.user.display_name,
+  "uid" => relation.changeset.user_id
+}
+
+xml.relation(attrs) do |r|
+  relation.relation_members.each do |m|
+    r.member(:type => m.member_type.downcase, :ref => m.member_id, :role => m.member_role)
+  end
+
+  relation.tags.each do |k, v|
+    r.tag(:k => k, :v => v)
+  end
+end
diff --git a/app/views/api/relations/full.xml.builder b/app/views/api/relations/full.xml.builder
new file mode 100644 (file)
index 0000000..e230617
--- /dev/null
@@ -0,0 +1,7 @@
+xml.instruct!
+
+xml.osm(OSM::API.new.xml_root_attributes) do |osm|
+  osm << (render(@nodes) || "")
+  osm << (render(@ways) || "")
+  osm << (render(@relations) || "")
+end
diff --git a/app/views/api/relations/index.xml.builder b/app/views/api/relations/index.xml.builder
new file mode 100644 (file)
index 0000000..f39a20b
--- /dev/null
@@ -0,0 +1,5 @@
+xml.instruct!
+
+xml.osm(OSM::API.new.xml_root_attributes) do |osm|
+  osm << (render(@relations) || "")
+end
diff --git a/app/views/api/relations/relations_for_node.xml.builder b/app/views/api/relations/relations_for_node.xml.builder
new file mode 100644 (file)
index 0000000..f39a20b
--- /dev/null
@@ -0,0 +1,5 @@
+xml.instruct!
+
+xml.osm(OSM::API.new.xml_root_attributes) do |osm|
+  osm << (render(@relations) || "")
+end
diff --git a/app/views/api/relations/relations_for_relation.xml.builder b/app/views/api/relations/relations_for_relation.xml.builder
new file mode 100644 (file)
index 0000000..f39a20b
--- /dev/null
@@ -0,0 +1,5 @@
+xml.instruct!
+
+xml.osm(OSM::API.new.xml_root_attributes) do |osm|
+  osm << (render(@relations) || "")
+end
diff --git a/app/views/api/relations/relations_for_way.xml.builder b/app/views/api/relations/relations_for_way.xml.builder
new file mode 100644 (file)
index 0000000..f39a20b
--- /dev/null
@@ -0,0 +1,5 @@
+xml.instruct!
+
+xml.osm(OSM::API.new.xml_root_attributes) do |osm|
+  osm << (render(@relations) || "")
+end
diff --git a/app/views/api/relations/show.xml.builder b/app/views/api/relations/show.xml.builder
new file mode 100644 (file)
index 0000000..555eb4d
--- /dev/null
@@ -0,0 +1,5 @@
+xml.instruct!
+
+xml.osm(OSM::API.new.xml_root_attributes) do |osm|
+  osm << (render(@relation) || "")
+end
diff --git a/app/views/api/ways/_way.xml.builder b/app/views/api/ways/_way.xml.builder
new file mode 100644 (file)
index 0000000..9f2e772
--- /dev/null
@@ -0,0 +1,19 @@
+attrs = {
+  "id" => way.id,
+  "visible" => way.visible,
+  "version" => way.version,
+  "changeset" => way.changeset_id,
+  "timestamp" => way.timestamp.xmlschema,
+  "user" => way.changeset.user.display_name,
+  "uid" => way.changeset.user_id
+}
+
+xml.way(attrs) do |w|
+  way.nodes.each do |n|
+    w.nd(:ref => n.id)
+  end
+
+  way.tags.each do |k, v|
+    w.tag(:k => k, :v => v)
+  end
+end
diff --git a/app/views/api/ways/full.xml.builder b/app/views/api/ways/full.xml.builder
new file mode 100644 (file)
index 0000000..0252916
--- /dev/null
@@ -0,0 +1,6 @@
+xml.instruct!
+
+xml.osm(OSM::API.new.xml_root_attributes) do |osm|
+  osm << (render(@nodes) || "")
+  osm << (render(@way) || "")
+end
diff --git a/app/views/api/ways/index.xml.builder b/app/views/api/ways/index.xml.builder
new file mode 100644 (file)
index 0000000..bcb89cd
--- /dev/null
@@ -0,0 +1,5 @@
+xml.instruct!
+
+xml.osm(OSM::API.new.xml_root_attributes) do |osm|
+  osm << (render(@ways) || "")
+end
diff --git a/app/views/api/ways/show.xml.builder b/app/views/api/ways/show.xml.builder
new file mode 100644 (file)
index 0000000..d520a08
--- /dev/null
@@ -0,0 +1,5 @@
+xml.instruct!
+
+xml.osm(OSM::API.new.xml_root_attributes) do |osm|
+  osm << (render(@way) || "")
+end
diff --git a/app/views/api/ways/ways_for_node.xml.builder b/app/views/api/ways/ways_for_node.xml.builder
new file mode 100644 (file)
index 0000000..bcb89cd
--- /dev/null
@@ -0,0 +1,5 @@
+xml.instruct!
+
+xml.osm(OSM::API.new.xml_root_attributes) do |osm|
+  osm << (render(@ways) || "")
+end