Skip to content

Commit

Permalink
Prepare first stable release
Browse files Browse the repository at this point in the history
  • Loading branch information
dieghernan committed Jun 7, 2024
1 parent 1bba632 commit 8841794
Show file tree
Hide file tree
Showing 15 changed files with 91 additions and 79 deletions.
11 changes: 7 additions & 4 deletions .github/workflows/test-coverage.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Workflow derived from https://github.com/r-lib/actions/tree/master/examples
# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
on:
push:
Expand All @@ -10,9 +10,10 @@ name: test-coverage

jobs:
test-coverage:
runs-on: macos-latest
runs-on: ubuntu-latest
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

steps:
- uses: actions/checkout@v4
Expand All @@ -28,18 +29,20 @@ jobs:

- name: Test coverage
run: |
token <- Sys.getenv("CODECOV_TOKEN", "")
covr::codecov(
quiet = FALSE,
clean = FALSE,
install_path = file.path(Sys.getenv("RUNNER_TEMP"), "package")
install_path = file.path(normalizePath(Sys.getenv("RUNNER_TEMP"), winslash = "/"), "package"),
token = if (token != "") token
)
shell: Rscript {0}

- name: Show testthat output
if: always()
run: |
## --------------------------------------------------------------------
find ${{ runner.temp }}/package -name 'testthat.Rout*' -exec cat '{}' \; || true
find '${{ runner.temp }}/package' -name 'testthat.Rout*' -exec cat '{}' \; || true
shell: bash

- name: Upload test results
Expand Down
4 changes: 2 additions & 2 deletions CITATION.cff
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ message: 'To cite package "CatastRoNav" in publications use:'
type: software
license: CC-BY-4.0
title: 'CatastRoNav: Interface to the ''INSPIRE'' services of ''Catastro de Navarra'''
version: 0.0.2.9000
version: 0.1.0
doi: 10.5281/zenodo.6366407
abstract: Access public spatial data available under the 'INSPIRE' directive. Tools
for downloading references, buildings and addresses of properties on Navarre (Spain).
Expand All @@ -26,7 +26,7 @@ preferred-citation:
email: diego.hernangomezherrero@gmail.com
orcid: https://orcid.org/0000-0001-8457-4658
year: '2024'
version: 0.0.2.9000
version: 0.1.0
doi: 10.5281/zenodo.6366407
url: https://ropenspain.github.io/CatastRoNav/
abstract: Access public spatial data available under the INSPIRE directive. Tools
Expand Down
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: CatastRoNav
Title: Interface to the 'INSPIRE' services of 'Catastro de Navarra'
Version: 0.0.2.9000
Version: 0.1.0
Authors@R:
person("Diego", "Hernangómez", , "diego.hernangomezherrero@gmail.com", role = c("aut", "cre"),
comment = c(ORCID = "0000-0001-8457-4658"))
Expand Down
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
export(catrnav_atom_get_parcels)
export(catrnav_atom_get_parcels_db_all)
export(catrnav_clear_cache)
export(catrnav_detect_cache_dir)
export(catrnav_set_cache_dir)
export(catrnav_wfs_get_address_bbox)
export(catrnav_wfs_get_buildings_bbox)
Expand Down
5 changes: 3 additions & 2 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# CatastRoNav (development version)
# CatastRoNav 0.1.0

- Improve condition handling.
- Add a `count` parameter that allows to set the maximum number of features to
Expand All @@ -7,7 +7,8 @@
- Support for ATOM on cadastral parcels added, see
`catrnav_atom_get_parcels()`. Other ATOM capabilities to be added when
the Cadastre of Navarra make them available.
- New caching system, see `catrnav_set_cache_dir()`.
- New caching system, see `catrnav_set_cache_dir()` and
`catrnav_detect_cache_dir()`.
- New dependency: **rappdirs** .

# CatastRoNav 0.0.2
Expand Down
44 changes: 38 additions & 6 deletions R/cache_set.R
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,21 @@
#' @family cache utilities
#' @seealso [rappdirs::user_config_dir()]
#'
#' @return An (invisible) character with the path to your `cache_dir`.
#' @rdname catrnav_set_cache_dir
#'
#' @return
#' [catrnav_set_cache_dir()] is called for its side effects, and returns an
#' (invisible) character with the path to your `cache_dir`.
#'
#' @description
#' This function will store your `cache_dir` path on your local machine and
#' would load it for future sessions. Type `Sys.getenv("CATASTRONAV_CACHE_DIR")`
#' to find your cached path.
#' [catrnav_set_cache_dir()] will store your `cache_dir` path on your local
#' machine and would load it for future sessions.
#'
#' Alternatively, you can store the `cache_dir` manually with the following
#' options:
#' * Run `Sys.setenv(CATASTRONAV_CACHE_DIR = "cache_dir")`. You would need to
#' run this command on each session (Similar to `install = FALSE`).
#' * Write this line on your `.Renviron` file:
#' * Write this line on your .Renviron file:
#' `CATASTRONAV_CACHE_DIR = "value_for_cache_dir"` (same behavior than
#' `install = TRUE`). This would store your `cache_dir` permanently.
#'
Expand Down Expand Up @@ -44,7 +48,6 @@
#' catrnav_set_cache_dir(verbose = TRUE)
#' }
#'
#' Sys.getenv("CATASTRONAV_CACHE_DIR")
#' @export
catrnav_set_cache_dir <- function(cache_dir,
overwrite = FALSE,
Expand Down Expand Up @@ -128,6 +131,35 @@ catrnav_set_cache_dir <- function(cache_dir,
}


#' @rdname catrnav_set_cache_dir
#' @name catrnav_detect_cache_dir
#'
#' @export
#'
#' @description
#' [catrnav_detect_cache_dir()] detects and returns the path to your current
#' `cache_dir`.
#'
#' @param ... Ignored
#' @return
#' [catrnav_detect_cache_dir()] returns the path to the `cache_dir` used in this
#' session
#'
#' @examples
#'
#' catrnav_detect_cache_dir()
#'
catrnav_detect_cache_dir <- function(...) {
# nocov start
# This is just a wrapper

list(...)
cache <- catrnav_hlp_detect_cache_dir()

cache
# nocov end
}

#' Detect cache dir for CatastRoNav
#'
#' @noRd
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ A BibTeX entry for LaTeX users is:
title = {{CatastRoNav}: Interface to the {API} {Catastro} de {Navarra}},
author = {Diego Hernangómez},
year = {2024},
version = {0.0.2.9000},
version = {0.1.0},
doi = {10.5281/zenodo.6366407},
url = {https://ropenspain.github.io/CatastRoNav/},
abstract = {Access public spatial data available under the INSPIRE directive. Tools for downloading references, buildings and addresses of properties on Navarre (Spain).},
Expand Down
4 changes: 2 additions & 2 deletions codemeta.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"codeRepository": "https://github.com/rOpenSpain/CatastRoNav",
"issueTracker": "https://github.com/rOpenSpain/CatastRoNav/issues",
"license": "https://spdx.org/licenses/CC-BY-4.0",
"version": "0.0.2.9000",
"version": "0.1.0",
"programmingLanguage": {
"@type": "ComputerLanguage",
"name": "R",
Expand Down Expand Up @@ -190,7 +190,7 @@
},
"SystemRequirements": null
},
"fileSize": "962.98KB",
"fileSize": "961.034KB",
"citation": [
{
"@type": "SoftwareSourceCode",
Expand Down
2 changes: 1 addition & 1 deletion inst/WORDLIST
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ Navarra
ORCID
Olite
Pamplona
Renviron
Royé
SITNA
SRS
WFS
cadastral
cadastre
catrnav
codecov
config
de
Expand Down
2 changes: 1 addition & 1 deletion inst/schemaorg.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"url": "https://r-project.org"
},
"runtimePlatform": "R version 4.4.0 (2024-04-24 ucrt)",
"version": "0.0.2.9000"
"version": "0.1.0"
},
{
"id": "https://doi.org/10.5281/zenodo.6366407",
Expand Down
25 changes: 19 additions & 6 deletions man/catrnav_set_cache_dir.Rd

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

49 changes: 13 additions & 36 deletions vignettes/CatastRoNav.Rmd
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: "Get started"
output: rmarkdown::html_vignette
date: "2024-05-28"
date: "2024-06-07"
vignette: >
%\VignetteIndexEntry{Get started}
%\VignetteEngine{knitr::rmarkdown}
Expand Down Expand Up @@ -107,45 +107,32 @@ we created before:
# Cut buildings

dataviz <- st_intersection(pamp_bu, pamp_buff)
#> Error in UseMethod("st_intersection"): no applicable method for 'st_intersection' applied to an object of class "NULL"
```

``` r

ggplot(dataviz) +
geom_sf()
#> Error in eval(expr, envir, enclos): object 'dataviz' not found
```

<div class="figure">
<img src="./minimal-1.png" alt="Minimal map" width="100%" />
<p class="caption">Minimal map</p>
</div>

Let's extract now the construction year, available in the column `beginning`:


``` r
# Extract 4 initial positions
year <- substr(dataviz$beginning, 1, 4)
#> Error in eval(expr, envir, enclos): object 'dataviz' not found
```

``` r

# Replace all that doesn't look as a number with 0000
year[!(year %in% 0:2500)] <- "0000"
#> Error: object 'year' not found
```

``` r

# To numeric
year <- as.integer(year)
#> Error in eval(expr, envir, enclos): object 'year' not found
```

``` r

# New column
dataviz <- dataviz %>%
mutate(year = year)
#> Error in eval(expr, envir, enclos): object 'dataviz' not found
```

Last step is to create groups based on the year and create the data
Expand All @@ -155,25 +142,11 @@ different classes:

``` r
dataviz <- dataviz %>%
mutate(year_cat = ggplot2::cut_width(year,
width = 10
))
#> Error in eval(expr, envir, enclos): object 'dataviz' not found
```

``` r

mutate(year_cat = ggplot2::cut_width(year, width = 10, dig.lab = 12))

# Adjust the color palette

dataviz_pal <- hcl.colors(
length(levels(dataviz$year_cat)),
"Spectral"
)
#> Error in eval(expr, envir, enclos): object 'dataviz' not found
```

``` r
dataviz_pal <- hcl.colors(length(levels(dataviz$year_cat)), "Spectral")

ggplot(dataviz) +
geom_sf(aes(fill = year_cat), color = NA) +
Expand All @@ -199,9 +172,13 @@ ggplot(dataviz) +
),
plot.margin = margin(r = 40, l = 40)
)
#> Error in eval(expr, envir, enclos): object 'dataviz' not found
```

<div class="figure">
<img src="./dataviz-1.png" alt="Pamplona: Urban Growth" width="100%" />
<p class="caption">Pamplona: Urban Growth</p>
</div>

## References

- Royé D (2019). "Visualize urban growth."
Expand Down
Loading

0 comments on commit 8841794

Please sign in to comment.