Getting non-network data from raw osm files.
Arguments
- filename
a local osm extract file with .osm or .osm.pbf extension.
- main_keys
a vector containing main keys to extract the values for. Check osm map features or vignette for a full detail.
Value
a data table with several main columns, including one called attrs
which contains lists
with named key=value pairs of the secondary osm tags.
Examples
local_osm_filename <- system.file("extdata",'map.osm', package = "cppRosm")
data <- cppRosm::extract_data(local_osm_filename)
#> → Using main keys `amenity`,`shop`,`tourism`.
head(data)
#> id key value lon lat attrs
#> <char> <char> <char> <num> <num> <list>
#> 1: 227734022 amenity fuel 10.51265 43.84976 <list[10]>
#> 2: 227808627 amenity fuel 10.49478 43.84065 <list[7]>
#> 3: 227817156 amenity fuel 10.49499 43.84476 <list[7]>
#> 4: 227817516 amenity fuel 10.51571 43.84797 <list[12]>
#> 5: 227821623 amenity fuel 10.51632 43.84604 <list[8]>
#> 6: 227821625 amenity fuel 10.51595 43.84711 <list[7]>
head(data$attrs)
#> [[1]]
#> [[1]]$brand
#> [1] "Api-Ip"
#>
#> [[1]]$`brand:wikidata`
#> [1] "Q646807"
#>
#> [[1]]$`brand:wikipedia`
#> [1] "en:Anonima Petroli Italiana"
#>
#> [[1]]$`fuel:diesel`
#> [1] "yes"
#>
#> [[1]]$`fuel:octane_95`
#> [1] "yes"
#>
#> [[1]]$`fuel:octane_98`
#> [1] "yes"
#>
#> [[1]]$name
#> [1] "IP"
#>
#> [[1]]$operator
#> [1] "Netti Santo Nicola"
#>
#> [[1]]$`ref:mise`
#> [1] "28234"
#>
#> [[1]]$source
#> [1] "MISE - Ministero Sviluppo Economico"
#>
#>
#> [[2]]
#> [[2]]$brand
#> [1] "Esso"
#>
#> [[2]]$`brand:wikidata`
#> [1] "Q867662"
#>
#> [[2]]$`fuel:diesel`
#> [1] "yes"
#>
#> [[2]]$`fuel:octane_95`
#> [1] "yes"
#>
#> [[2]]$name
#> [1] "Esso"
#>
#> [[2]]$operator
#> [1] "Ciervo Giovanni"
#>
#> [[2]]$`ref:mise`
#> [1] "37277"
#>
#>
#> [[3]]
#> [[3]]$brand
#> [1] "Api-Ip"
#>
#> [[3]]$`fuel:diesel`
#> [1] "yes"
#>
#> [[3]]$`fuel:octane_95`
#> [1] "yes"
#>
#> [[3]]$operator
#> [1] "Cobel - Commercio Benzina Lubrificanti - S.R.L. o Cobel - S.R.L."
#>
#> [[3]]$`ref:mise`
#> [1] "31551"
#>
#> [[3]]$`toilets:wheelchair`
#> [1] "no"
#>
#> [[3]]$wheelchair
#> [1] "yes"
#>
#>
#> [[4]]
#> [[4]]$brand
#> [1] "Api-Ip"
#>
#> [[4]]$check_date
#> [1] "2022-09-04"
#>
#> [[4]]$`fuel:diesel`
#> [1] "yes"
#>
#> [[4]]$`fuel:octane_95`
#> [1] "yes"
#>
#> [[4]]$name
#> [1] "Giop"
#>
#> [[4]]$operator
#> [1] "Cobel - Commercio Benzina Lubrificanti - S.R.L. o Cobel - S.R.L."
#>
#> [[4]]$`payment:bancomat`
#> [1] "yes"
#>
#> [[4]]$`payment:mastercard`
#> [1] "yes"
#>
#> [[4]]$`payment:visa`
#> [1] "yes"
#>
#> [[4]]$`ref:mise`
#> [1] "22498"
#>
#> [[4]]$`toilets:wheelchair`
#> [1] "no"
#>
#> [[4]]$wheelchair
#> [1] "yes"
#>
#>
#> [[5]]
#> [[5]]$brand
#> [1] "Agip"
#>
#> [[5]]$`brand:wikidata`
#> [1] "Q377915"
#>
#> [[5]]$`brand:wikipedia`
#> [1] "en:Agip"
#>
#> [[5]]$`fuel:diesel`
#> [1] "yes"
#>
#> [[5]]$`fuel:octane_95`
#> [1] "yes"
#>
#> [[5]]$name
#> [1] "Agip"
#>
#> [[5]]$operator
#> [1] "Fratelli Checchi - S.N.C."
#>
#> [[5]]$`ref:mise`
#> [1] "39092"
#>
#>
#> [[6]]
#> [[6]]$brand
#> [1] "Api-Ip"
#>
#> [[6]]$`fuel:diesel`
#> [1] "yes"
#>
#> [[6]]$`fuel:octane_95`
#> [1] "yes"
#>
#> [[6]]$operator
#> [1] "Minghi Marco"
#>
#> [[6]]$`ref:mise`
#> [1] "8149"
#>
#> [[6]]$`toilets:wheelchair`
#> [1] "no"
#>
#> [[6]]$wheelchair
#> [1] "yes"
#>
#>