This is an API method for querying changesets. It supports querying by different criteria.
Arguments
- bbox
Find changesets within the given bounding box coordinates (
left,bottom,right,top
).- user
Find changesets by the user with the given user id (numeric) or display name (character).
- time
Find changesets closed after this date and time. See details for the valid formats.
- time_2
find changesets that were closed after
time
and created beforetime_2
. In other words, any changesets that were open at some time during the given time rangetime
totime_2
.- open
If
TRUE
, only finds changesets that are still open but excludes changesets that are closed or have reached the element limit for a changeset (10,000 at the momentosm_capabilities()$api$changesets
).- closed
If
TRUE
, only finds changesets that are closed or have reached the element limit.- changeset_ids
Finds changesets with the specified ids.
- order
If
"newest"
(default), sort newest changesets first. If"oldest"
, reverse order.- limit
Specifies the maximum number of changesets returned. 100 as the default value.
- format
Format of the output. Can be
"R"
(default),"xml"
, or"json"
.- tags_in_columns
If
FALSE
(default), the tags of the changesets are saved in a single list columntags
containing adata.frame
for each changeset with the keys and values. IfTRUE
, add a column for each key. Ignored ifformat != "R"
.
Value
If format = "R"
, returns a data frame with one OSM changeset per row.
format = "xml"
Returns a xml2::xml_document with the following format:
<osm>
<changeset id="10" created_at="2008-11-08T19:07:39+01:00" open="true" user="fred" uid="123" min_lon="7.0191821" min_lat="49.2785426" max_lon="7.0197485" max_lat="49.2793101" comments_count="3" changes_count="10">
<tag k="created_by" v="JOSM 1.61"/>
<tag k="comment" v="Just adding some streetnames"/>
...
<discussion>
<comment date="2015-01-01T18:56:48Z" uid="1841" user="metaodi">
<text>Did you verify those street names?</text>
</comment>
<comment date="2015-01-01T18:58:03Z" uid="123" user="fred">
<text>sure!</text>
</comment>
...
</discussion>
</changeset>
<changeset ...>
...
</changeset>
</osm>
format = "json"
Returns a list with the following json structure:
{
"version": "0.6",
"elements": [
{"type": "changeset",
"id": 10,
"created_at": "2005-05-01T16:09:37Z",
"closed_at": "2005-05-01T17:16:44Z",
"open": False,
"user": "Petter Reinholdtsen",
"uid": 24,
"minlat": 59.9513092,
"minlon": 10.7719727,
"maxlat": 59.9561501,
"maxlon": 10.7994537,
"comments_count": 1,
"changes_count": 10,
"discussion": [{"date": "2022-03-22T20:58:30Z", "uid": 15079200, "user": "Ethan White of Cheriton", "text": "wow no one have said anything here 3/22/2022\n"}]
}, ...]
}
Details
Where multiple queries are given the result will be those which match all of the requirements. The contents of the
returned document are the changesets and their tags. To get the full set of changes associated with a changeset, use
osm_download_changeset()
on each changeset ID individually.
Modification and extension of the basic queries above may be required to support rollback and other uses we find for changesets.
This call returns latest changesets matching criteria. The default ordering is newest first, but you can specify
order = "oldest"
to reverse the sort order (see
ordered by created_at
– see the current state).
Reverse ordering cannot be combined with time
.
Te valid formats for time
and time_2
parameters are anything that
Time.parse
Ruby function will parse.
See also
Other get changesets' functions:
osm_download_changeset()
,
osm_get_changesets()
Examples
if (FALSE) {
chst_ids <- osm_query_changesets(changeset_ids = c(137627129, 137625624))
chst_ids
chsts <- osm_query_changesets(
bbox = c(-1.241112, 38.0294955, 8.4203171, 42.9186456),
user = "Mementomoristultus",
time = "2023-06-22T02:23:23Z",
time_2 = "2023-06-22T00:38:20Z"
)
chsts
chsts2 <- osm_query_changesets(
bbox = c("-9.3015367,41.8073642,-6.7339533,43.790422"),
user = "Mementomoristultus",
closed = TRUE
)
chsts2
}