Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

describe key-only queries in readme; closes #342 #344

Merged
merged 1 commit into from
Jul 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: osmdata
Title: Import 'OpenStreetMap' Data as Simple Features or Spatial Objects
Version: 0.2.5.017
Version: 0.2.5.018
Authors@R: c(
person("Mark", "Padgham", , "[email protected]", role = c("aut", "cre")),
person("Bob", "Rudis", role = "aut"),
Expand Down
1 change: 1 addition & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

- Improved `get_bb(..., format_out = "sf_polygon")` to return full metadata
along with geometries (#338 thanks to @RegularnaMatrica)
- Mention key-only feature requests in README (#342 thanks to @joostschouppe)


0.2.5
Expand Down
15 changes: 13 additions & 2 deletions README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -157,18 +157,29 @@ q <- opq ("portsmouth usa") %>%
add_osm_feature (key = "amenity", value = "restaurant") %>%
add_osm_feature (key = "amenity", value = "pub") # There are none of these
```

Features can also be requested by key only, in which case features with any
values for the specified key will be returned:
```{r key-val2}
q <- opq ("portsmouth usa") %>%
add_osm_feature (key = "amenity")
```
Such key-only queries can, however, translate into requesting very large data
sets, and should generally be avoided in favour of more precise key-value
specifications.

Negation can also be specified by pre-pending an exclamation mark so that the
following requests all amenities that are NOT labelled as restaurants and that
are not labelled as pubs:
```{r key-val2}
```{r key-val3}
q <- opq ("portsmouth usa") %>%
add_osm_feature (key = "amenity", value = "!restaurant") %>%
add_osm_feature (key = "amenity", value = "!pub") # There are a lot of these
```

Additional arguments allow for more refined matching, such as the following
request for all pubs with "irish" in the name:
```{r key-val3}
```{r key-val4}
q <- opq ("washington dc") %>%
add_osm_feature (key = "amenity", value = "pub") %>%
add_osm_feature (
Expand Down
20 changes: 13 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,8 @@ To load the package and check the version:
``` r
library (osmdata)
#> Data (c) OpenStreetMap contributors, ODbL 1.0. https://www.openstreetmap.org/copyright
```

``` r
packageVersion ("osmdata")
#> [1] '0.2.5.17'
#> [1] '0.2.5.16'
```

## Usage
Expand Down Expand Up @@ -133,9 +130,6 @@ boxes:
b <- getbb ("bangalore", format_out = "polygon")
class (b)
#> [1] "matrix" "array"
```

``` r
head (b [[1]])
#> [1] 77.46005
```
Expand All @@ -158,6 +152,18 @@ q <- opq ("portsmouth usa") %>%
add_osm_feature (key = "amenity", value = "pub") # There are none of these
```

Features can also be requested by key only, in which case features with
any values for the specified key will be returned:

``` r
q <- opq ("portsmouth usa") %>%
add_osm_feature (key = "amenity")
```

Such key-only queries can, however, translate into requesting very large
data sets, and should generally be avoided in favour of more precise
key-value specifications.

Negation can also be specified by pre-pending an exclamation mark so
that the following requests all amenities that are NOT labelled as
restaurants and that are not labelled as pubs:
Expand Down
2 changes: 1 addition & 1 deletion codemeta.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"codeRepository": "https://github.com/ropensci/osmdata/",
"issueTracker": "https://github.com/ropensci/osmdata/issues",
"license": "https://spdx.org/licenses/GPL-3.0",
"version": "0.2.5.017",
"version": "0.2.5.018",
"programmingLanguage": {
"@type": "ComputerLanguage",
"name": "R",
Expand Down
Loading