osmdata: Download OpenStreetMap Data with the Overpass API

> library(osmdata)
Data (c) OpenStreetMap contributors, ODbL 1.0. http://www.openstreetmap.org/copyright

バージョン: 0.0.0


関数名 概略
add_feature Add a feature to an Overpass query
available_features List recognized features in OSM
available_tags List tags associated with a feature
bbox_to_string Convert a named matrix or a named vector (or an unnamed vector) return a string
getbb Get bounding box for a given place name
opq Build an Overpass query
opq_to_string Convert an osmdata query of class 'opq' to a character string query to be submitted to the overpass API
osm_lines Extract all 'osm_lines' from an osmdata object
osm_multilines Extract all 'osm_multilines' from an osmdata object
osm_multipolygons Extract all 'osm_multipolygons' from an osmdata object
osm_points Extract all 'osm_points' from an osmdata object
osm_polygons Extract all 'osm_polygons' from an osmdata object
osmdata osmdata class def
osmdata_sf Return an OSM Overpass query as an 'osmdata' object in 'sf' format.
osmdata_sp Return an OSM Overpass query as an 'osmdata' object in 'sp' format.
osmdata_xml Return an OSM Overpass query in XML format Read an (XML format) OSM Overpass response from a string, a connection, or a raw vector.
overpass_status Retrieve status of the Overpass API

add_feature

Arguments

  • opq
  • key
  • value
  • exact
  • bbox
> add_feature()

available_features

参照可能なfeaturesの一覧を取得

> features <- available_features()
> length(features)
[1] 242
> features %>% head()
[1] "4wd only"  "abandoned" "abutters"  "access"    "addr"      "addr:city"

available_tags

Arguments

  • feature
> available_tags("aerialway")
 [1] "cable car"    "canopy"       "chair lift"   "drag lift"   
 [5] "gondola"      "goods"        "j-bar"        "magic carpet"
 [9] "mixed lift"   "platter"      "pylon"        "rope tow"    
[13] "station"      "t-bar"        "zip line"
> available_tags("leisure")
 [1] "adult gaming centre" "amusement arcade"    "bandstand"          
 [4] "beach resort"        "bird hide"           "bowling alley"      
 [7] "common"              "dance"               "dog park"           
[10] "firepit"             "fishing"             "fitness centre"     
[13] "garden"              "golf course"         "hackerspace"        
[16] "horse riding"        "ice rink"            "marina"             
[19] "miniature golf"      "nature reserve"      "park"               
[22] "picnic table"        "pitch"               "playground"         
[25] "sauna"               "slipway"             "sports centre"      
[28] "stadium"             "summer camp"         "swimming area"      
[31] "swimming pool"       "track"               "water park"         
[34] "wildlife hide"

bbox_to_string

矩形を文字列ベクトルで返す

> getbb("Osaka, Japan") %>% bbox_to_string()
[1] "34.586154,135.3099784,34.768849,135.59935"

getbb

地名の矩形を取得

Arguments

  • place_name
  • display_name_contains
  • viewbox
  • format_out
  • base_url
  • featuretype
  • limit
  • key
  • silent
> getbb(place_name = "Tokyo, Japan")
          min         max
x 135.8536855 154.2055410
y  20.2145811  35.8984245

opq

Arguments

  • bbox
> (q <- opq("Shibuya, Tokyo Japan"))
$bbox
[1] "35.641458,139.661588,35.692142,139.7239268"

$prefix
[1] "[out:xml][timeout:25];\n(\n"

$suffix
[1] ");\n(._;>);\nout body;"

$features
NULL

attr(,"class")
[1] "list"           "overpass_query"

opq_to_string

クエリを文字列で出力

> opq_to_string(q)
[1] "[out:xml][timeout:25];\n(\n node  (35.641458,139.661588,35.692142,139.7239268);\n way  (35.641458,139.661588,35.692142,139.7239268);\n relation  (35.641458,139.661588,35.692142,139.7239268);\n\n);\n(._;>);\nout body;"

overpass_status

> overpass_status()
Rate limit: 2