- way = Way.find(params[:id])
- case request.method
-
- when :get
- unless way.visible
- render :nothing => true, :status => 410
- return
+ # if we get here, all is fine, otherwise something will catch below.
+ render :nothing => true
+ rescue OSM::APIAlreadyDeletedError
+ render :text => "", :status => :gone
+ rescue OSM::APIPreconditionFailedError
+ render :text => "", :status => :precondition_failed
+ rescue ActiveRecord::RecordNotFound
+ render :nothing => true, :status => :not_found
+ end
+ end
+
+ def full
+ begin
+ way = Way.find(params[:id])
+
+ if way.visible
+ nd_ids = way.nds + [-1]
+ nodes = Node.find(:all, :conditions => "visible = 1 AND id IN (#{nd_ids.join(',')})")
+
+ # Render
+ doc = OSM::API.new.get_xml_doc
+ nodes.each do |node|
+ doc.root << node.to_xml_node()
+ end
+ doc.root << way.to_xml_node()
+
+ render :text => doc.to_s, :content_type => "text/xml"
+ else
+ render :text => "", :status => :gone