Skip to content

Commit

Permalink
Afegeix codi per restaurar les localitats que fan d'admin_centre de m…
Browse files Browse the repository at this point in the history
…unicipis
  • Loading branch information
jmaspons committed Sep 21, 2023
1 parent f7b5210 commit decc79b
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# R specific hooks: https://github.com/lorenzwalthert/precommit
repos:
- repo: https://github.com/lorenzwalthert/precommit
rev: v0.3.2.9019
rev: v0.3.2.9021
hooks:
- id: style-files
args: [--style_pkg=styler, --style_fun=tidyverse_style]
Expand Down
30 changes: 30 additions & 0 deletions exec/restaura_etiquetes.r
Original file line number Diff line number Diff line change
Expand Up @@ -88,3 +88,33 @@ if (nrow(canvis_municipis$comparison_df) > 0) {
message("Conjunts de canvis a municipis:")
print(conjunts_de_canvis_municipis)
}


## Localitats ----

canvis_loc_admin_centre_munici <- comprova_canvis_osm(
loc_admin_centre_municipis[, setdiff(names(loc_admin_centre_municipis), c("regio", "comarca", "municipi"))],
centre = TRUE
)
# canvis_html(canvis_loc_admin_centre_munici)

if (nrow(canvis_loc_admin_centre_munici$comparison_df) > 0) {
uid_modificats <- gsub("https://osm\\.org/", "", canvis_loc_admin_centre_munici$comparison_df$osm_url)
uid_localitats <- paste0(loc_admin_centre_municipis$osm_type, "/", loc_admin_centre_municipis$osm_id)

localitats_modificar <- loc_admin_centre_municipis[uid_localitats %in% uid_modificats, ]

comarques <- unique(localitats_modificar$comarca)
conjunts_de_canvis_localitats <- structure(character(length(comarques)), names = comarques)

for (comarca in comarques) {
conjunts_de_canvis_localitats[comarca] <- modifica_etiquetes_osm(
x = localitats_modificar[localitats_modificar$comarca %in% comarca, ],
claus = c("name:ca", "name", "wikipedia", "wikidata", "place", "capital", "admin_level"),
comentari = paste0("Restaura les etiquetes de les localitats a ", comarca, "."),
hashtags = "monitorOSM"
)
}
message("Conjunts de canvis a localitats:")
print(conjunts_de_canvis_localitats)
}

0 comments on commit decc79b

Please sign in to comment.