This vignettes consists of

1. Introduction {ch1}

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.

2. Attic Functions {ch2}

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.

3. Classes and methods

Class:

1. osmtt

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.

Methods

2. osmttdiff

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.

Methods

4. How to use

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)

To get the instance of osm database at a previous version in time, Use 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)

To get the difference of osm database between two time, Use 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)

5. Issues, Challenges and Further Works

5.1 Issues:

5.2 Challenges

5.3 Further Works



neogeomat/OSMTT documentation built on Aug. 10, 2019, 11:22 a.m.