View source: R/osm_get_points_gps.R
osm_get_points_gps | R Documentation |
Use this to retrieve the GPS track points that are inside a given bounding box (formatted in a GPX format).
osm_get_points_gps(
bbox,
page_number = 0,
format = c("R", "sf", "sf_lines", "sf_points", "gpx")
)
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 |
If format = "R"
, returns a list of data frames with the points for each trace. For public and identifiable traces,
the data frame include the attributes track_url
, track_name
, and track_desc
.
If format = "sf_lines"
, returns a sf
object from sf. For format = "sf_points"
, returns a list of sf
object (see st_as_sf()
for details).
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.
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.
Other get GPS' functions:
osm_get_data_gpx()
,
osm_get_gpx_metadata()
,
osm_list_gpxs()
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("track_url", "track_name", "track_desc")])
attr(pts_gps, "gpx_attributes")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.