- pt.find('tag').each do |tag|
- raise OSM::APIBadXMLError.new("way", pt, "tag is missing key") if tag['k'].nil?
- raise OSM::APIBadXMLError.new("way", pt, "tag is missing value") if tag['v'].nil?
- way.add_tag_keyval(tag['k'], tag['v'])
- end
-
- pt.find('nd').each do |nd|
- way.add_nd_num(nd['ref'])
- end
-
- return way
- end
-
- # Find a way given it's ID, and in a single SQL call also grab its nodes
- #
-
- # You can't pull in all the tags too unless we put a sequence_id on the way_tags table and have a multipart key
- def self.find_eager(id)
- way = Way.find(id, :include => {:way_nodes => :node})
- #If waytag had a multipart key that was real, you could do this:
- #way = Way.find(id, :include => [:way_tags, {:way_nodes => :node}])
- end
-
- # Find a way given it's ID, and in a single SQL call also grab its nodes and tags
- def to_xml
- doc = OSM::API.new.get_xml_doc
- doc.root << to_xml_node()
- return doc
- end