return Relation.from_xml_node(pt, create)
end
raise OSM::APIBadXMLError.new("node", xml, "XML doesn't contain an osm/relation element.")
return Relation.from_xml_node(pt, create)
end
raise OSM::APIBadXMLError.new("node", xml, "XML doesn't contain an osm/relation element.")
- rescue LibXML::XML::Error, ArgumentError => ex
- raise OSM::APIBadXMLError.new("relation", xml, ex.message)
+ rescue LibXML::XML::Error, ArgumentError => e
+ raise OSM::APIBadXMLError.new("relation", xml, e.message)
def fix_placeholders!(id_map, placeholder_id = nil)
members.map! do |type, id, role|
old_id = id.to_i
def fix_placeholders!(id_map, placeholder_id = nil)
members.map! do |type, id, role|
old_id = id.to_i
new_id = id_map[type.downcase.to_sym][old_id]
raise OSM::APIBadUserInput, "Placeholder #{type} not found for reference #{old_id} in relation #{self.id.nil? ? placeholder_id : self.id}." if new_id.nil?
new_id = id_map[type.downcase.to_sym][old_id]
raise OSM::APIBadUserInput, "Placeholder #{type} not found for reference #{old_id} in relation #{self.id.nil? ? placeholder_id : self.id}." if new_id.nil?
# reasonable on the assumption that adding or removing members doesn't
# materially change the rest of the relation.
any_relations =
# reasonable on the assumption that adding or removing members doesn't
# materially change the rest of the relation.
any_relations =
- update_members = if tags_changed || any_relations
+ # if the relation is being deleted tags_changed will be true and members empty
+ # so we need to use changed_members to create a correct bounding box
+ update_members = if visible && (tags_changed || any_relations)
# add all non-relation bounding boxes to the changeset
# FIXME: check for tag changes along with element deletions and
# make sure that the deleted element's bounding box is hit.
# add all non-relation bounding boxes to the changeset
# FIXME: check for tag changes along with element deletions and
# make sure that the deleted element's bounding box is hit.