I'd like to append a set of ways which are related and give a district's boundary. I tried the following but got stuck up:
require(osmar)
require(XML)
# a set of open street map ways (lines) related as given by a relation..
# (if connected these ways represent the boundary of a political
# district in Tyrol/Austria)
myxml <- xmlParse("http://api.openstreetmap.org/api/0.6/relation/85647")
# extracting way ids at the according xml-nodes:
els <- getNodeSet(myxml, "//member[@ref]")
ways <- as.numeric(sapply(els, function(el) xmlGetAttr(el, "ref")))
# now I try to get one of those ways as an osmar-obj and plot it,
# which throws an error:
plot_ways(get_osm(way(ways[1])))
apparently there's a boundingbox missing but I don't know how to assign it to this sort of object.. If I get this problem resolved I'd like to make one polygon out of the lines/ways.
the author of the package was so kind to give info that was lacking the current documentation: the argument get_osm(.., all = T) was simply missing... with all = T all related elements are retrieved.
to get the my desired district-boundary the following code applies: