This vignettes consists of
OSM Overpass Api supports query for attic data but this feature has not been implemented in R. This issue is discovered here. This package is made with intention of extending the Osmdata package with the attic functions. It has 2 classes to handle attic data osmtt
and osmttdiff
. Osmtt represents data from a previous timestamp and osmttdiff represents changes in data between the given time frame.
Attic settings in overpass-api are date,diff and adiff. date returns results based on the OpenStreetMap database as of the date specified. Diff lets the database determine the difference of two queries at different points in time. Adiff is same like diff, but for all elements that aren't contained in the newer result, it is indicated what happened to them. In this package add_date
and add_adiff
, are implemented. diff is omitted since adiff gives more details than diff.
osmtt
adds datetime parameters to overpass_query
class which is then passed onto the actual query. The return from overpass_query
and osmtt
has the same structure so osmtt
works similar to overpass_query
. A bug in the osmdata
package was found during this implementation. It has been fixed and pull request has been sent.
osmttdiff
handles the diff results from adiff setting. It separates elements according to create, modify and delete actions. Also it separates the new and old ones.
Attic data may not be supporeted by all overpass servers. First step is to find one which can handle the query.
# new_url <- "http://overpass-api.de/api/interpreter" # osmdata::set_overpass_url(new_url)
osmtt
.Specify place and time and form a query object. Place can bbox object or character, if character result from nominatim is used. Time must be in %Y-%m-%dT%H:%M:%SZ
format e.g. 2019-01-01T12:00:00Z
# op <- osmtt("sudal nepal","2019-01-01T12:00:00Z")
Convert it to osmdata_sf object from osmdata
package.
# op_sf <- osmtt_sf(op)
Other formats can also be used by directly using the osmdata
package methods
# osmdata::osmdata_sp(op) # osmdata::osmdata_xml(op)
osmttdiff
.Specify place, oldtime and newtime and form query object. Newtime is optional. If omitted, current time is used for newtime.
# od<-osmadiff("sanga","2019-01-01T12:00:00Z")
Query overpass and get xml data
# odd<-osmdata:::overpass_query(osmdata::opq_string(od))
Convert overpass diff xml to osmttdiff object
# odd_sf <- osmttdiff_sf(odd)
(Note: Queries are commented because query quota was exceeded)
osmttdiff
does not handle wait and retry.osmtt
uses native call to C for parsing in osmtt_sf
, but is not available in osmttdiff
. Hence osmttdiff
processing is slower.xml
output to file is supported but reading from xml
has not been implementedosmttdiff
sometimes gives node can not be found
error. Source and solution of this is not found. This issue is shown here.osmttdiff_sf
direct call to rcpp_osmdata_sf
of osmdata
has been made. This is a design issue, but since it calls C interface, similar implementation could not be done through R. Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.