#library(osmar)
nbgd <- get_osm(center_bbox(20.4080,44.8302, 1000, 1000),all=True)
#summary(nbgd)
summary(nbgd$relations)
## osmar$relations object
## 72 relations, 729 tags, 1361 node_refs, 3020 way_refs
##
## ..$attrs data.frame:
## id, visible, timestamp, version, changeset, user, uid
## ..$tags data.frame:
## id, k, v
## ..$refs data.frame:
## id, type, ref, role
##
## Key-Value contingency table:
## Key Value Freq
## 1 route bus 48
## 2 type route 48
## 3 route_master bus 17
## 4 network ITS1 17
## 5 type route_master 17
## 6 to:sr-Latn Novi Beograd (Pohors... 5
## 7 from:sr-Latn Novi Beograd (Pohors... 4
## 8 from:sr-Latn Zemun (Kej oslobodje... 4
## 9 to:sr-Latn Zemun (Kej oslobodje... 4
## 10 from Земун (Кеј ослобођењ... 4
summary(nbgd$ways)
## osmar$ways object
## 436 ways, 1564 tags, 2788 refs
##
## ..$attrs data.frame:
## id, visible, timestamp, version, changeset, user, uid
## ..$tags data.frame:
## id, k, v
## ..$refs data.frame:
## id, ref
##
## Key-Value contingency table:
## Key Value Freq
## 1 building yes 98
## 2 building apartments 62
## 3 highway service 61
## 4 addr:postcode 11000 57
## 5 addr:city Београд 54
## 6 oneway yes 50
## 7 highway residential 41
## 8 highway tertiary 40
## 9 lanes 2 34
## 10 wheelchair no 34
summary(nbgd$nodes)
## osmar$nodes object
## 2418 nodes, 721 tags
##
## ..$attrs data.frame:
## id, visible, timestamp, version, changeset, user, uid, lat,
## lon
## ..$tags data.frame:
## id, k, v
##
## Bounding box:
## lat lon
## min 44.82038 20.39566
## max 44.83638 20.44337
##
## Key-Value contingency table:
## Key Value Freq
## 1 addr:street Отона Жупанчича 37
## 2 addr:street Палмира Тољатија 35
## 3 addr:street Џона Кенедија 31
## 4 addr:street Студентска 26
## 5 addr:street Генералa Жданова 21
## 6 addr:street Гоце Делчева 19
## 7 addr:street Булевар Михајла Пупи... 18
## 8 highway bus_stop 17
## 9 public_transport platform 17
## 10 addr:street Луја Адамича 17
Let’s find highways,traffic signals, bus stops, buildings and plot them
highway_ids <- find(nbgd, way(tags(k == "highway")))
highway_ids <- find_down(nbgd, way(highway_ids))
highways <- subset(nbgd, ids = highway_ids)
traffic_signals_ids <- find(nbgd, node(tags(v == "traffic_signals")))
traffic_signals <- subset(nbgd, node_ids = traffic_signals_ids)
busstop_ids <- find(nbgd, node(tags(v %agrep% "busstop")))
busstop <- subset(nbgd, node_ids = busstop_ids)
#buildings_ids <- find(nbgd, way(tags(k == 'building')))
#buildings_ids <- find_down(nbgd, way(buildings_ids))
#buildings <- subset(nbgd, ids = buildings_ids)
plot(nbgd,way_args = list(col = gray(0.7)),node_args = list(pch = 25, cex = 0.1, col = gray(0.3)))
plot_ways(highways, add = TRUE, col = "purple")
plot_nodes(traffic_signals, add = TRUE, col = "red")
#plot_nodes(buildings, add = TRUE, col = "yellow")
plot_nodes(busstop, add = TRUE, col = "green")
The map shows that all the bus stops in this part of the city are mapped in OSM. Nevertheless, traffic signals aren’t since most of the intersections actually have them.