Skip to content

Commit 5d8963e

Browse files
committed
Tweaks to ors_elevation()
1 parent 2501c88 commit 5d8963e

File tree

7 files changed

+43
-19
lines changed

7 files changed

+43
-19
lines changed

DESCRIPTION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Package: openrouteservice
22
Title: Openrouteservice API Client
3-
Version: 0.2.6
3+
Version: 0.2.7
44
Authors@R: person("Andrzej", "Oleś", email = "[email protected]", comment = c(ORCID = "0000-0003-0285-2787"), role = c("aut", "cre"))
55
Description: The package streamlines access to the services provided by openrouteservice.org.
66
It allows you to painlessly query for directions, geocoding, isochrones, time-distance matrices, and POIs.

NEWS.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
1+
# openrouteservice 0.2.7
2+
3+
## NEW FEATURES
4+
5+
- `ors_elevation()` now accepts point coordinates in matrix form.
6+
7+
## BUG FIXES
8+
9+
- `ors_elevation()` does not issue a message on missing encoding anymore.
10+
111
# openrouteservice 0.2.6
212

313
## NEW FEATURES

R/api_call.R

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,8 @@ process_response <- function(res, endpoint, output, simplifyMatrix) {
146146

147147
format <- switch(format, "application/gpx+xml"="xml", "json")
148148

149-
res <- parse_content(content(res, "text"), format, output, endpoint, simplifyMatrix)
149+
res <- parse_content(suppressMessages(content(res, "text")),
150+
format, output, endpoint, simplifyMatrix)
150151

151152
attr(res, "query_time") <- query_time
152153

R/elevation.R

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,12 @@ ors_elevation <- function(format_in = c("geojson", "point", "polyline", "encoded
5454

5555
## check whether geojson is a point or a line
5656
if (format_in == "geojson") {
57-
geometry = fromJSON(geometry)
57+
geometry <- fromJSON(geometry)
5858
input <- geometry$type
5959
} else {
60+
names(geometry) <- NULL
61+
if (format_in=="point")
62+
geometry <- as.vector(geometry)
6063
input <- format_in
6164
}
6265

README.md

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -72,21 +72,25 @@ defaults are equivalent of having
7272
Package News
7373
------------
7474

75-
### version 0.2.6
75+
### version 0.2.7
7676

7777
#### NEW FEATURES
7878

79-
- `ors_pois()` gains `sf` output.
79+
- `ors_elevation()` now accepts point coordinates in matrix form.
8080

81-
### version 0.2.5
81+
#### BUG FIXES
82+
83+
- `ors_elevation()` does not issue a message on missing encoding
84+
anymore.
85+
86+
### version 0.2.6
8287

8388
#### NEW FEATURES
8489

85-
- Improved `ors_elevation()` response handling.
90+
- `ors_pois()` gains `sf` output.
8691

87-
### version 0.2.4
92+
### version 0.2.5
8893

8994
#### NEW FEATURES
9095

91-
- `ors_directions()`, `ors_isochrones()`, `ors_elevation()` and
92-
`ors_geocode()` can now output `sf` objects (\#42).
96+
- Improved `ors_elevation()` response handling.

inst/WORDLIST

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,9 @@ reachability
2424
Reachability
2525
SRTM
2626
str
27+
ggforce
28+
ggplot
29+
mapview
30+
natively
31+
polyline
32+
postprocessing

vignettes/openrouteservice.Rmd

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,10 @@ vignette: >
1313
---
1414

1515
```{r config, include=FALSE}
16+
## increase width for code output
17+
options(width = 100)
1618
## set up knitr defaults
17-
knitr::opts_chunk$set(eval=TRUE, out.width='100%', out.height='560px')
19+
knitr::opts_chunk$set(eval = TRUE, out.width = '100%', out.height = '560px')
1820
```
1921

2022
## Get started
@@ -87,11 +89,11 @@ coordinates <- list(c(8.34234, 48.23424), c(8.34423, 48.26424))
8789
x <- ors_directions(coordinates)
8890
```
8991

90-
Way points can be provided as a list of coordinate pairs `c(lng, lat)`, or a
92+
Way points can be provided as a list of coordinate pairs `c(lon, lat)`, or a
9193
2-column matrix-like object such as a data frame.
9294

9395
```{r data_frame}
94-
coordinates <- data.frame(lng = c(8.34234, 8.34423), lat = c(48.23424, 48.26424))
96+
coordinates <- data.frame(lon = c(8.34234, 8.34423), lat = c(48.23424, 48.26424))
9597
```
9698

9799
The response formatting defaults to geoJSON which allows to easily
@@ -370,8 +372,8 @@ y <- ors_geocode(location = location, layers = "locality", size = 1)
370372

371373
This service allows you to find places of interest around or within given
372374
geographic coordinates. You may search for given features around a point, path
373-
or even within a given polygon specified in `geometry`. To list all the
374-
available POI categories use `ors_pois('list')`.
375+
or even within a polygon specified in `geometry`. To list all the available POI
376+
categories use `ors_pois('list')`.
375377

376378
```{r pois}
377379
geometry <- list(
@@ -413,9 +415,7 @@ Given a point or line geometry you can use `ors_elevation` to query for its
413415
elevation.
414416

415417
```{r elevation}
416-
x <- ors_geocode("Königstuhl")
418+
x <- ors_geocode("Königstuhl", output = "sf")
417419
418-
coordinates <- x$features[[1L]]$geometry$coordinates
419-
420-
ors_elevation("point", coordinates)
420+
ors_elevation("point", st_coordinates(x))
421421
```

0 commit comments

Comments
 (0)