osm_get_points_gps {osmapiR} | R Documentation |
Get GPS Points
Description
Use this to retrieve the GPS track points that are inside a given bounding box (formatted in a GPX format).
Usage
osm_get_points_gps(bbox, page_number = 0, format = c("R", "gpx"))
Arguments
bbox |
Coordinates for the area to retrieve the notes from ( |
page_number |
Specifies which groups of 5,000 points, or page, to return. The API call does not return more
than 5,000 points at a time. In order to retrieve all of the points for a bounding box, set |
format |
Format of the output. Can be |
Value
If format = "R"
, returns a list of data frames with the points for each trace. For public traces, the data frame
include the attributes name
, desc
and url
.
format = "gpx"
Returns a xml2::xml_document with the following format:
<?xml version="1.0" encoding="UTF-8"?> <gpx version="1.0" creator="OpenStreetMap.org" xmlns="http://www.topografix.com/GPX/1/0"> <trk> <name>20190626.gpx</name> <desc>Footpaths near Blackweir Pond, Epping Forest</desc> <url>https://api.openstreetmap.org/user/John%20Leeming/traces/3031013</url> <trkseg> <trkpt lat="51.6616100" lon="0.0534560"> <time>2019-06-26T14:27:58Z</time> </trkpt> ... </trkseg> ... </trk> ... </gpx>
This response is NOT wrapped in an OSM xml parent element.
The file format is GPX Version 1.0 which is not the current version. Verify that your tools support it.
Note
In violation of the GPX standard when downloading public GPX traces through the API, all waypoints of non-trackable traces are randomized (or rather sorted by lat/lon) and delivered as one trackSegment for privacy reasons. Trackable traces are delivered, sorted by descending upload time, before the waypoints of non-trackable traces.
Private traces without name
, desc
and url
can be separated in different items in the result if they get
split due to server pagination. Public traces are united using matching URL.
See Also
Other get GPS' functions:
osm_get_data_gpx()
,
osm_get_gpx_metadata()
,
osm_list_gpxs()
Examples
pts_gps <- osm_get_points_gps(bbox = c(-0.3667545, 40.2153246, -0.3354263, 40.2364915))
## bbox as a character value also works(bbox = "-0.3667545,40.2153246,-0.3354263,40.2364915").
pts_gps
## get attributes
lapply(pts_gps, function(x) attributes(x)[c("name", "desc", "url")])