osmdata_xml | R Documentation |
Return an OSM Overpass query in XML format Read an (XML format) OSM Overpass response from a string, a connection, or a raw vector.
osmdata_xml(q, filename, quiet = TRUE, encoding)
q |
An object of class |
filename |
If given, OSM data are saved to the named file |
quiet |
suppress status messages. |
encoding |
Unless otherwise specified XML documents are assumed to be encoded as UTF-8 or UTF-16. If the document is not UTF-8/16, and lacks an explicit encoding directive, this allows you to supply a default. |
An object of class xml2::xml_document
containing the result of the
overpass API query.
Objects of class xml_document
can be saved as .xml
or
.osm
files with xml2::write_xml
.
Other extract:
osmdata_data_frame()
,
osmdata_sc()
,
osmdata_sf()
,
osmdata_sp()
## Not run:
q <- opq ("hampi india")
q <- add_osm_feature (q, key = "historic", value = "ruins")
osmdata_xml (q, filename = "hampi.osm")
# Complex query as a string (not possible with regular osmdata functions)
q <- '[out:xml][timeout:50];
area[name="Països Catalans"][boundary=political]->.boundaryarea;
rel(area.boundaryarea)[admin_level=8][boundary=administrative];
map_to_area -> .all_level_8_areas;
( nwr(area.boundaryarea)[amenity=townhall]; >; );
is_in;
area._[admin_level=8][boundary=administrative] -> .level_8_areas_with_townhall;
(.all_level_8_areas; - .level_8_areas_with_townhall;);
rel(pivot);
out tags;'
no_townhall <- osmdata_xml (q)
no_townhall
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.