From ae0cc481c0421f3414d8d41079a71e6f86397635 Mon Sep 17 00:00:00 2001 From: mpadge Date: Wed, 17 Jul 2024 14:31:31 +0200 Subject: [PATCH] describe key-only queries in readme; closes #342 --- DESCRIPTION | 2 +- NEWS.md | 1 + README.Rmd | 15 +++++++++++++-- README.md | 20 +++++++++++++------- codemeta.json | 2 +- 5 files changed, 29 insertions(+), 11 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index e27858f..3e9925371 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -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", , "mark.padgham@email.com", role = c("aut", "cre")), person("Bob", "Rudis", role = "aut"), diff --git a/NEWS.md b/NEWS.md index 274014d..56ddfda 100644 --- a/NEWS.md +++ b/NEWS.md @@ -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 diff --git a/README.Rmd b/README.Rmd index 5c624f7..8882c37 100644 --- a/README.Rmd +++ b/README.Rmd @@ -157,10 +157,21 @@ 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 @@ -168,7 +179,7 @@ q <- opq ("portsmouth usa") %>% 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 ( diff --git a/README.md b/README.md index 717f6cc..5e68a1f 100644 --- a/README.md +++ b/README.md @@ -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 @@ -133,9 +130,6 @@ boxes: b <- getbb ("bangalore", format_out = "polygon") class (b) #> [1] "matrix" "array" -``` - -``` r head (b [[1]]) #> [1] 77.46005 ``` @@ -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: diff --git a/codemeta.json b/codemeta.json index 37c4424..24d3334 100644 --- a/codemeta.json +++ b/codemeta.json @@ -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",