I am trying to get the polygon size from OSM using osmar to load data. However, a health check tells me this is wrong.
Below is an example of what I mean.
(1) The geographical area around Hyde Park in London. Extract all the ways and relationships that are marked as “park.”
devtools::install_github('osmdatar/osmdata')
library(osmdata)
library(osmar)
library(sp)
library(sf)
library(rgeos)
osmO <- get_osm(center_bbox(-0.167919, 51.5072682, 2000, 2000))
ids_relations <- osmO$relations$tags[osmO$relations$tags$v=="park","id"]
ids_ways <- osmO$ways$tags[osmO$ways$tags$v=="park","id"]
ids_sub <- find_down(osmO, way(c(ids_relations, ids_ways)))
sp_sub_park <- as_sp(subset(osmO, ids = ids_sub), "polygons")
Now I want to know the area of each of these "parks" [Fig1] (the largest in the middle is Hyde Park).
spplot(sp_sub_park, c("version"), colorkey = FALSE, col.regions=c('green'))

There are two ways:
1) Use the 'area' slot in the polygon itself.
a1 <- sapply(sp_sub_park@polygons, function(x) x@area)
2) Calculate the area with the specified projection.
bg_poly_t <- spTransform(sp_sub_park, CRS("+proj=longlat +datum=WGS84"))
a2 <- rgeos::gArea(bg_poly_t, byid=TRUE)
These two give me the same result [Fig. 2] (note that the two largest areas are Hyde Park, divided into two expensive)
plot(a1*1000000, a2*1000000)

, . ( ). - 300 , , (- ~ 1.420.000 ).
?