Skip to content

Commit

Permalink
Add count parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
dieghernan committed Nov 28, 2023
1 parent fc2e1e0 commit c2428c7
Show file tree
Hide file tree
Showing 25 changed files with 81 additions and 47 deletions.
1 change: 1 addition & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ updates:
directory: "/" # Location of package manifests
schedule:
interval: "weekly"

3 changes: 2 additions & 1 deletion .github/workflows/pkgdown-gh-pages-clean.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,5 @@ jobs:
run: |
git config --local user.name "github-actions[bot]"
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
Rscript -e 'pkgdown::deploy_to_branch(new_process = FALSE, run_dont_run = TRUE)'
Rscript -e 'pkgdown::deploy_to_branch(new_process = FALSE, run_dont_run = TRUE)'
1 change: 1 addition & 0 deletions .github/workflows/roscron-check-standard.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -51,3 +51,4 @@ jobs:
needs: check

- uses: r-lib/actions/check-r-package@v2

1 change: 1 addition & 0 deletions .github/workflows/rostemplate-gh-pages.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,4 @@ jobs:
git config --local user.name "github-actions[bot]"
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
Rscript -e 'pkgdown::deploy_to_branch(new_process = FALSE, run_dont_run = TRUE)'
4 changes: 3 additions & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
# CatastRoNav (development version)

- Improve condition handling.
- Add a `count` parameter that allows to set the maximum number of features to
be returned.

# CatastRoNav 0.0.2

- Make `sf` objects valid with `sf::st_make_valid()`.
- Make \CRANpkg{sf} objects valid with `sf::st_make_valid()`.

# CatastRoNav 0.0.1

Expand Down
8 changes: 5 additions & 3 deletions R/wfs_ad.R
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#'
#' @seealso [sf::st_bbox()]
#'
#' @return A `sf` object.
#' @return A \CRANpkg{sf} object.
#' @source [SITNA – Catastro de Navarra](https://sitna.navarra.es/geoportal/)
#'
#' @details
Expand All @@ -18,7 +18,7 @@
#' [EPSG:25830](https://epsg.io/25830) - ETRS89 / UTM zone 30N. The result is
#' provided always in the SRS provided in `srs`.
#'
#' When `x` is a `sf` object, the value `srs` is ignored. The query is
#' When `x` is a \CRANpkg{sf} object, the value `srs` is ignored. The query is
#' performed using [EPSG:25830](https://epsg.io/25830) (ETRS89 / UTM zone 30N)
#' and the spatial object is projected back to the SRS of the initial object.
#'
Expand All @@ -37,7 +37,8 @@
#' }
#'
#' @seealso [CatastRo::catr_wfs_get_address_bbox()]
catrnav_wfs_get_address_bbox <- function(x, srs, verbose = FALSE) {
catrnav_wfs_get_address_bbox <- function(x, srs, verbose = FALSE,
count = NULL) {
# Switch to stored queries
stored_query <- "AD:Address"

Expand All @@ -51,6 +52,7 @@ catrnav_wfs_get_address_bbox <- function(x, srs, verbose = FALSE) {
service = "WFS",
request = "getfeature",
typenames = stored_query,
count = count,
# Stored query
bbox = bbox_res$bbox,
SRSNAME = bbox_res$incrs
Expand Down
13 changes: 9 additions & 4 deletions R/wfs_bu.R
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,16 @@
#' the bounding box: `c(xmin, ymin, xmax, ymax)`
#' - A `sf/sfc` object, as provided by the **sf** package.
#' @param srs SRS/CRS to use on the query. See **Details**.
#'
#' @param verbose Logical, displays information. Useful for debugging, default
#' is `FALSE`.
#' @param count integer, indicating the maximum number of features to return.
#' The default value `NULL` does not pass this parameter to the query,
#' and the maximum number of features would be determined by the default value
#' of the API service (5,000 in this case).
#'
#' @seealso [sf::st_bbox()]
#'
#' @return A `sf` object.
#' @return A \CRANpkg{sf} object.
#' @source [SITNA – Catastro de Navarra](https://sitna.navarra.es/geoportal/)
#'
#' @details
Expand All @@ -25,7 +28,7 @@
#' [EPSG:25830](https://epsg.io/25830) - ETRS89 / UTM zone 30N. The result is
#' provided always in the SRS provided in `srs`.
#'
#' When `x` is a `sf` object, the value `srs` is ignored. The query is
#' When `x` is a \CRANpkg{sf} object, the value `srs` is ignored. The query is
#' performed using [EPSG:25830](https://epsg.io/25830) (ETRS89 / UTM zone 30N)
#' and the spatial object is projected back to the SRS of the initial object.
#'
Expand All @@ -44,7 +47,8 @@
#' }
#'
#' @seealso [CatastRo::catr_wfs_get_buildings_bbox()]
catrnav_wfs_get_buildings_bbox <- function(x, srs, verbose = FALSE) {
catrnav_wfs_get_buildings_bbox <- function(x, srs, verbose = FALSE,
count = NULL) {
# Switch to stored queries
stored_query <- "BU:Building"

Expand All @@ -58,6 +62,7 @@ catrnav_wfs_get_buildings_bbox <- function(x, srs, verbose = FALSE) {
service = "WFS",
request = "getfeature",
typenames = stored_query,
count = count,
# Stored query
bbox = bbox_res$bbox,
SRSNAME = bbox_res$incrs
Expand Down
8 changes: 5 additions & 3 deletions R/wfs_cp.R
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#'
#' @seealso [sf::st_bbox()]
#'
#' @return A `sf` object.
#' @return A \CRANpkg{sf} object.
#' @source [SITNA – Catastro de Navarra](https://sitna.navarra.es/geoportal/)
#'
#' @details
Expand All @@ -18,7 +18,7 @@
#' [EPSG:25830](https://epsg.io/25830) - ETRS89 / UTM zone 30N. The result is
#' provided always in the SRS provided in `srs`.
#'
#' When `x` is a `sf` object, the value `srs` is ignored. The query is
#' When `x` is a \CRANpkg{sf} object, the value `srs` is ignored. The query is
#' performed using [EPSG:25830](https://epsg.io/25830) (ETRS89 / UTM zone 30N)
#' and the spatial object is projected back to the SRS of the initial object.
#'
Expand All @@ -37,7 +37,8 @@
#' }
#'
#' @seealso [CatastRo::catr_wfs_get_parcels_bbox()]
catrnav_wfs_get_parcels_bbox <- function(x, srs, verbose = FALSE) {
catrnav_wfs_get_parcels_bbox <- function(x, srs, verbose = FALSE,
count = NULL) {
# Switch to stored queries
stored_query <- "CP:CadastralParcel"

Expand All @@ -51,6 +52,7 @@ catrnav_wfs_get_parcels_bbox <- function(x, srs, verbose = FALSE) {
service = "WFS",
request = "getfeature",
typenames = stored_query,
count = count,
# Stored query
bbox = bbox_res$bbox,
SRSNAME = bbox_res$incrs
Expand Down
6 changes: 3 additions & 3 deletions README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ library(CatastRoNav)
[![rOS-badge](https://ropenspain.github.io/rostemplate/reference/figures/ropenspain-badge.svg)](https://ropenspain.es/)
[![CatastRoNav status
badge](https://ropenspain.r-universe.dev/badges/CatastRoNav)](https://ropenspain.r-universe.dev/CatastRoNav)
[![R-CMD-check](https://github.com/rOpenSpain/CatastRoNav/workflows/R-CMD-check/badge.svg)](https://github.com/rOpenSpain/CatastRoNav/actions?query=workflow%3AR-CMD-check)
[![R-CMD-check](https://github.com/rOpenSpain/CatastRoNav/actions/workflows/roscron-check-standard.yaml/badge.svg)](https://github.com/rOpenSpain/CatastRoNav/actions/workflows/roscron-check-standard.yaml)
[![codecov](https://codecov.io/gh/rOpenSpain/CatastroNav/branch/main/graph/badge.svg)](https://app.codecov.io/gh/rOpenSpain/CatastroNav)
[![DOI](https://img.shields.io/badge/DOI-10.5281/zenodo.6366407-blue)](https://doi.org/10.5281/zenodo.6366407)
[![Project-Status:Active](https://www.repostatus.org/badges/latest/active.svg)](https://www.repostatus.org/#active)
Expand Down Expand Up @@ -62,7 +62,7 @@ install_github("rOpenSpain/CatastRoNav", dependencies = TRUE)
## Usage

The WFS service allows to download vector objects of specific cadastral
elements. The result is provided as `sf` objects (See **sf** package).
elements. The result is provided as \CRANpkg{sf} objects (See **sf** package).

```{r wfs}
library(CatastRoNav)
Expand Down Expand Up @@ -98,7 +98,7 @@ similar functionalities for Spain excluding the Basque Country and Navarre.
## Terms and conditions of use

Data provided by the Government of Navarre under [Creative Commons Attribution
(CC BY 4.0)](https://creativecommons.org/licenses/by/4.0/deed.en_EN). The
(CC BY 4.0)](https://creativecommons.org/licenses/by/4.0/deed.en_en). The
service is provided "as is", and without guarantee of any kind, implicit or
explicit.

Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
[![rOS-badge](https://ropenspain.github.io/rostemplate/reference/figures/ropenspain-badge.svg)](https://ropenspain.es/)
[![CatastRoNav status
badge](https://ropenspain.r-universe.dev/badges/CatastRoNav)](https://ropenspain.r-universe.dev/CatastRoNav)
[![R-CMD-check](https://github.com/rOpenSpain/CatastRoNav/workflows/R-CMD-check/badge.svg)](https://github.com/rOpenSpain/CatastRoNav/actions?query=workflow%3AR-CMD-check)
[![R-CMD-check](https://github.com/rOpenSpain/CatastRoNav/actions/workflows/roscron-check-standard.yaml/badge.svg)](https://github.com/rOpenSpain/CatastRoNav/actions/workflows/roscron-check-standard.yaml)
[![codecov](https://codecov.io/gh/rOpenSpain/CatastroNav/branch/main/graph/badge.svg)](https://app.codecov.io/gh/rOpenSpain/CatastroNav)
[![DOI](https://img.shields.io/badge/DOI-10.5281/zenodo.6366407-blue)](https://doi.org/10.5281/zenodo.6366407)
[![Project-Status:Active](https://www.repostatus.org/badges/latest/active.svg)](https://www.repostatus.org/#active)
Expand Down Expand Up @@ -47,7 +47,7 @@ install_github("rOpenSpain/CatastRoNav", dependencies = TRUE)
## Usage

The WFS service allows to download vector objects of specific cadastral
elements. The result is provided as `sf` objects (See **sf** package).
elements. The result is provided as objects (See **sf** package).

``` r
library(CatastRoNav)
Expand Down Expand Up @@ -96,7 +96,7 @@ and Navarre.

Data provided by the Government of Navarre under [Creative Commons
Attribution (CC BY
4.0)](https://creativecommons.org/licenses/by/4.0/deed.en_EN). The
4.0)](https://creativecommons.org/licenses/by/4.0/deed.en_en). The
service is provided “as is”, and without guarantee of any kind, implicit
or explicit.

Expand Down
6 changes: 3 additions & 3 deletions codemeta.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"name": "R",
"url": "https://r-project.org"
},
"runtimePlatform": "R version 4.3.1 (2023-06-16 ucrt)",
"runtimePlatform": "R version 4.3.2 (2023-10-31 ucrt)",
"author": [
{
"@type": "Person",
Expand Down Expand Up @@ -178,7 +178,7 @@
},
"SystemRequirements": null
},
"fileSize": "854.073KB",
"fileSize": "890.901KB",
"citation": [
{
"@type": "SoftwareSourceCode",
Expand All @@ -199,7 +199,7 @@
],
"releaseNotes": "https://github.com/rOpenSpain/CatastRoNav/blob/master/NEWS.md",
"readme": "https://github.com/rOpenSpain/CatastRoNav/blob/main/README.md",
"contIntegration": ["https://github.com/rOpenSpain/CatastRoNav/actions?query=workflow%3AR-CMD-check", "https://app.codecov.io/gh/rOpenSpain/CatastroNav"],
"contIntegration": ["https://github.com/rOpenSpain/CatastRoNav/actions/workflows/roscron-check-standard.yaml", "https://app.codecov.io/gh/rOpenSpain/CatastroNav"],
"developmentStatus": "https://www.repostatus.org/#active",
"keywords": ["r", "maps", "spain", "navarra", "catastro", "r-package", "r-stats", "ropenspain"]
}
6 changes: 0 additions & 6 deletions inst/WORDLIST
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
CMD
CRS
Cadastral
Cadastre
CatastRo
CatastRoNav’
Catastro
DOI
EPSG
ETRS
Hernangomez
Navarra
ORCID
Olite
Expand All @@ -19,9 +15,7 @@ SRS
WFS
cadastral
cadastre
codecov
de
mapSpain
organisations
pre
rOS
2 changes: 1 addition & 1 deletion inst/schemaorg.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"name": "R",
"url": "https://r-project.org"
},
"runtimePlatform": "R version 4.3.1 (2023-06-16 ucrt)",
"runtimePlatform": "R version 4.3.2 (2023-10-31 ucrt)",
"version": "0.0.2.9000"
},
{
Expand Down
11 changes: 8 additions & 3 deletions man/catrnav_wfs_get_address_bbox.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 8 additions & 3 deletions man/catrnav_wfs_get_buildings_bbox.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 8 additions & 3 deletions man/catrnav_wfs_get_parcels_bbox.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file modified man/figures/README-wfs-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions pkgdown/_pkgdown.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ template:
authors:
Diego Hernangómez:
href: 'https://dieghernan.github.io/'

7 changes: 5 additions & 2 deletions tests/testthat/test-catrnav_wfs_ad.R
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,17 @@ test_that("BBOX Check projections", {
1071171, 4748024
),
srs = 25829,
verbose = TRUE
verbose = TRUE,
count = 5
))

obj <- catrnav_wfs_get_address_bbox(c(1071071, 4747924, 1071171, 4748024),
srs = 25829
srs = 25829,
count = 10
)

expect_true(sf::st_crs(obj) == sf::st_crs(25829))
expect_true(nrow(obj) == 10)


# test conversion
Expand Down
Loading

0 comments on commit c2428c7

Please sign in to comment.