Skip to content

Commit

Permalink
Update docs and examples
Browse files Browse the repository at this point in the history
  • Loading branch information
dieghernan committed Jan 15, 2024
1 parent 7673bbf commit 9451423
Show file tree
Hide file tree
Showing 22 changed files with 50 additions and 45 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/wipe-cache.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
name: Clear GHA caches manually
on:
workflow_dispatch:

schedule:
- cron: '0 18 15 * *'
jobs:
cache-clear:
runs-on: ubuntu-latest
Expand Down
32 changes: 16 additions & 16 deletions CITATION.cff
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ preferred-citation:
email: [email protected]
orcid: https://orcid.org/0000-0001-8457-4658
affiliation: rOpenSpain
year: '2023'
year: '2024'
version: 0.8.0
doi: 10.5281/zenodo.5366622
url: https://ropenspain.github.io/mapSpain/
Expand Down Expand Up @@ -78,7 +78,7 @@ references:
- name: R Core Team
location:
name: Vienna, Austria
year: '2023'
year: '2024'
institution:
name: R Foundation for Statistical Computing
version: '>= 3.6.0'
Expand All @@ -93,7 +93,7 @@ references:
given-names: Vincent
email: [email protected]
orcid: https://orcid.org/0000-0003-2042-7063
year: '2023'
year: '2024'
version: '>= 1.2.0'
- type: software
title: giscoR
Expand All @@ -107,7 +107,7 @@ references:
email: [email protected]
orcid: https://orcid.org/0000-0001-8457-4658
affiliation: rOpenGov
year: '2023'
year: '2024'
version: '>= 0.2.4'
- type: software
title: rappdirs
Expand All @@ -123,7 +123,7 @@ references:
given-names: Trent
- family-names: Davis
given-names: Trevor
year: '2023'
year: '2024'
version: '>= 0.3.0'
- type: software
title: sf
Expand All @@ -136,7 +136,7 @@ references:
given-names: Edzer
email: [email protected]
orcid: https://orcid.org/0000-0001-8049-7069
year: '2023'
year: '2024'
version: '>= 0.9.0'
- type: software
title: utils
Expand All @@ -146,7 +146,7 @@ references:
- name: R Core Team
location:
name: Vienna, Austria
year: '2023'
year: '2024'
institution:
name: R Foundation for Statistical Computing
- type: software
Expand Down Expand Up @@ -183,7 +183,7 @@ references:
- family-names: Dunnington
given-names: Dewey
orcid: https://orcid.org/0000-0002-9415-4582
year: '2023'
year: '2024'
version: '>= 3.0.0'
- type: software
title: knitr
Expand All @@ -196,7 +196,7 @@ references:
given-names: Yihui
email: [email protected]
orcid: https://orcid.org/0000-0003-0645-5666
year: '2023'
year: '2024'
- type: software
title: leaflet
abstract: 'leaflet: Create Interactive Web Maps with the JavaScript ''Leaflet''
Expand All @@ -216,7 +216,7 @@ references:
given-names: Bhaskar
- family-names: Xie
given-names: Yihui
year: '2023'
year: '2024'
version: '>= 2.0.0'
- type: software
title: png
Expand All @@ -228,7 +228,7 @@ references:
- family-names: Urbanek
given-names: Simon
email: [email protected]
year: '2023'
year: '2024'
version: '>= 0.1-5'
- type: software
title: rmarkdown
Expand Down Expand Up @@ -272,7 +272,7 @@ references:
given-names: Richard
email: [email protected]
orcid: https://orcid.org/0000-0003-3925-190X
year: '2023'
year: '2024'
- type: software
title: slippymath
abstract: 'slippymath: Slippy Map Tile Tools'
Expand All @@ -287,7 +287,7 @@ references:
- family-names: Sumner
given-names: Michael
email: [email protected]
year: '2023'
year: '2024'
version: '>= 0.3.1'
- type: software
title: terra
Expand All @@ -300,7 +300,7 @@ references:
given-names: Robert J.
email: [email protected]
orcid: https://orcid.org/0000-0001-5872-2872
year: '2023'
year: '2024'
version: '>= 1.1-4'
- type: software
title: testthat
Expand All @@ -312,7 +312,7 @@ references:
- family-names: Wickham
given-names: Hadley
email: [email protected]
year: '2023'
year: '2024'
version: '>= 3.0.0'
- type: software
title: tidyterra
Expand All @@ -326,4 +326,4 @@ references:
given-names: Diego
email: [email protected]
orcid: https://orcid.org/0000-0001-8457-4658
year: '2023'
year: '2024'
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ Copyright: © EuroGeographics for the administrative boundaries. Atlas
Encoding: UTF-8
LazyData: true
Roxygen: list(markdown = TRUE)
RoxygenNote: 7.2.3
RoxygenNote: 7.3.0
X-schema.org-applicationCategory: cartography
X-schema.org-isPartOf: https://ropenspain.es/
X-schema.org-keywords: rOpenSpain, tiles, r, maps, spatial, rstats,
Expand Down
2 changes: 1 addition & 1 deletion R/data.R
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#'
#' @source
#' * **INE**: Instituto Nacional de Estadistica: <https://www.ine.es/>
#' * **Eurostat (NUTS)**: <https://ec.europa.eu/eurostat/web/nuts/background>
#' * **Eurostat (NUTS)**: <https://ec.europa.eu/eurostat/web/nuts/overview>
#' * **ISO**: <https://www.iso.org/home.html>
#' * **CLDR**: <https://unicode-org.github.io/cldr-staging/charts/38/index.html>
#'
Expand Down
13 changes: 6 additions & 7 deletions R/esp_getTiles.R
Original file line number Diff line number Diff line change
Expand Up @@ -145,15 +145,14 @@
#' geom_sf(data = segovia, fill = NA, color = "white", linewidth = 2)
#'
#' # Example from https://leaflet-extras.github.io/leaflet-providers/preview/
#' stamen_water <- list(
#' id = "Stamen_Water",
#' q = "https://stamen-tiles-b.a.ssl.fastly.net/watercolor/{z}/{x}/{y}.jpg"
#' cartodb_voyager <- list(
#' id = "CartoDB_Voyager",
#' q = "https://a.basemaps.cartocdn.com/rastertiles/voyager/{z}/{x}/{y}.png"
#' )
#' cartodb <- esp_getTiles(segovia, cartodb_voyager, zoommin = 1)
#'
#' stamen <- esp_getTiles(segovia, stamen_water, zoommin = 1)
#'
#' autoplot(stamen) +
#' geom_sf(data = segovia, fill = NA, color = "white", linewidth = 1)
#' autoplot(cartodb) +
#' geom_sf(data = segovia, fill = NA, color = "black", linewidth = 1)
#' }
esp_getTiles <- function(x,
type = "IDErioja",
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ Some packages recommended for visualization are:
## Citation

<p>
Hernangómez D (2023). <em>mapSpain: Administrative Boundaries of
Hernangómez D (2024). <em>mapSpain: Administrative Boundaries of
Spain</em>.
<a href="https://doi.org/10.5281/zenodo.5366622">doi:10.5281/zenodo.5366622</a>,
<a href="https://ropenspain.github.io/mapSpain/">https://ropenspain.github.io/mapSpain/</a>.
Expand All @@ -266,7 +266,7 @@ A BibTeX entry for LaTeX users is:

@Manual{R-mapspain,
title = {{mapSpain}: Administrative Boundaries of Spain},
year = {2023},
year = {2024},
version = {0.8.0},
author = {Diego Hernangómez},
doi = {10.5281/zenodo.5366622},
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.2 (2023-10-31 ucrt)",
"runtimePlatform": "R version 4.3.2 (2023-10-31)",
"provider": {
"@id": "https://cran.r-project.org",
"@type": "Organization",
Expand Down Expand Up @@ -233,11 +233,11 @@
"applicationCategory": "cartography",
"isPartOf": "https://ropenspain.es/",
"keywords": ["rOpenSpain", "tiles", "r", "maps", "spatial", "rstats", "r-package", "municipalities", "Spain", "gisco", "provinces", "ign", "administrative-boundaries", "ccaa", "static-tiles", "spain", "cran", "ropenspain", "ggplot2", "gis"],
"fileSize": "2730.041KB",
"fileSize": "2716.503KB",
"citation": [
{
"@type": "SoftwareSourceCode",
"datePublished": "2023",
"datePublished": "2024",
"author": [
{
"@type": "Person",
Expand Down
Binary file modified data/esp_codelist.rda
Binary file not shown.
Binary file modified data/esp_tiles_providers.rda
Binary file not shown.
Binary file modified data/leaflet.providersESP.df.rda
Binary file not shown.
Binary file modified img/README-giscoR-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified img/README-static-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified img/README-tile-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion inst/schemaorg.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"name": "Comprehensive R Archive Network (CRAN)",
"url": "https://cran.r-project.org"
},
"runtimePlatform": "R version 4.3.2 (2023-10-31 ucrt)",
"runtimePlatform": "R version 4.3.2 (2023-10-31)",
"version": "0.8.0"
},
{
Expand Down
2 changes: 1 addition & 1 deletion man/esp_codelist.Rd

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

13 changes: 6 additions & 7 deletions man/esp_getTiles.Rd

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

Binary file modified vignettes/basic-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified vignettes/basic2-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified vignettes/basic3-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified vignettes/choro-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified vignettes/giscoR-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
16 changes: 11 additions & 5 deletions vignettes/mapSpain.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -202,21 +202,27 @@ used).
# Population density of Spain

library(sf)
#> Error in value[[3L]](cond): Package 'sf' version 1.0.14 cannot be unloaded:
#> Error in unloadNamespace(package) : namespace 'sf' is imported by 'mapSpain' so cannot be unloaded

pop <- mapSpain::pobmun19
munic <- esp_get_munic()

# Get area (km2) - Use LAEA projection
municarea <- as.double(st_area(st_transform(munic, 3035)) / 1000000)
#> Error in st_area(st_transform(munic, 3035)): could not find function "st_area"
munic$area <- municarea
#> Error in eval(expr, envir, enclos): object 'municarea' not found

munic.pop <- merge(munic, pop, all.x = TRUE, by = c("cpro", "cmun"))
munic.pop$dens <- munic.pop$pob19 / munic.pop$area
#> Error in `[[<-.data.frame`(`*tmp*`, i, value = numeric(0)): replacement has 0 rows, data has 8131

br <- c(-Inf, 10, 25, 100, 200, 500, 1000, 5000, 10000, Inf)


munic.pop$cuts <- cut(munic.pop$dens, br)
#> Error in cut.default(munic.pop$dens, br): 'x' must be numeric

ggplot(munic.pop) +
geom_sf(aes(fill = cuts), color = NA, linewidth = 0) +
Expand All @@ -240,13 +246,13 @@ ggplot(munic.pop) +
text = element_text(colour = "white"),
legend.position = "bottom"
)
#> Error in `geom_sf()`:
#> ! Problem while computing aesthetics.
#> ℹ Error occurred in the 1st layer.
#> Caused by error:
#> ! object 'cuts' not found
```

<div class="figure">
<img src="./thematic-1.png" alt="Population density in Spain (2019)" width="100%" />
<p class="caption">Population density in Spain (2019)</p>
</div>

## mapSpain and giscoR

If you need to plot Spain along with another countries, consider using
Expand Down

0 comments on commit 9451423

Please sign in to comment.