opq_csv | R Documentation |
Transform an Overpass query to return the result in a csv format
opq_csv(q, fields, header = TRUE)
q |
A opq string or an object of class |
fields |
a character vector with the field names. |
header |
if |
The output format csv
, ask for results in csv. See
CSV output mode
for details. To get the data, use osmdata_data_frame.
The overpass_query
or string with the prefix changed to
return a csv.
csv queries that reach the timeout will return a 0 row data.frame
without any warning. Increase timeout
in q
if you don't see the
expected result.
Other queries:
add_osm_features()
,
add_osm_feature()
,
bbox_to_string()
,
getbb()
,
opq_around()
,
opq_enclosing()
,
opq_osm_id()
,
opq_string()
,
opq()
,
overpass_status()
## Not run:
q <- getbb ("Catalan Countries", format_out = "osm_type_id") %>%
opq (out = "tags center", osm_type = "relation", timeout = 100) %>%
add_osm_feature ("admin_level", "7") %>%
add_osm_feature ("boundary", "administrative") %>%
opq_csv (fields = c("name", "::type", "::id", "::lat", "::lon"))
comarques <- osmdata_data_frame (q) # without timeout parameter, 0 rows
qid<- opq_osm_id (
type = "relation",
id = c ("341530", "1809102", "1664395", "343124"),
out = "tags"
) %>%
opq_csv (fields = c ("name", "name:ca"))
cities <- osmdata_data_frame (qid)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.